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
a3b0eb8a
Commit
a3b0eb8a
authored
Apr 18, 2018
by
Kirill Terekhov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes related to adaptive mesh example
parent
fa8e59dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
135 additions
and
29 deletions
+135
-29
Examples/AdaptiveMesh/amesh.cpp
Examples/AdaptiveMesh/amesh.cpp
+5
-2
Examples/AdaptiveMesh/main.cpp
Examples/AdaptiveMesh/main.cpp
+20
-4
Source/Mesh/geometry.cpp
Source/Mesh/geometry.cpp
+94
-15
Source/Mesh/modify.cpp
Source/Mesh/modify.cpp
+16
-8
No files found.
Examples/AdaptiveMesh/amesh.cpp
View file @
a3b0eb8a
...
...
@@ -326,6 +326,7 @@ namespace INMOST
ReleaseMarker
(
mark_hanging_nodes
);
ReleaseMarker
(
mark_cell_edges
);
DeleteTag
(
internal_face_edges
);
//ExchangeData(hanging_nodes,CELL | FACE,0);
//10.jump to later schedule, and go to 7.
schedule_counter
--
;
}
...
...
@@ -635,12 +636,14 @@ namespace INMOST
}
}
//jump to later schedule
//ExchangeData(hanging_nodes,CELL | FACE,0);
schedule_counter
--
;
}
//free created tag
DeleteTag
(
indicator
,
FACE
|
EDGE
);
//todo:
//ResolveModification();
ResolveShared
(
true
);
ResolveModification
();
//todo:
//let the user update their data
ApplyModification
();
...
...
@@ -666,4 +669,4 @@ namespace INMOST
call_counter
++
;
return
ret
!=
0
;
}
}
\ No newline at end of file
}
Examples/AdaptiveMesh/main.cpp
View file @
a3b0eb8a
...
...
@@ -9,6 +9,7 @@ int main(int argc, char ** argv)
if
(
argc
>
1
)
{
AdaptiveMesh
m
;
m
.
SetCommunicator
(
INMOST_MPI_COMM_WORLD
);
m
.
Load
(
argv
[
1
]);
//m.SetTopologyCheck(NEED_TEST_CLOSURE);
//m.SetTopologyCheck(PROHIBIT_MULTILINE);
...
...
@@ -29,6 +30,8 @@ int main(int argc, char ** argv)
if
(
it
->
Coords
()[
d
]
<
cmin
[
d
]
)
cmin
[
d
]
=
it
->
Coords
()[
d
];
}
}
m
.
AggregateMax
(
cmax
,
3
);
m
.
AggregateMin
(
cmin
,
3
);
r
=
1
;
for
(
int
d
=
0
;
d
<
3
;
++
d
)
{
...
...
@@ -47,18 +50,20 @@ int main(int argc, char ** argv)
numref
=
0
;
for
(
Mesh
::
iteratorCell
it
=
m
.
BeginCell
();
it
!=
m
.
EndCell
();
++
it
)
if
(
m
.
GetLevel
(
it
->
self
())
<
max_levels
)
{
it
->
Centroid
(
xyz
);
it
->
Barycenter
(
xyz
);
//refine a circle
q
=
0
;
for
(
int
d
=
0
;
d
<
3
;
++
d
)
q
+=
(
xyz
[
d
]
-
cnt
[
d
])
*
(
xyz
[
d
]
-
cnt
[
d
]);
q
=
sqrt
(
q
);
if
(
q
<
r
*
(
k
+
1
)
&&
q
>
r
*
k
)
//if( q < 0.02 )
{
indicator
[
it
->
self
()]
=
1
;
numref
++
;
}
}
numref
=
m
.
Integrate
(
numref
);
if
(
numref
)
{
std
::
cout
<<
"k "
<<
k
<<
" refcnt "
<<
refcnt
<<
" "
<<
r
*
k
<<
" < r < "
<<
r
*
(
k
+
1
)
<<
" numref "
<<
numref
<<
" cells "
<<
m
.
NumberOfCells
()
<<
std
::
endl
;
...
...
@@ -89,7 +94,7 @@ int main(int argc, char ** argv)
numref
=
0
;
for
(
Mesh
::
iteratorCell
it
=
m
.
BeginCell
();
it
!=
m
.
EndCell
();
++
it
)
if
(
m
.
GetLevel
(
it
->
self
())
>
0
)
{
it
->
Centroid
(
xyz
);
it
->
Barycenter
(
xyz
);
//refine a circle
q
=
0
;
for
(
int
d
=
0
;
d
<
3
;
++
d
)
...
...
@@ -101,6 +106,7 @@ int main(int argc, char ** argv)
numref
++
;
}
}
numref
=
m
.
Integrate
(
numref
);
if
(
numref
)
{
std
::
cout
<<
"k "
<<
k
<<
" crscnt "
<<
refcnt
<<
" "
<<
r
*
k
<<
" < r < "
<<
r
*
(
k
+
1
)
<<
" numcrs "
<<
numref
<<
" cells "
<<
m
.
NumberOfCells
()
<<
std
::
endl
;
...
...
@@ -131,11 +137,19 @@ int main(int argc, char ** argv)
{
std
::
stringstream
file
;
file
<<
"step_"
<<
k
<<
".vtk"
;
file
<<
"step_"
<<
k
<<
".
p
vtk"
;
m
.
Save
(
file
.
str
());
}
{
TagInteger
tag_owner
=
m
.
CreateTag
(
"OWN"
,
DATA_INTEGER
,
CELL
,
NONE
,
1
);
TagInteger
tag_owner0
=
m
.
GetTag
(
"OWNER_PROCESSOR"
);
TagInteger
tag_stat
=
m
.
CreateTag
(
"STAT"
,
DATA_INTEGER
,
CELL
,
NONE
,
1
);
for
(
Mesh
::
iteratorCell
it
=
m
.
BeginCell
();
it
!=
m
.
EndCell
();
++
it
)
{
tag_owner
[
*
it
]
=
tag_owner0
[
*
it
];
tag_stat
[
*
it
]
=
it
->
GetStatus
();
}
std
::
stringstream
file
;
file
<<
"step_"
<<
k
<<
".pmf"
;
m
.
Save
(
file
.
str
());
...
...
@@ -143,4 +157,6 @@ int main(int argc, char ** argv)
}
}
else
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" mesh_file [max_levels=2]"
<<
std
::
endl
;
}
\ No newline at end of file
Mesh
::
Finalize
();
}
Source/Mesh/geometry.cpp
View file @
a3b0eb8a
...
...
@@ -633,13 +633,32 @@ namespace INMOST
//std::cout << "ORIENTATION" << std::endl;
if
(
mask
&
FACE
)
{
if
(
HideMarker
()
)
{
MarkerType
hm
=
HideMarker
();
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for
(
integer
e
=
0
;
e
<
FaceLastLocalID
();
++
e
)
for
(
integer
e
=
0
;
e
<
FaceLastLocalID
();
++
e
)
{
if
(
isValidElement
(
FACE
,
e
)
)
{
HandleType
h
=
ComposeHandle
(
FACE
,
e
);
if
(
!
GetMarker
(
h
,
hm
)
)
Face
(
this
,
h
)
->
FixNormalOrientation
();
}
}
}
else
{
if
(
isValidElement
(
FACE
,
e
)
)
Face
(
this
,
ComposeHandle
(
FACE
,
e
))
->
FixNormalOrientation
();
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for
(
integer
e
=
0
;
e
<
FaceLastLocalID
();
++
e
)
{
if
(
isValidElement
(
FACE
,
e
)
)
Face
(
this
,
ComposeHandle
(
FACE
,
e
))
->
FixNormalOrientation
();
}
}
}
ShowGeometricData
(
ORIENTATION
,
FACE
);
...
...
@@ -652,13 +671,28 @@ namespace INMOST
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
MEASURE
,
etype
))
{
measure_tag
=
CreateTag
(
measure_name
,
DATA_REAL
,
etype
,
NONE
,
1
);
if
(
HideMarker
()
)
{
MarkerType
hm
=
HideMarker
();
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for
(
integer
e
=
0
;
e
<
LastLocalID
(
etype
);
++
e
)
if
(
isValidElement
(
etype
,
e
)
)
for
(
integer
e
=
0
;
e
<
LastLocalID
(
etype
);
++
e
)
if
(
isValidElement
(
etype
,
e
)
)
{
HandleType
h
=
ComposeHandle
(
etype
,
e
);
if
(
!
GetMarker
(
h
,
hm
)
)
GetGeometricData
(
h
,
MEASURE
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
measure_tag
)));
}
}
else
{
HandleType
h
=
ComposeHandle
(
etype
,
e
);
GetGeometricData
(
h
,
MEASURE
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
measure_tag
)));
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for
(
integer
e
=
0
;
e
<
LastLocalID
(
etype
);
++
e
)
if
(
isValidElement
(
etype
,
e
)
)
{
HandleType
h
=
ComposeHandle
(
etype
,
e
);
GetGeometricData
(
h
,
MEASURE
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
measure_tag
)));
}
}
ShowGeometricData
(
MEASURE
,
etype
);
}
...
...
@@ -672,13 +706,28 @@ namespace INMOST
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
CENTROID
,
etype
))
{
centroid_tag
=
CreateTag
(
centroid_name
,
DATA_REAL
,
etype
,
NONE
,
GetDimensions
());
if
(
HideMarker
()
)
{
MarkerType
hm
=
HideMarker
();
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for
(
integer
k
=
0
;
k
<
LastLocalID
(
etype
);
++
k
)
if
(
isValidElement
(
etype
,
k
)
)
for
(
integer
k
=
0
;
k
<
LastLocalID
(
etype
);
++
k
)
if
(
isValidElement
(
etype
,
k
)
)
{
HandleType
h
=
ComposeHandle
(
etype
,
k
);
if
(
!
GetMarker
(
h
,
hm
)
)
GetGeometricData
(
h
,
CENTROID
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
centroid_tag
)));
}
}
else
{
HandleType
h
=
ComposeHandle
(
etype
,
k
);
GetGeometricData
(
h
,
CENTROID
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
centroid_tag
)));
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for
(
integer
k
=
0
;
k
<
LastLocalID
(
etype
);
++
k
)
if
(
isValidElement
(
etype
,
k
)
)
{
HandleType
h
=
ComposeHandle
(
etype
,
k
);
GetGeometricData
(
h
,
CENTROID
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
centroid_tag
)));
}
}
ShowGeometricData
(
CENTROID
,
etype
);
}
...
...
@@ -692,13 +741,28 @@ namespace INMOST
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
BARYCENTER
,
etype
))
{
barycenter_tag
=
CreateTag
(
barycenter_name
,
DATA_REAL
,
etype
,
NONE
,
GetDimensions
());
if
(
HideMarker
()
)
{
MarkerType
hm
=
HideMarker
();
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for
(
integer
e
=
0
;
e
<
LastLocalID
(
etype
);
++
e
)
if
(
isValidElement
(
etype
,
e
)
)
for
(
integer
e
=
0
;
e
<
LastLocalID
(
etype
);
++
e
)
if
(
isValidElement
(
etype
,
e
)
)
{
HandleType
h
=
ComposeHandle
(
etype
,
e
);
if
(
!
GetMarker
(
h
,
hm
)
)
GetGeometricData
(
h
,
BARYCENTER
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
barycenter_tag
)));
}
}
else
{
HandleType
h
=
ComposeHandle
(
etype
,
e
);
GetGeometricData
(
h
,
BARYCENTER
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
barycenter_tag
)));
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for
(
integer
e
=
0
;
e
<
LastLocalID
(
etype
);
++
e
)
if
(
isValidElement
(
etype
,
e
)
)
{
HandleType
h
=
ComposeHandle
(
etype
,
e
);
GetGeometricData
(
h
,
BARYCENTER
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
barycenter_tag
)));
}
}
ShowGeometricData
(
BARYCENTER
,
etype
);
}
...
...
@@ -712,13 +776,28 @@ namespace INMOST
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
NORMAL
,
etype
))
{
normal_tag
=
CreateTag
(
normal_name
,
DATA_REAL
,
etype
,
NONE
,
GetDimensions
());
if
(
HideMarker
()
)
{
MarkerType
hm
=
HideMarker
();
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for
(
integer
e
=
0
;
e
<
LastLocalID
(
etype
);
++
e
)
if
(
isValidElement
(
etype
,
e
)
)
for
(
integer
e
=
0
;
e
<
LastLocalID
(
etype
);
++
e
)
if
(
isValidElement
(
etype
,
e
)
)
{
HandleType
h
=
ComposeHandle
(
etype
,
e
);
if
(
!
GetMarker
(
h
,
hm
)
)
GetGeometricData
(
h
,
NORMAL
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
normal_tag
)));
}
}
else
{
HandleType
h
=
ComposeHandle
(
etype
,
e
);
GetGeometricData
(
h
,
NORMAL
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
normal_tag
)));
#if defined(USE_OMP)
#pragma omp parallel for
#endif
for
(
integer
e
=
0
;
e
<
LastLocalID
(
etype
);
++
e
)
if
(
isValidElement
(
etype
,
e
)
)
{
HandleType
h
=
ComposeHandle
(
etype
,
e
);
GetGeometricData
(
h
,
NORMAL
,
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
normal_tag
)));
}
}
ShowGeometricData
(
NORMAL
,
etype
);
}
...
...
Source/Mesh/modify.cpp
View file @
a3b0eb8a
...
...
@@ -1628,17 +1628,16 @@ namespace INMOST
Tag
tag
=
CreateTag
(
"TEMP_DISTANSE"
,
DATA_REAL
,
CELL
,
CELL
,
2
);
for
(
Mesh
::
iteratorCell
it
=
BeginCell
();
it
!=
EndCell
();
it
++
)
if
(
GetMarker
(
*
it
,
NewMarker
()))
for
(
Mesh
::
iteratorCell
it
=
BeginCell
();
it
!=
EndCell
();
it
++
)
if
(
GetMarker
(
*
it
,
NewMarker
())
&&
(
it
->
GetStatus
()
==
Element
::
Ghost
||
it
->
GetStatus
()
==
Element
::
Shared
)
)
{
double
min
=
0
;
int
first
=
0
;
double
mind
=
1.0e+100
;
Cell
near_cell
;
for
(
Mesh
::
iteratorCell
jt
=
BeginCell
();
jt
!=
EndCell
();
jt
++
)
if
(
GetMarker
(
*
jt
,
NewMarker
())
==
false
)
for
(
Mesh
::
iteratorCell
jt
=
BeginCell
();
jt
!=
EndCell
();
jt
++
)
if
(
GetMarker
(
*
jt
,
NewMarker
())
==
false
&&
jt
->
GetStatus
()
==
Element
::
Owned
)
{
double
d
=
dist
(
it
->
getAsCell
(),
jt
->
getAsCell
());
if
(
first
++
==
0
||
min
>
d
)
if
(
mind
>
d
)
{
min
=
d
;
min
d
=
d
;
near_cell
=
jt
->
getAsCell
();
}
}
...
...
@@ -1647,13 +1646,13 @@ namespace INMOST
int
owner2
=
near_cell
.
IntegerDF
(
tag_owner
);
it
->
RealArray
(
tag
)[
0
]
=
owner2
;
it
->
RealArray
(
tag
)[
1
]
=
min
;
it
->
RealArray
(
tag
)[
1
]
=
min
d
;
}
ReduceData
(
tag
,
CELL
,
0
,
OperationMinDistance
);
ExchangeData
(
tag
,
CELL
,
0
);
for
(
Mesh
::
iteratorCell
it
=
BeginCell
();
it
!=
EndCell
();
it
++
)
if
(
GetMarker
(
*
it
,
NewMarker
()))
for
(
Mesh
::
iteratorCell
it
=
BeginCell
();
it
!=
EndCell
();
it
++
)
if
(
GetMarker
(
*
it
,
NewMarker
())
&&
(
it
->
GetStatus
()
==
Element
::
Ghost
||
it
->
GetStatus
()
==
Element
::
Shared
)
)
{
int
new_owner
=
(
int
)
it
->
RealArray
(
tag
)[
0
];
...
...
@@ -1685,6 +1684,15 @@ namespace INMOST
Destroy
(
h
);
}
}
for
(
ElementType
etype
=
FACE
;
etype
>=
NODE
;
etype
=
PrevElementType
(
etype
))
{
for
(
integer
it
=
0
;
it
<
LastLocalID
(
etype
);
++
it
)
if
(
isValidElement
(
etype
,
it
)
)
{
if
(
ElementByLocalID
(
etype
,
it
).
nbAdjElements
(
NextElementType
(
etype
))
==
0
)
Destroy
(
ComposeHandle
(
etype
,
it
));
}
}
RecomputeParallelStorage
(
ESET
|
CELL
|
FACE
|
EDGE
|
NODE
);
memset
(
hidden_count
,
0
,
sizeof
(
integer
)
*
6
);
memset
(
hidden_count_zero
,
0
,
sizeof
(
integer
)
*
6
);
ReleaseMarker
(
hide_element
);
...
...
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