Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
INMOST
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Terekhov
INMOST
Commits
714094eb
Commit
714094eb
authored
May 15, 2017
by
SilverLife
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chenge octree test
parent
b570bd6a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
21 deletions
+36
-21
Examples/Octree/main_test.cpp
Examples/Octree/main_test.cpp
+28
-16
Examples/Octree/octgrid.cpp
Examples/Octree/octgrid.cpp
+7
-4
Examples/Octree/octgrid.h
Examples/Octree/octgrid.h
+1
-1
No files found.
Examples/Octree/main_test.cpp
View file @
714094eb
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include "inmost.h"
#include "inmost.h"
#include <iomanip>
#include <iomanip>
#include <iostream>
#include <iostream>
#include <sstream>
#define LOG(level,msg) { if (log_level >= level) cout << msg << endl; }
#define LOG(level,msg) { if (log_level >= level) cout << msg << endl; }
#define BARRIER MPI_Barrier(MPI_COMM_WORLD);
#define BARRIER MPI_Barrier(MPI_COMM_WORLD);
...
@@ -145,7 +146,7 @@ void NotMainProcess()
...
@@ -145,7 +146,7 @@ void NotMainProcess()
int
type
=
type_C
-
'0'
;
int
type
=
type_C
-
'0'
;
//redistribute(&thegrid,type);
//redistribute(&thegrid,type);
pre_redistribute
(
type
);
pre_redistribute
(
type
);
cout
<<
rank
<<
": iteration "
<<
iteration
++
<<
" complete. Cells: "
<<
thegrid
.
mesh
->
NumberOfCells
()
<<
endl
;
cout
<<
::
rank
<<
": iteration "
<<
iteration
++
<<
" complete. Cells: "
<<
thegrid
.
mesh
->
NumberOfCells
()
<<
endl
;
}
}
if
(
buff
[
0
]
==
'u'
)
// Need remove ghosts
if
(
buff
[
0
]
==
'u'
)
// Need remove ghosts
{
{
...
@@ -301,7 +302,6 @@ void parse_arguments(int argc, char** argv, int* n, double* R, int* L, int* log)
...
@@ -301,7 +302,6 @@ void parse_arguments(int argc, char** argv, int* n, double* R, int* L, int* log)
}
}
}
}
int
iters_count
=
6
;
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
...
@@ -325,13 +325,17 @@ int main(int argc, char ** argv)
...
@@ -325,13 +325,17 @@ int main(int argc, char ** argv)
::
size
=
thegrid
.
mesh
->
GetProcessorsNumber
();
::
size
=
thegrid
.
mesh
->
GetProcessorsNumber
();
::
rank
=
thegrid
.
mesh
->
GetProcessorRank
();
::
rank
=
thegrid
.
mesh
->
GetProcessorRank
();
//dump_to_vtk();
//dump_to_vtk();
if
(
rank
==
0
)
cout
<<
"Test start"
<<
endl
;
if
(
::
rank
==
0
)
cout
<<
"Test start"
<<
endl
;
{
{
mx
=
0.1
;
mx
=
0.1
;
my
=
0.5
;
my
=
0.5
;
double
h
=
0.8
/
iters_count
;
int
iters_count
=
10
;
// double h = 0.8 / iters_count;
// double h = 0.03;
double
h
=
0.05
;
int
i
=
0
;
int
i
=
0
;
BARRIER
BARRIER
double
st
=
Timer
();
double
st
=
Timer
();
...
@@ -339,11 +343,12 @@ int main(int argc, char ** argv)
...
@@ -339,11 +343,12 @@ int main(int argc, char ** argv)
double
time_amr
,
time_red
;
double
time_amr
,
time_red
;
double
a_amr
=
0
;
double
a_amr
=
0
;
double
a_red
=
0
;
double
a_red
=
0
;
bool
forward
=
true
;
for
(
int
iter
=
0
;
iter
<
iters_count
;
iter
++
)
for
(
int
iter
=
0
;
iter
<
iters_count
;
iter
++
)
{
{
BARRIER
BARRIER
ct
=
Timer
();
ct
=
Timer
();
if
(
rank
==
0
)
LOG
(
1
,
"Iteration: "
<<
i
)
if
(
::
rank
==
0
)
LOG
(
1
,
"Iteration: "
<<
i
)
gridAMR
(
&
thegrid
,
0
);
gridAMR
(
&
thegrid
,
0
);
BARRIER
BARRIER
tt
=
Timer
();
tt
=
Timer
();
...
@@ -354,30 +359,37 @@ int main(int argc, char ** argv)
...
@@ -354,30 +359,37 @@ int main(int argc, char ** argv)
tt
=
Timer
();
tt
=
Timer
();
time_red
=
tt
-
ct
;
time_red
=
tt
-
ct
;
ct
=
tt
;
ct
=
tt
;
LOG
(
2
,
rank
<<
": iteration "
<<
i
<<
" complete. Cells: "
<<
thegrid
.
mesh
->
NumberOfCells
())
LOG
(
2
,
::
rank
<<
": iteration "
<<
i
<<
" complete. Cells: "
<<
thegrid
.
mesh
->
NumberOfCells
())
if
(
iter
>
0
)
if
(
iter
>
0
)
{
{
a_amr
+=
time_amr
;
a_amr
+=
time_amr
;
a_red
+=
time_red
;
a_red
+=
time_red
;
}
}
if
(
rank
==
0
)
LOG
(
1
,
"AMR time = "
<<
time_amr
);
if
(
::
rank
==
0
)
LOG
(
1
,
"AMR time = "
<<
time_amr
);
if
(
rank
==
0
)
LOG
(
1
,
"Red time = "
<<
time_red
);
if
(
::
rank
==
0
)
LOG
(
1
,
"Red time = "
<<
time_red
);
dump_to_vtk
(
&
thegrid
);
// stringstream suffix;
// suffix << "_" << iter;
BARRIER
BARRIER
if
(
rank
==
0
)
LOG
(
1
,
"==============="
);
if
(
::
rank
==
0
)
LOG
(
1
,
"==============="
);
i
++
;
i
++
;
if
(
forward
)
{
mx
+=
h
;
mx
+=
h
;
if
(
mx
>=
0.9
)
forward
=
false
;
}
else
{
mx
-=
h
;
if
(
mx
<=
0.1
)
forward
=
true
;
}
}
}
BARRIER
BARRIER
tt
=
Timer
()
-
st
;
tt
=
Timer
()
-
st
;
if
(
rank
==
0
)
cout
<<
"time = "
<<
tt
<<
endl
;
if
(
::
rank
==
0
)
cout
<<
"time = "
<<
tt
<<
endl
;
if
(
rank
==
0
)
cout
<<
"Average AMR time = "
<<
a_amr
/
(
iters_count
-
1
)
<<
endl
;
if
(
::
rank
==
0
)
cout
<<
"Average AMR time = "
<<
a_amr
/
(
iters_count
-
1
)
<<
endl
;
if
(
rank
==
0
)
cout
<<
"Average RED time = "
<<
a_red
/
(
iters_count
-
1
)
<<
endl
;
if
(
::
rank
==
0
)
cout
<<
"Average RED time = "
<<
a_red
/
(
iters_count
-
1
)
<<
endl
;
if
(
rank
==
0
)
cout
<<
"time = "
<<
tt
<<
endl
;
if
(
::
rank
==
0
)
cout
<<
"time = "
<<
tt
<<
endl
;
dump_to_vtk
(
&
thegrid
);
// send_dump_command();
// send_dump_command();
// send_quit_command();
// send_quit_command();
}
}
Mesh
::
Finalize
();
Mesh
::
Finalize
();
...
...
Examples/Octree/octgrid.cpp
View file @
714094eb
...
@@ -117,7 +117,7 @@ class CR_cells
...
@@ -117,7 +117,7 @@ class CR_cells
CR_cells
cr_cells
;
CR_cells
cr_cells
;
/// Dump mesh to vtk file in folder "grids"
/// Dump mesh to vtk file in folder "grids"
void
dump_to_vtk
(
grid
*
g
)
void
dump_to_vtk
(
grid
*
g
,
const
char
*
suffix
)
{
{
//thegrid.mesh->ResolveShared(); // Resolve duplicate nodes
//thegrid.mesh->ResolveShared(); // Resolve duplicate nodes
//thegrid.mesh->ExchangeGhost(2,NODE); // Construct Ghost cells in 2 layers connected via nodes
//thegrid.mesh->ExchangeGhost(2,NODE); // Construct Ghost cells in 2 layers connected via nodes
...
@@ -127,12 +127,13 @@ void dump_to_vtk(grid* g)
...
@@ -127,12 +127,13 @@ void dump_to_vtk(grid* g)
std
::
stringstream
filename
;
std
::
stringstream
filename
;
filename
<<
"grids/grid_"
;
filename
<<
"grids/grid_"
;
filename
<<
size
;
filename
<<
size
;
filename
<<
suffix
;
if
(
size
==
1
)
if
(
size
==
1
)
filename
<<
".vtk"
;
filename
<<
".vtk"
;
else
else
filename
<<
".pvtk"
;
filename
<<
".pvtk"
;
g
->
mesh
->
Save
(
filename
.
str
());
g
->
mesh
->
Save
(
filename
.
str
());
cout
<<
"Process "
<<
rank
<<
": dumped mesh to file
"
<<
endl
;
cout
<<
"Process "
<<
rank
<<
": dumped mesh to file
: "
<<
filename
.
str
()
<<
endl
;
}
}
...
@@ -1591,8 +1592,8 @@ void gridCoarse(struct grid * g)
...
@@ -1591,8 +1592,8 @@ void gridCoarse(struct grid * g)
// else
// else
// it->Integer(g->c_tags.i) = -1;
// it->Integer(g->c_tags.i) = -1;
}
}
cr_cells
.
print_size
();
//
cr_cells.print_size();
cout
<<
"N time: "
<<
Timer
()
-
tt
<<
endl
;
//
cout << "N time: " << Timer() - tt << endl;
if
(
empty
)
if
(
empty
)
{
{
cr_cells
.
push
(
g
->
mesh
->
BeginCell
()
->
getAsCell
());
cr_cells
.
push
(
g
->
mesh
->
BeginCell
()
->
getAsCell
());
...
@@ -1628,10 +1629,12 @@ void gridCoarse(struct grid * g)
...
@@ -1628,10 +1629,12 @@ void gridCoarse(struct grid * g)
}
}
*/
*/
time_p
+=
Timer
()
-
ttt
;
time_p
+=
Timer
()
-
ttt
;
/*
cout << "Time Prep: " << time_p << endl;
cout << "Time Prep: " << time_p << endl;
cout << "Time Unit: " << time_u << endl;
cout << "Time Unit: " << time_u << endl;
cout << "Time Res1: " << time_r1 << endl;
cout << "Time Res1: " << time_r1 << endl;
cout << "Time Res2: " << time_r2 << endl;
cout << "Time Res2: " << time_r2 << endl;
*/
/*
/*
while (1)
while (1)
{
{
...
...
Examples/Octree/octgrid.h
View file @
714094eb
...
@@ -78,7 +78,7 @@ void print_face_nodes(struct grid* g, Face face);
...
@@ -78,7 +78,7 @@ void print_face_nodes(struct grid* g, Face face);
void
print_face_edges
(
struct
grid
*
g
,
Face
face
);
void
print_face_edges
(
struct
grid
*
g
,
Face
face
);
void
print_cells_statistics
(
grid
*
g
);
void
print_cells_statistics
(
grid
*
g
);
void
command
(
grid
*
g
);
void
command
(
grid
*
g
);
void
dump_to_vtk
(
grid
*
g
);
void
dump_to_vtk
(
grid
*
g
,
const
char
*
suffix
=
""
);
void
redistribute
(
grid
*
g
,
int
type
);
void
redistribute
(
grid
*
g
,
int
type
);
void
print_redist_tag
(
struct
grid
*
g
,
int
rank
);
void
print_redist_tag
(
struct
grid
*
g
,
int
rank
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment