Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pairs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
software
pairs
Commits
2dca66c5
Commit
2dca66c5
authored
5 months ago
by
Behzad Safaei
Browse files
Options
Downloads
Patches
Plain Diff
Add flags and shapes namespaces
parent
887e461b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
runtime/create_body.cpp
+3
-3
3 additions, 3 deletions
runtime/create_body.cpp
runtime/pairs_common.hpp
+13
-4
13 additions, 4 deletions
runtime/pairs_common.hpp
runtime/read_from_file.cpp
+2
-2
2 additions, 2 deletions
runtime/read_from_file.cpp
runtime/vtk.cpp
+4
-4
4 additions, 4 deletions
runtime/vtk.cpp
with
22 additions
and
13 deletions
runtime/create_body.cpp
+
3
−
3
View file @
2dca66c5
...
@@ -16,9 +16,9 @@ id_t create_halfspace(PairsRuntime *pr,
...
@@ -16,9 +16,9 @@ id_t create_halfspace(PairsRuntime *pr,
auto
positions
=
pr
->
getAsVectorProperty
(
pr
->
getPropertyByName
(
"position"
));
auto
positions
=
pr
->
getAsVectorProperty
(
pr
->
getPropertyByName
(
"position"
));
auto
normals
=
pr
->
getAsVectorProperty
(
pr
->
getPropertyByName
(
"normal"
));
auto
normals
=
pr
->
getAsVectorProperty
(
pr
->
getPropertyByName
(
"normal"
));
if
(
pr
->
getDomainPartitioner
()
->
isWithinSubdomain
(
x
,
y
,
z
)
||
flag
&
(
FLAGS_
INFINITE
|
FLAGS_FIXED
|
FLAGS_
GLOBAL
)
){
if
(
pr
->
getDomainPartitioner
()
->
isWithinSubdomain
(
x
,
y
,
z
)
||
flag
&
(
flags
::
INFINITE
|
flags
::
GLOBAL
)
){
int
n
=
pr
->
getTrackedVariableAsInteger
(
"nlocal"
);
int
n
=
pr
->
getTrackedVariableAsInteger
(
"nlocal"
);
uid
=
(
flag
&
FLAGS_
GLOBAL
)
?
UniqueID
::
createGlobal
(
pr
)
:
UniqueID
::
create
(
pr
);
uid
=
(
flag
&
flags
::
GLOBAL
)
?
UniqueID
::
createGlobal
(
pr
)
:
UniqueID
::
create
(
pr
);
uids
(
n
)
=
uid
;
uids
(
n
)
=
uid
;
positions
(
n
,
0
)
=
x
;
positions
(
n
,
0
)
=
x
;
positions
(
n
,
1
)
=
y
;
positions
(
n
,
1
)
=
y
;
...
@@ -53,7 +53,7 @@ id_t create_sphere(PairsRuntime *pr,
...
@@ -53,7 +53,7 @@ id_t create_sphere(PairsRuntime *pr,
if
(
pr
->
getDomainPartitioner
()
->
isWithinSubdomain
(
x
,
y
,
z
))
{
if
(
pr
->
getDomainPartitioner
()
->
isWithinSubdomain
(
x
,
y
,
z
))
{
int
n
=
pr
->
getTrackedVariableAsInteger
(
"nlocal"
);
int
n
=
pr
->
getTrackedVariableAsInteger
(
"nlocal"
);
uid
=
(
flag
&
FLAGS_
GLOBAL
)
?
UniqueID
::
createGlobal
(
pr
)
:
UniqueID
::
create
(
pr
);
uid
=
(
flag
&
flags
::
GLOBAL
)
?
UniqueID
::
createGlobal
(
pr
)
:
UniqueID
::
create
(
pr
);
uids
(
n
)
=
uid
;
uids
(
n
)
=
uid
;
radii
(
n
)
=
radius
;
radii
(
n
)
=
radius
;
masses
(
n
)
=
((
4.0
/
3.0
)
*
M_PI
)
*
radius
*
radius
*
radius
*
density
;
masses
(
n
)
=
((
4.0
/
3.0
)
*
M_PI
)
*
radius
*
radius
*
radius
*
density
;
...
...
This diff is collapsed.
Click to expand it.
runtime/pairs_common.hpp
+
13
−
4
View file @
2dca66c5
...
@@ -15,11 +15,20 @@ namespace pairs {
...
@@ -15,11 +15,20 @@ namespace pairs {
#define PAIRS_ATTR_HOST_DEVICE
#define PAIRS_ATTR_HOST_DEVICE
#endif
#endif
constexpr
int
FLAGS_INFINITE
=
1
<<
0
;
namespace
flags
{
constexpr
int
FLAGS_GHOST
=
1
<<
1
;
constexpr
int
INFINITE
=
1
<<
0
;
constexpr
int
FLAGS_FIXED
=
1
<<
2
;
constexpr
int
GHOST
=
1
<<
1
;
constexpr
int
FLAGS_GLOBAL
=
1
<<
3
;
constexpr
int
FIXED
=
1
<<
2
;
constexpr
int
GLOBAL
=
1
<<
3
;
}
namespace
shapes
{
enum
Type
{
Sphere
=
0
,
Halfspace
=
1
,
PointMass
=
2
};
}
//#ifdef USE_DOUBLE_PRECISION
//#ifdef USE_DOUBLE_PRECISION
typedef
double
real_t
;
typedef
double
real_t
;
//#else
//#else
...
...
This diff is collapsed.
Click to expand it.
runtime/read_from_file.cpp
+
2
−
2
View file @
2dca66c5
...
@@ -114,8 +114,8 @@ size_t read_particle_data(
...
@@ -114,8 +114,8 @@ size_t read_particle_data(
i
++
;
i
++
;
}
}
if
(
within_domain
||
flags
&
(
FLAGS_
INFINITE
|
FLAGS_
FIXED
|
FLAGS_
GLOBAL
))
{
if
(
within_domain
||
flags
&
(
flags
::
INFINITE
|
flags
::
FIXED
|
flags
::
GLOBAL
))
{
uid_ptr
(
n
)
=
(
flags
&
FLAGS_
GLOBAL
)
?
UniqueID
::
createGlobal
(
ps
)
:
UniqueID
::
create
(
ps
);
uid_ptr
(
n
)
=
(
flags
&
flags
::
GLOBAL
)
?
UniqueID
::
createGlobal
(
ps
)
:
UniqueID
::
create
(
ps
);
shape_ptr
(
n
++
)
=
shape_id
;
shape_ptr
(
n
++
)
=
shape_id
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
runtime/vtk.cpp
+
4
−
4
View file @
2dca66c5
...
@@ -34,7 +34,7 @@ void vtk_write_data(
...
@@ -34,7 +34,7 @@ void vtk_write_data(
ps
->
copyPropertyToHost
(
flags
,
ReadOnly
);
ps
->
copyPropertyToHost
(
flags
,
ReadOnly
);
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
if
(
flags
(
i
)
&
FLAGS_
INFINITE
)
{
if
(
flags
(
i
)
&
flags
::
INFINITE
)
{
n
--
;
n
--
;
}
}
}
}
...
@@ -47,7 +47,7 @@ void vtk_write_data(
...
@@ -47,7 +47,7 @@ void vtk_write_data(
out_file
<<
"POINTS "
<<
n
<<
" double
\n
"
;
out_file
<<
"POINTS "
<<
n
<<
" double
\n
"
;
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
if
(
!
(
flags
(
i
)
&
FLAGS_
INFINITE
))
{
if
(
!
(
flags
(
i
)
&
flags
::
INFINITE
))
{
out_file
<<
std
::
fixed
<<
std
::
setprecision
(
prec
)
<<
positions
(
i
,
0
)
<<
" "
;
out_file
<<
std
::
fixed
<<
std
::
setprecision
(
prec
)
<<
positions
(
i
,
0
)
<<
" "
;
out_file
<<
std
::
fixed
<<
std
::
setprecision
(
prec
)
<<
positions
(
i
,
1
)
<<
" "
;
out_file
<<
std
::
fixed
<<
std
::
setprecision
(
prec
)
<<
positions
(
i
,
1
)
<<
" "
;
out_file
<<
std
::
fixed
<<
std
::
setprecision
(
prec
)
<<
positions
(
i
,
2
)
<<
"
\n
"
;
out_file
<<
std
::
fixed
<<
std
::
setprecision
(
prec
)
<<
positions
(
i
,
2
)
<<
"
\n
"
;
...
@@ -63,7 +63,7 @@ void vtk_write_data(
...
@@ -63,7 +63,7 @@ void vtk_write_data(
out_file
<<
"
\n\n
"
;
out_file
<<
"
\n\n
"
;
out_file
<<
"CELL_TYPES "
<<
n
<<
"
\n
"
;
out_file
<<
"CELL_TYPES "
<<
n
<<
"
\n
"
;
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
if
(
!
(
flags
(
i
)
&
FLAGS_
INFINITE
))
{
if
(
!
(
flags
(
i
)
&
flags
::
INFINITE
))
{
out_file
<<
"1
\n
"
;
out_file
<<
"1
\n
"
;
}
}
}
}
...
@@ -73,7 +73,7 @@ void vtk_write_data(
...
@@ -73,7 +73,7 @@ void vtk_write_data(
out_file
<<
"SCALARS mass double
\n
"
;
out_file
<<
"SCALARS mass double
\n
"
;
out_file
<<
"LOOKUP_TABLE default
\n
"
;
out_file
<<
"LOOKUP_TABLE default
\n
"
;
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
if
(
!
(
flags
(
i
)
&
FLAGS_
INFINITE
))
{
if
(
!
(
flags
(
i
)
&
flags
::
INFINITE
))
{
out_file
<<
std
::
fixed
<<
std
::
setprecision
(
prec
)
<<
masses
(
i
)
<<
"
\n
"
;
out_file
<<
std
::
fixed
<<
std
::
setprecision
(
prec
)
<<
masses
(
i
)
<<
"
\n
"
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment