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
284653ce
Commit
284653ce
authored
Apr 25, 2017
by
SilverLife
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify gvrid coarse method for performance
parent
d02be56a
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
354 additions
and
65 deletions
+354
-65
Examples/Octree/main.cpp
Examples/Octree/main.cpp
+29
-15
Examples/Octree/main_light.cpp
Examples/Octree/main_light.cpp
+1
-1
Examples/Octree/main_test.cpp
Examples/Octree/main_test.cpp
+35
-9
Examples/Octree/octgrid.cpp
Examples/Octree/octgrid.cpp
+288
-39
Examples/Octree/octgrid.h
Examples/Octree/octgrid.h
+1
-1
No files found.
Examples/Octree/main.cpp
View file @
284653ce
...
...
@@ -119,23 +119,10 @@ void rev_transformation(double xyz[3])
xyz
[
2
]
=
(
tmp
[
2
]
-
4010.0
)
/
10.0
+
0.5
;
}
/// Function provided to octgrid algorithm.
/// Defines that cell should be unite. Returns 1 for unite else returns 0.
int
cell_should_unite
(
struct
grid
*
g
,
Cell
cell
)
{
const
double
r
=
base_radius
;
int
test
=
1
;
double
x
=
cell
.
RealArrayDF
(
g
->
c_tags
.
center
)[
0
];
double
y
=
cell
.
RealArrayDF
(
g
->
c_tags
.
center
)[
1
];
test
&=
(
x
-
mx
)
*
(
x
-
mx
)
+
(
y
-
my
)
*
(
y
-
my
)
>
r
;
return
test
;
}
/// Function provided to octgrid algorithm.
/// Defines that cell should be split. Returns 1 for split else returns 0.
int
cell_should_split
(
struct
grid
*
g
,
Cell
cell
,
int
level
)
int
cell_should_split
(
struct
grid
*
g
,
Cell
cell
)
{
double
r
=
base_radius
;
...
...
@@ -151,7 +138,34 @@ int cell_should_split(struct grid * g, Cell cell, int level)
for
(
int
level
=
2
;
level
<=
refine_depth
;
level
++
)
{
if
((
x
-
mx
)
*
(
x
-
mx
)
+
(
y
-
my
)
*
(
y
-
my
)
<
r
*
5
*
(
level
-
1
))
if
(
c_level
<
refine_depth
-
level
+
1
)
return
1
;
if
(
c_level
<
refine_depth
-
level
+
1
)
{
return
1
;
}
}
return
0
;
}
/// Function provided to octgrid algorithm.
/// Defines that cell should be unite. Returns 1 for unite else returns 0.
int
cell_should_unite
(
struct
grid
*
g
,
Cell
cell
)
{
// return !cell_should_split(g,cell);
const
double
r
=
base_radius
;
double
x
=
cell
.
RealArrayDF
(
g
->
c_tags
.
center
)[
0
];
double
y
=
cell
.
RealArrayDF
(
g
->
c_tags
.
center
)[
1
];
int
c_level
=
cell
.
Integer
(
g
->
c_tags
.
level
);
if
(
c_level
==
refine_depth
)
{
if
((
x
-
mx
)
*
(
x
-
mx
)
+
(
y
-
my
)
*
(
y
-
my
)
>
r
)
return
1
;
}
else
{
double
R
=
(
refine_depth
-
c_level
)
*
5
*
r
;
if
((
x
-
mx
)
*
(
x
-
mx
)
+
(
y
-
my
)
*
(
y
-
my
)
>
R
)
return
1
;
}
return
0
;
}
...
...
Examples/Octree/main_light.cpp
View file @
284653ce
...
...
@@ -96,7 +96,7 @@ int cell_should_unite(struct grid * g, Cell cell)
/// Function provided to octgrid algorithm.
/// Defines that cell should be split. Returns 1 for split else returns 0.
int
cell_should_split
(
struct
grid
*
g
,
Cell
cell
,
int
level
)
int
cell_should_split
(
struct
grid
*
g
,
Cell
cell
)
{
double
r
=
base_radius
;
...
...
Examples/Octree/main_test.cpp
View file @
284653ce
//make all && mpirun -np 1 ./Octree_test -log=3 -l=2 -n=50x50x2
#include "octgrid.h"
#include <math.h>
#include "inmost.h"
...
...
@@ -66,19 +68,28 @@ void pre_redistribute(int type)
/// Defines that cell should be unite. Returns 1 for unite else returns 0.
int
cell_should_unite
(
struct
grid
*
g
,
Cell
cell
)
{
// return !cell_should_split(g,cell);
const
double
r
=
base_radius
;
int
test
=
1
;
double
x
=
cell
.
RealArrayDF
(
g
->
c_tags
.
center
)[
0
];
double
y
=
cell
.
RealArrayDF
(
g
->
c_tags
.
center
)[
1
];
int
c_level
=
cell
.
Integer
(
g
->
c_tags
.
level
);
test
&=
(
x
-
mx
)
*
(
x
-
mx
)
+
(
y
-
my
)
*
(
y
-
my
)
>
r
;
return
test
;
if
(
c_level
==
refine_depth
)
{
if
((
x
-
mx
)
*
(
x
-
mx
)
+
(
y
-
my
)
*
(
y
-
my
)
>
r
)
return
1
;
}
else
{
double
R
=
(
refine_depth
-
c_level
)
*
5
*
r
;
if
((
x
-
mx
)
*
(
x
-
mx
)
+
(
y
-
my
)
*
(
y
-
my
)
>
R
)
return
1
;
}
return
0
;
}
/// Function provided to octgrid algorithm.
/// Defines that cell should be split. Returns 1 for split else returns 0.
int
cell_should_split
(
struct
grid
*
g
,
Cell
cell
,
int
level
)
int
cell_should_split
(
struct
grid
*
g
,
Cell
cell
)
{
double
r
=
base_radius
;
...
...
@@ -290,7 +301,7 @@ void parse_arguments(int argc, char** argv, int* n, double* R, int* L, int* log)
}
}
int
iters_count
=
5
;
int
iters_count
=
6
;
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -325,6 +336,9 @@ int main(int argc, char ** argv)
BARRIER
double
st
=
Timer
();
double
ct
,
tt
;
double
time_amr
,
time_red
;
double
a_amr
=
0
;
double
a_red
=
0
;
for
(
int
iter
=
0
;
iter
<
iters_count
;
iter
++
)
{
BARRIER
...
...
@@ -333,22 +347,34 @@ int main(int argc, char ** argv)
gridAMR
(
&
thegrid
,
0
);
BARRIER
tt
=
Timer
();
if
(
rank
==
0
)
LOG
(
1
,
"AMR time = "
<<
tt
-
ct
)
;
time_amr
=
tt
-
ct
;
ct
=
tt
;
redistribute
(
&
thegrid
,
0
);
BARRIER
tt
=
Timer
();
if
(
rank
==
0
)
LOG
(
1
,
"Red time = "
<<
tt
-
ct
)
;
time_red
=
tt
-
ct
;
ct
=
tt
;
LOG
(
2
,
rank
<<
": iteration "
<<
i
<<
" complete. Cells: "
<<
thegrid
.
mesh
->
NumberOfCells
())
if
(
iter
>
0
)
{
a_amr
+=
time_amr
;
a_red
+=
time_red
;
}
if
(
rank
==
0
)
LOG
(
1
,
"AMR time = "
<<
time_amr
);
if
(
rank
==
0
)
LOG
(
1
,
"Red time = "
<<
time_red
);
dump_to_vtk
(
&
thegrid
);
BARRIER
if
(
rank
==
0
)
LOG
(
1
,
"==============="
);
i
++
;
mx
+=
h
;
}
BARRIER
tt
=
Timer
()
-
tt
;
tt
=
Timer
()
-
st
;
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 RED time = "
<<
a_red
/
(
iters_count
-
1
)
<<
endl
;
if
(
rank
==
0
)
cout
<<
"time = "
<<
tt
<<
endl
;
dump_to_vtk
(
&
thegrid
);
// send_dump_command();
// send_quit_command();
...
...
Examples/Octree/octgrid.cpp
View file @
284653ce
This diff is collapsed.
Click to expand it.
Examples/Octree/octgrid.h
View file @
284653ce
...
...
@@ -58,7 +58,7 @@ struct grid
void
(
*
transformation
)(
double
xyz
[
3
]);
void
(
*
rev_transformation
)(
double
xyz
[
3
]);
int
(
*
cell_should_split
)(
struct
grid
*
g
,
Cell
cell
,
int
level
);
int
(
*
cell_should_split
)(
struct
grid
*
g
,
Cell
cell
);
int
(
*
cell_should_unite
)(
struct
grid
*
g
,
Cell
cell
);
};
...
...
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