Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kirill Terekhov
INMOST
Commits
1fd9859b
Commit
1fd9859b
authored
Apr 14, 2017
by
Kirill Terekhov
Browse files
Refinement tools for MFD-ES
Refinement into cube and sphere in AdaptiveMesh for specific tests with MFD-ES
parent
4457ab38
Changes
3
Hide whitespace changes
Inline
Side-by-side
Examples/AdaptiveMesh/CMakeLists.txt
View file @
1fd9859b
project
(
AdaptiveMesh
)
set
(
LIBSOURCE amesh.cpp amesh.h
)
set
(
SOURCE main.cpp
)
add_library
(
AdaptiveMeshLib
${
LIBSOURCE
}
)
add_executable
(
AdaptiveMesh
${
SOURCE
}
)
add_library
(
AdaptiveMeshLib amesh.cpp amesh.h
)
add_executable
(
AdaptiveMesh main.cpp
)
add_executable
(
AdaptiveMeshCube main_cube.cpp
)
add_executable
(
AdaptiveMeshSphere main_sphere.cpp
)
target_link_libraries
(
AdaptiveMesh inmost AdaptiveMeshLib
)
target_link_libraries
(
AdaptiveMeshCube inmost AdaptiveMeshLib
)
target_link_libraries
(
AdaptiveMeshSphere inmost AdaptiveMeshLib
)
if
(
USE_MPI
)
message
(
"linking AdaptiveMesh with MPI"
)
target_link_libraries
(
AdaptiveMesh
${
MPI_LIBRARIES
}
)
target_link_libraries
(
AdaptiveMeshCube
${
MPI_LIBRARIES
}
)
target_link_libraries
(
AdaptiveMeshSphere
${
MPI_LIBRARIES
}
)
if
(
MPI_LINK_FLAGS
)
set_target_properties
(
AdaptiveMesh PROPERTIES LINK_FLAGS
"
${
MPI_LINK_FLAGS
}
"
)
set_target_properties
(
AdaptiveMeshCube PROPERTIES LINK_FLAGS
"
${
MPI_LINK_FLAGS
}
"
)
set_target_properties
(
AdaptiveMeshSphere PROPERTIES LINK_FLAGS
"
${
MPI_LINK_FLAGS
}
"
)
endif
()
endif
(
USE_MPI
)
...
...
@@ -22,4 +28,6 @@ install(TARGETS AdaptiveMeshLib EXPORT inmost-targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include
)
install
(
TARGETS AdaptiveMesh EXPORT inmost-targets RUNTIME DESTINATION bin
)
\ No newline at end of file
install
(
TARGETS AdaptiveMesh EXPORT inmost-targets RUNTIME DESTINATION bin
)
install
(
TARGETS AdaptiveMeshCube EXPORT inmost-targets RUNTIME DESTINATION bin
)
install
(
TARGETS AdaptiveMeshSphere EXPORT inmost-targets RUNTIME DESTINATION bin
)
\ No newline at end of file
Examples/AdaptiveMesh/main_cube.cpp
0 → 100644
View file @
1fd9859b
#include "amesh.h"
using
namespace
INMOST
;
int
main
(
int
argc
,
char
**
argv
)
{
Mesh
::
Initialize
(
&
argc
,
&
argv
);
if
(
argc
>
1
)
{
AdaptiveMesh
m
;
m
.
Load
(
argv
[
1
]);
TagInteger
indicator
=
m
.
CreateTag
(
"INDICATOR"
,
DATA_INTEGER
,
CELL
,
NONE
,
1
);
int
max_levels
=
2
;
if
(
argc
>
2
)
max_levels
=
atoi
(
argv
[
2
]);
int
numref
;
do
{
numref
=
0
;
for
(
Mesh
::
iteratorCell
it
=
m
.
BeginCell
();
it
!=
m
.
EndCell
();
++
it
)
if
(
m
.
GetLevel
(
it
->
self
())
<
max_levels
)
{
double
x
[
3
];
it
->
Centroid
(
x
);
if
(
x
[
0
]
>
0.3
&&
x
[
0
]
<
0.7
&&
x
[
1
]
>
0.3
&&
x
[
1
]
<
0.7
&&
x
[
2
]
>
0.3
&&
x
[
2
]
<
0.7
)
{
indicator
[
it
->
self
()]
=
1
;
numref
++
;
}
}
if
(
numref
)
{
if
(
!
m
.
Refine
(
indicator
)
)
break
;
for
(
Mesh
::
iteratorCell
it
=
m
.
BeginCell
();
it
!=
m
.
EndCell
();
++
it
)
indicator
[
it
->
self
()]
=
0
;
}
}
while
(
numref
);
std
::
string
file
=
"out.vtk"
;
if
(
argc
>
3
)
file
=
std
::
string
(
argv
[
3
]);
m
.
Save
(
file
);
}
else
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" mesh_file [max_levels=2] [mesh_out=out.vtk]"
<<
std
::
endl
;
}
\ No newline at end of file
Examples/AdaptiveMesh/main_sphere.cpp
0 → 100644
View file @
1fd9859b
#include "amesh.h"
using
namespace
INMOST
;
int
main
(
int
argc
,
char
**
argv
)
{
Mesh
::
Initialize
(
&
argc
,
&
argv
);
if
(
argc
>
1
)
{
AdaptiveMesh
m
;
m
.
Load
(
argv
[
1
]);
TagInteger
indicator
=
m
.
CreateTag
(
"INDICATOR"
,
DATA_INTEGER
,
CELL
,
NONE
,
1
);
int
max_levels
=
2
;
if
(
argc
>
2
)
max_levels
=
atoi
(
argv
[
2
]);
int
numref
;
do
{
numref
=
0
;
for
(
Mesh
::
iteratorCell
it
=
m
.
BeginCell
();
it
!=
m
.
EndCell
();
++
it
)
if
(
m
.
GetLevel
(
it
->
self
())
<
max_levels
)
{
double
x
[
3
];
it
->
Centroid
(
x
);
if
(
sqrt
((
x
[
0
]
-
0.5
)
*
(
x
[
0
]
-
0.5
)
+
(
x
[
1
]
-
0.5
)
*
(
x
[
1
]
-
0.5
)
+
(
x
[
2
]
-
0.5
)
*
(
x
[
2
]
-
0.5
))
<
0.25
)
{
indicator
[
it
->
self
()]
=
1
;
numref
++
;
}
}
if
(
numref
)
{
if
(
!
m
.
Refine
(
indicator
)
)
break
;
for
(
Mesh
::
iteratorCell
it
=
m
.
BeginCell
();
it
!=
m
.
EndCell
();
++
it
)
indicator
[
it
->
self
()]
=
0
;
}
}
while
(
numref
);
std
::
string
file
=
"out.vtk"
;
if
(
argc
>
3
)
file
=
std
::
string
(
argv
[
3
]);
m
.
Save
(
file
);
}
else
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" mesh_file [max_levels=2] [mesh_out=out.vtk]"
<<
std
::
endl
;
}
\ No newline at end of file
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