Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loadbalancing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SLMS
loadbalancing
Commits
9e61be7c
Commit
9e61be7c
authored
Feb 7, 2019
by
Rene Halver
Browse files
Options
Downloads
Plain Diff
fixed merging problems
parents
75826c45
9fe6ab6a
No related branches found
No related tags found
1 merge request
!3
Voronoi
Pipeline
#16793
failed
Feb 7, 2019
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
example/ALL_test.cpp
+72
-35
72 additions, 35 deletions
example/ALL_test.cpp
with
72 additions
and
35 deletions
example/ALL_test.cpp
+
72
−
35
View file @
9e61be7c
...
...
@@ -154,11 +154,30 @@ void read_points(std::vector<ALL_Point<double>>& points,
#ifdef ALL_VTK_OUTPUT
// function to create a VTK output of the points in the system
void
print_points
(
std
::
vector
<
ALL_Point
<
double
>>
plist
,
int
step
,
MPI_Comm
comm
)
void
print_points
(
std
::
vector
<
ALL_Point
<
double
>>
plist
,
int
step
,
ALL_LB_t
method
,
MPI_Comm
comm
)
{
int
rank
,
n_ranks
;
static
bool
vtk_init
=
false
;
MPI_Comm_rank
(
comm
,
&
rank
);
MPI_Comm_size
(
comm
,
&
n_ranks
);
vtkMPIController
*
controller
;
// seperate init step required, since VORONOI does not
// use the MPI initialization of VTK within the library
if
(
method
==
ALL_LB_t
::
VORONOI
)
{
if
(
!
vtk_init
)
{
controller
=
vtkMPIController
::
New
();
controller
->
Initialize
();
controller
->
SetGlobalController
(
controller
);
vtk_init
=
true
;
}
}
auto
points
=
vtkSmartPointer
<
vtkPoints
>::
New
();
...
...
@@ -175,7 +194,15 @@ void print_points(std::vector<ALL_Point<double>> plist, int step, MPI_Comm comm)
for
(
auto
i
=
0
;
i
<
plist
.
size
();
++
i
)
weight
->
SetValue
(
i
,
plist
.
at
(
i
).
get_weight
());
auto
domain
=
vtkSmartPointer
<
vtkIntArray
>::
New
();
domain
->
SetNumberOfComponents
(
1
);
domain
->
SetNumberOfTuples
(
plist
.
size
());
domain
->
SetName
(
"domain"
);
for
(
auto
i
=
0
;
i
<
plist
.
size
();
++
i
)
domain
->
SetValue
(
i
,
rank
);
polydata
->
GetPointData
()
->
AddArray
(
weight
);
polydata
->
GetPointData
()
->
AddArray
(
domain
);
std
::
ostringstream
ss_local
;
ss_local
<<
"vtk_points/ALL_vtk_points_"
<<
std
::
setw
(
7
)
<<
std
::
setfill
(
'0'
)
<<
step
...
...
@@ -207,6 +234,7 @@ int main(int argc, char** argv)
MPI_Init
(
&
argc
,
&
argv
);
const
int
sys_dim
=
3
;
int
max_loop
=
N_LOOP
;
double
box_size
[
sys_dim
]
=
{
BOX_SIZE
,
BOX_SIZE
,
BOX_SIZE
};
std
::
vector
<
double
>
sys_size
(
6
);
sys_size
.
at
(
0
)
=
0
;
...
...
@@ -236,50 +264,59 @@ int main(int argc, char** argv)
}
else
if
(
argc
<
4
)
{
chosen_method
=
(
ALL_LB_t
)
atoi
(
argv
[
1
]);
gamma
=
atof
(
argv
[
2
]);
max_loop
=
atoi
(
argv
[
2
]);
}
else
if
(
argc
<
5
)
{
chosen_method
=
(
ALL_LB_t
)
atoi
(
argv
[
1
]);
gamma
=
ato
f
(
argv
[
2
]);
weighted_points
=
ato
i
(
argv
[
3
])
==
1
;
max_loop
=
ato
i
(
argv
[
2
]);
gamma
=
ato
f
(
argv
[
3
]);
}
else
if
(
argc
<
6
)
{
chosen_method
=
(
ALL_LB_t
)
atoi
(
argv
[
1
]);
gamma
=
atof
(
argv
[
2
]);
weighted_points
=
atoi
(
argv
[
3
])
==
1
;
filename
=
argv
[
4
];
max_loop
=
atoi
(
argv
[
2
]);
gamma
=
atof
(
argv
[
3
]);
weighted_points
=
atoi
(
argv
[
4
])
==
1
;
}
else
if
(
argc
<
7
)
{
chosen_method
=
(
ALL_LB_t
)
atoi
(
argv
[
1
]);
max_loop
=
atoi
(
argv
[
2
]);
gamma
=
atof
(
argv
[
3
]);
weighted_points
=
atoi
(
argv
[
4
])
==
1
;
filename
=
argv
[
5
];
}
else
if
(
argc
==
8
)
else
if
(
argc
==
9
)
{
chosen_method
=
(
ALL_LB_t
)
atoi
(
argv
[
1
]);
gamma
=
atof
(
argv
[
2
]);
weighted_points
=
atoi
(
argv
[
3
])
==
1
;
filename
=
argv
[
4
];
box_size
[
0
]
=
atof
(
argv
[
5
]);
box_size
[
1
]
=
atof
(
argv
[
6
]);
box_size
[
2
]
=
atof
(
argv
[
7
]);
sys_size
.
at
(
1
)
=
atof
(
argv
[
5
]);
sys_size
.
at
(
3
)
=
atof
(
argv
[
6
]);
sys_size
.
at
(
5
)
=
atof
(
argv
[
7
]);
}
else
if
(
argc
==
11
)
max_loop
=
atoi
(
argv
[
2
]);
gamma
=
atof
(
argv
[
3
]);
weighted_points
=
atoi
(
argv
[
4
])
==
1
;
filename
=
argv
[
5
];
box_size
[
0
]
=
atof
(
argv
[
6
]);
box_size
[
1
]
=
atof
(
argv
[
7
]);
box_size
[
2
]
=
atof
(
argv
[
8
]);
sys_size
.
at
(
1
)
=
atof
(
argv
[
6
]);
sys_size
.
at
(
3
)
=
atof
(
argv
[
7
]);
sys_size
.
at
(
5
)
=
atof
(
argv
[
8
]);
}
else
if
(
argc
==
12
)
{
chosen_method
=
(
ALL_LB_t
)
atoi
(
argv
[
1
]);
gamma
=
atof
(
argv
[
2
]);
weighted_points
=
atoi
(
argv
[
3
])
==
1
;
filename
=
argv
[
4
];
box_size
[
0
]
=
atof
(
argv
[
5
]);
box_size
[
1
]
=
atof
(
argv
[
6
]);
box_size
[
2
]
=
atof
(
argv
[
7
]);
global_dim
[
0
]
=
atoi
(
argv
[
8
]);
global_dim
[
1
]
=
atoi
(
argv
[
9
]);
global_dim
[
2
]
=
atoi
(
argv
[
10
]);
sys_size
.
at
(
1
)
=
atof
(
argv
[
5
]);
sys_size
.
at
(
3
)
=
atof
(
argv
[
6
]);
sys_size
.
at
(
5
)
=
atof
(
argv
[
7
]);
max_loop
=
atoi
(
argv
[
2
]);
gamma
=
atof
(
argv
[
3
]);
weighted_points
=
atoi
(
argv
[
4
])
==
1
;
filename
=
argv
[
5
];
box_size
[
0
]
=
atof
(
argv
[
6
]);
box_size
[
1
]
=
atof
(
argv
[
7
]);
box_size
[
2
]
=
atof
(
argv
[
8
]);
global_dim
[
0
]
=
atoi
(
argv
[
9
]);
global_dim
[
1
]
=
atoi
(
argv
[
10
]);
global_dim
[
2
]
=
atoi
(
argv
[
11
]);
sys_size
.
at
(
1
)
=
atof
(
argv
[
6
]);
sys_size
.
at
(
3
)
=
atof
(
argv
[
7
]);
sys_size
.
at
(
5
)
=
atof
(
argv
[
8
]);
}
else
{
...
...
@@ -844,7 +881,7 @@ int main(int argc, char** argv)
// create ALL object
ALL
<
double
,
double
>
lb_obj
(
sys_dim
,
vertices
,
gamma
);
for
(
int
i_loop
=
0
;
i_loop
<
N_LOOP
;
++
i_loop
)
for
(
int
i_loop
=
0
;
i_loop
<
max_loop
;
++
i_loop
)
{
MPI_Barrier
(
cart_comm
);
if
(
local_rank
==
0
)
std
::
cout
<<
"loop "
<<
i_loop
<<
": "
<<
std
::
endl
;
...
...
@@ -1674,12 +1711,12 @@ int main(int argc, char** argv)
#ifdef ALL_VTK_OUTPUT
lb_obj
.
print_vtk_outlines
(
i_loop
/
OUTPUT_INTV
);
lb_obj
.
print_vtk_vertices
(
i_loop
/
OUTPUT_INTV
);
print_points
(
points
,
i_loop
/
OUTPUT_INTV
,
cart_comm
);
print_points
(
points
,
i_loop
/
OUTPUT_INTV
,
chosen_method
,
cart_comm
);
#endif
#ifdef ALL_VORONOI
}
//
else
//
print_points(points,i_loop/OUTPUT_INTV,cart_comm);
else
print_points
(
points
,
i_loop
/
OUTPUT_INTV
,
chosen_method
,
cart_comm
);
#endif
}
...
...
...
...
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
sign in
to comment