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
96a9a0ad
Commit
96a9a0ad
authored
Apr 11, 2019
by
Kirill Terekhov
Browse files
Some fixes and updates
parent
367fc060
Changes
4
Hide whitespace changes
Inline
Side-by-side
Examples/AdaptiveMesh/amesh.cpp
View file @
96a9a0ad
...
...
@@ -674,9 +674,28 @@ namespace INMOST
//11. Restore parallel connectivity, global ids
{
std
::
fstream
fout
;
fout
.
open
(
"out"
+
std
::
to_string
(
m
->
GetProcessorRank
())
+
".txt"
,
std
::
ios
::
out
);
for
(
ElementType
etype
=
NODE
;
etype
<=
ESET
;
etype
=
NextElementType
(
etype
)
)
{
int
cnt
=
0
;
for
(
Mesh
::
iteratorElement
it
=
m
->
BeginElement
(
etype
);
it
!=
m
->
EndElement
();
++
it
)
{
if
(
it
->
New
()
)
{
fout
<<
"new element "
<<
ElementTypeName
(
etype
)
<<
":"
<<
it
->
LocalID
()
<<
std
::
endl
;
//<< " gid " << it->GlobalID() << std::endl;
cnt
++
;
}
}
fout
<<
ElementTypeName
(
etype
)
<<
" count: "
<<
cnt
<<
std
::
endl
;
}
fout
.
close
();
}
//if (call_counter == 0)
m
->
ResolveModification
();
//m->SynchronizeMarker(m->NewMarker(),CELL|FACE|EDGE|NODE,SYNC_BIT_OR);
//ExchangeGhost(3,NODE); // Construct Ghost cells in 2 layers connected via nodes
//12. Let the user update their data
//todo: call back function for New() cells
...
...
@@ -684,10 +703,12 @@ namespace INMOST
//13. Delete old elements of the mesh
m
->
ApplyModification
();
m
->
ExchangeGhost
(
1
,
NODE
,
m
->
NewMarker
());
//
m->ExchangeGhost(1,NODE,m->NewMarker());
//14. Done
//cout << rank << ": Before end " << std::endl;
m
->
EndModification
();
//ExchangeData(hanging_nodes,CELL | FACE,0);
//m->ResolveSets();
...
...
@@ -699,6 +720,7 @@ namespace INMOST
//m->ApplyModification();
//m->EndModification();
//PrintSet();
m
->
ExchangeData
(
hanging_nodes
,
CELL
|
FACE
,
0
);
m
->
ExchangeData
(
parent_set
,
CELL
,
0
);
//restore face orientation
...
...
@@ -788,7 +810,7 @@ namespace INMOST
{
std
::
cout
<<
rank
<<
" enter "
<<
__FUNCTION__
<<
std
::
endl
;
SynchronizeIndicated
(
indicator
);
return
false
;
//
return false;
static
int
call_counter
=
0
;
//return number of coarsened cells
...
...
@@ -1106,7 +1128,6 @@ namespace INMOST
m
->
CheckCentroids
();
//CheckCentroids();
//ExchangeData(hanging_nodes,CELL | FACE,0);
//cleanup null links to hanging nodes
for
(
ElementType
etype
=
FACE
;
etype
<=
CELL
;
etype
=
NextElementType
(
etype
))
{
...
...
@@ -1119,6 +1140,8 @@ namespace INMOST
arr
.
resize
(
jt
);
}
}
m
->
ExchangeData
(
hanging_nodes
,
CELL
|
FACE
,
0
);
m
->
ExchangeData
(
parent_set
,
CELL
,
0
);
//cleanup null links in sets
CleanupSets
(
root
);
...
...
Examples/AdaptiveMesh/main.cpp
View file @
96a9a0ad
...
...
@@ -26,7 +26,8 @@ int main(int argc, char ** argv)
m
.
ReorderEmpty
(
CELL
|
FACE
|
EDGE
|
NODE
);
std
::
cout
<<
"after on "
<<
m
.
GetProcessorRank
()
<<
" "
<<
m
.
NumberOfCells
()
<<
std
::
endl
;
}
#endif
#endif
m
.
ExchangeGhost
(
2
,
NODE
);
AdaptiveMesh
am
(
m
);
//m.SetTopologyCheck(NEED_TEST_CLOSURE);
//m.SetTopologyCheck(PROHIBIT_MULTILINE);
...
...
@@ -99,7 +100,7 @@ int main(int argc, char ** argv)
int
res
=
am
.
Refine
(
indicator
);
res
=
m
.
Integrate
(
res
);
if
(
!
res
)
break
;
/*
{
std::stringstream file;
file << "ref_" << k << "_" << refcnt << ".pvtk";
...
...
@@ -107,6 +108,7 @@ int main(int argc, char ** argv)
if( m.GetProcessorRank() == 0 )
std::cout << "Save " << file.str() << std::endl;
}
*/
}
refcnt
++
;
}
...
...
Source/Mesh/mesh.cpp
View file @
96a9a0ad
...
...
@@ -198,7 +198,7 @@ namespace INMOST
out_time
.
open
(
temp
.
str
().
c_str
(),
std
::
ios
::
out
);
out_time
<<
"<?xml version=
\"
1.0
\"
encoding=
\"
ISO-8859-1
\"
?>"
<<
std
::
endl
;
out_time
<<
"<?xml-stylesheet type=
\"
text/xsl
\"
href=
\"
style.xsl
\"
?>"
<<
std
::
endl
;
out_time
<<
"<Debug ProcessID="
<<
PROCESSID
<<
">"
<<
std
::
endl
;
out_time
<<
"<Debug ProcessID=
\"
"
<<
PROCESSID
<<
"
\
"
>"
<<
std
::
endl
;
tab
=
1
;
func_id
=
0
;
#endif
...
...
Source/Mesh/parallel.cpp
View file @
96a9a0ad
...
...
@@ -1427,7 +1427,7 @@ namespace INMOST
{
Element
it
=
ElementByLocalID
(
current_mask
,
eit
);
if
(
it
->
GetMarker
(
hm
)
)
continue
;
if
(
only_new
&&
it
->
GetMarker
(
new_lc
))
continue
;
if
(
only_new
&&
!
it
->
GetMarker
(
new_lc
))
continue
;
...
...
@@ -1523,7 +1523,7 @@ namespace INMOST
message_send
.
push_back
(
0
);
for
(
Mesh
::
iteratorElement
it
=
BeginElement
(
current_mask
);
it
!=
EndElement
();
it
++
)
{
if
(
only_new
&&
it
->
GetMarker
(
new_lc
))
continue
;
if
(
only_new
&&
!
it
->
GetMarker
(
new_lc
))
continue
;
Storage
::
integer_array
pr
=
it
->
IntegerArrayDV
(
tag_processors
);
if
(
std
::
binary_search
(
pr
.
begin
(),
pr
.
end
(),
*
p
)
)
{
...
...
@@ -2518,6 +2518,7 @@ namespace INMOST
MPI_Pack
(
&
data_send
,
1
,
INMOST_MPI_DATA_ENUM_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
if
(
!
array_size_send
.
empty
()
)
MPI_Pack
(
&
array_size_send
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
array_size_send
.
size
()),
INMOST_MPI_DATA_ENUM_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
if
(
!
array_data_send
.
empty
()
)
MPI_Pack
(
&
array_data_send
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
array_data_send
.
size
()
/
bytes
),
tag
.
GetBulkDataType
(),
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
buffer
.
resize
(
position
);
if
(
tag
.
GetDataType
()
==
DATA_REFERENCE
)
{
std
::
vector
<
std
::
string
>
tag_list
;
...
...
@@ -2537,7 +2538,6 @@ namespace INMOST
}
PackElementsData
(
pack_elements
,
buffer
,
destination
,
tag_list
);
}
buffer
.
resize
(
position
);
REPORT_VAL
(
"Buffer size after pack"
,
buffer
.
size
());
if
(
size_send
<
6
)
{
...
...
@@ -2677,6 +2677,8 @@ namespace INMOST
REPORT_STR
(
"variable size"
);
for
(
unsigned
j
=
0
;
j
<
count
;
j
++
)
{
assert
(
k
<
array_size_recv
.
size
()
);
assert
(
array_size_recv
[
k
]
<
elements
[
i
].
size
()
);
eit
=
elements
[
i
].
begin
()
+
array_size_recv
[
k
++
];
assert
(
!
select
||
GetMarker
(
*
eit
,
select
)
);
//if fires then very likely that marker was not synchronized
if
(
tag
.
GetDataType
()
==
DATA_REFERENCE
)
...
...
@@ -2687,8 +2689,11 @@ namespace INMOST
if
(
*
data
!=
InvalidHandle
()
)
*
data
=
unpack_elements
[
GetHandleID
(
*
data
)];
}
}
assert
(
k
<
array_size_recv
.
size
()
);
INMOST_DATA_ENUM_TYPE
data_size
=
GetDataCapacity
(
&
array_data_recv
[
pos
],
array_size_recv
[
k
],
tag
);
assert
(
pos
+
data_size
<=
array_data_recv
.
size
());
op
(
tag
,
Element
(
this
,
*
eit
),
&
array_data_recv
[
pos
],
array_size_recv
[
k
]);
pos
+=
GetDataCapacity
(
&
array_data_recv
[
pos
],
array_size_recv
[
k
],
tag
)
;
pos
+=
data_size
;
++
k
;
++
total_unpacked
;
}
...
...
@@ -2700,6 +2705,8 @@ namespace INMOST
{
REPORT_VAL
(
"element index"
,
array_size_recv
[
k
]);
REPORT_VAL
(
"pos"
,
pos
);
assert
(
k
<
array_size_recv
.
size
()
);
assert
(
array_size_recv
[
k
]
<
elements
[
i
].
size
()
);
eit
=
elements
[
i
].
begin
()
+
array_size_recv
[
k
++
];
assert
(
!
select
||
GetMarker
(
*
eit
,
select
)
);
//if fires then very likely that marker was not synchronized
if
(
tag
.
GetDataType
()
==
DATA_REFERENCE
)
...
...
@@ -2710,8 +2717,10 @@ namespace INMOST
if
(
*
data
!=
InvalidHandle
()
)
*
data
=
unpack_elements
[
GetHandleID
(
*
data
)];
}
}
INMOST_DATA_ENUM_TYPE
data_size
=
GetDataCapacity
(
&
array_data_recv
[
pos
],
size
,
tag
);
assert
(
pos
+
data_size
<=
array_data_recv
.
size
());
op
(
tag
,
Element
(
this
,
*
eit
),
&
array_data_recv
[
pos
],
size
);
pos
+=
GetDataCapacity
(
&
array_data_recv
[
pos
],
size
,
tag
)
;
pos
+=
data_size
;
++
total_unpacked
;
}
}
...
...
@@ -2734,8 +2743,11 @@ namespace INMOST
if
(
*
data
!=
InvalidHandle
()
)
*
data
=
unpack_elements
[
GetHandleID
(
*
data
)];
}
}
assert
(
k
<
array_size_recv
.
size
());
INMOST_DATA_ENUM_TYPE
data_size
=
GetDataCapacity
(
&
array_data_recv
[
pos
],
array_size_recv
[
k
],
tag
);
assert
(
pos
+
data_size
<=
array_data_recv
.
size
());
op
(
tag
,
Element
(
this
,
*
eit
),
&
array_data_recv
[
pos
],
array_size_recv
[
k
]);
pos
+=
GetDataCapacity
(
&
array_data_recv
[
pos
],
array_size_recv
[
k
],
tag
)
;
pos
+=
data_size
;
++
k
;
++
total_unpacked
;
}
...
...
@@ -2757,8 +2769,10 @@ namespace INMOST
if
(
*
data
!=
InvalidHandle
()
)
*
data
=
unpack_elements
[
GetHandleID
(
*
data
)];
}
}
INMOST_DATA_ENUM_TYPE
data_size
=
GetDataCapacity
(
&
array_data_recv
[
pos
],
size
,
tag
);
assert
(
pos
+
data_size
<=
array_data_recv
.
size
());
op
(
tag
,
Element
(
this
,
*
eit
),
&
array_data_recv
[
pos
],
size
);
pos
+=
GetDataCapacity
(
&
array_data_recv
[
pos
],
size
,
tag
)
;
pos
+=
data_size
;
++
total_unpacked
;
}
else
total_skipped
++
;
...
...
@@ -3256,6 +3270,7 @@ namespace INMOST
ENTER_FUNC
();
REPORT_VAL
(
"dest"
,
destination
);
#if defined(USE_MPI)
REPORT_VAL
(
"buffer size"
,
buffer
.
size
());
int
rank
=
GetProcessorRank
();
//std::cout << ro() << rank << " In pack elements data " << all.size() << std::endl;
//std::cout << rank << " In pack elements Data" << std::endl;
...
...
@@ -3457,6 +3472,7 @@ namespace INMOST
REPORT_VAL
(
"total marked for data"
,
marked_for_data
<<
" / "
<<
selems
[
0
].
size
());
REPORT_VAL
(
"total marked as shared"
,
marked_shared
<<
" / "
<<
selems
[
0
].
size
());
buffer
.
resize
(
position
);
REPORT_VAL
(
"buffer position"
,
position
);
}
//pack edges
{
...
...
@@ -3518,6 +3534,7 @@ namespace INMOST
if
(
!
low_conn_size
.
empty
()
)
MPI_Pack
(
&
low_conn_size
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
selems
[
1
].
size
()),
INMOST_MPI_DATA_ENUM_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
if
(
!
low_conn_nums
.
empty
()
)
MPI_Pack
(
&
low_conn_nums
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
num
)
,
INMOST_MPI_DATA_INTEGER_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
buffer
.
resize
(
position
);
REPORT_VAL
(
"buffer position"
,
position
);
}
//pack faces
{
...
...
@@ -3579,6 +3596,7 @@ namespace INMOST
if
(
!
low_conn_size
.
empty
()
)
MPI_Pack
(
&
low_conn_size
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
selems
[
2
].
size
()),
INMOST_MPI_DATA_ENUM_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
if
(
!
low_conn_nums
.
empty
()
)
MPI_Pack
(
&
low_conn_nums
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
num
)
,
INMOST_MPI_DATA_INTEGER_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
buffer
.
resize
(
position
);
REPORT_VAL
(
"buffer position"
,
position
);
}
//pack cells
{
...
...
@@ -3666,6 +3684,7 @@ namespace INMOST
if
(
!
high_conn_size
.
empty
()
)
MPI_Pack
(
&
high_conn_size
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
selems
[
3
].
size
()),
INMOST_MPI_DATA_ENUM_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
if
(
!
high_conn_nums
.
empty
()
)
MPI_Pack
(
&
high_conn_nums
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
num_high
)
,
INMOST_MPI_DATA_INTEGER_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
buffer
.
resize
(
position
);
REPORT_VAL
(
"buffer position"
,
position
);
}
/////////////////////////////////////////
...
...
@@ -3767,6 +3786,7 @@ namespace INMOST
if
(
!
low_conn_nums
.
empty
()
)
MPI_Pack
(
&
low_conn_nums
[
0
]
,
static_cast
<
INMOST_MPI_SIZE
>
(
num
)
,
INMOST_MPI_DATA_INTEGER_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
if
(
selems
[
4
].
size
()
>
0
)
MPI_Pack
(
&
high_conn_nums
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
selems
[
4
].
size
()
*
3
),
INMOST_MPI_DATA_INTEGER_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
buffer
.
resize
(
position
);
REPORT_VAL
(
"buffer position"
,
position
);
}
/////////////////////////////////////////
DeleteTag
(
arr_position
);
...
...
@@ -3786,6 +3806,7 @@ namespace INMOST
buffer
.
resize
(
position
+
new_size
);
MPI_Pack
(
&
num
,
1
,
INMOST_MPI_DATA_ENUM_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
buffer
.
resize
(
position
);
REPORT_VAL
(
"buffer position"
,
position
);
}
for
(
INMOST_DATA_ENUM_TYPE
i
=
0
;
i
<
tag_list
.
size
();
i
++
)
{
...
...
@@ -3829,13 +3850,14 @@ namespace INMOST
MPI_Pack
(
&
num
,
1
,
INMOST_MPI_DATA_ENUM_TYPE
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
MPI_Pack
(
const_cast
<
char
*>
(
name
.
c_str
()),
static_cast
<
INMOST_MPI_SIZE
>
(
num
),
MPI_CHAR
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
&
position
,
comm
);
buffer
.
resize
(
position
);
REPORT_VAL
(
"buffer position"
,
position
);
}
//TODO 46 old
//PackTagData(GetTag(tag_list[i]),pack_tags,NODE | EDGE | FACE | CELL | ESET,0,buffer);
PackTagData
(
tag
,
selems
,
destination
,
NODE
|
EDGE
|
FACE
|
CELL
|
ESET
,
pack_tags_mrk
,
buffer
);
//PackTagData(tag,selems,NODE | EDGE | FACE | CELL | ESET,0,buffer);
//std::cout << mpirank << " After pack_tag_data\n" << std::endl;
REPORT_VAL
(
"buffer position"
,
buffer
.
size
());
}
}
for
(
integer
i
=
ElementNum
(
NODE
);
i
<=
ElementNum
(
CELL
);
i
++
)
...
...
@@ -3857,6 +3879,8 @@ namespace INMOST
ENTER_FUNC
();
REPORT_VAL
(
"source"
,
source
);
#if defined(USE_MPI)
REPORT_VAL
(
"buffer size"
,
buffer
.
size
());
REPORT_VAL
(
"buffer position"
,
position
);
int
mpirank
=
GetProcessorRank
();
int
rank
=
mpirank
;
INMOST_DATA_ENUM_TYPE
num
,
temp
;
...
...
@@ -4002,6 +4026,7 @@ namespace INMOST
REPORT_VAL
(
"total found"
,
found
<<
" / "
<<
selems
[
0
].
size
());
REPORT_VAL
(
"total marked for data"
,
marked_for_data
<<
" / "
<<
selems
[
0
].
size
());
REPORT_VAL
(
"total marked ghost"
,
marked_ghost
<<
" / "
<<
selems
[
0
].
size
());
REPORT_VAL
(
"buffer position"
,
position
);
}
time
=
Timer
()
-
time
;
REPORT_STR
(
"unpack nodes"
);
...
...
@@ -4076,6 +4101,7 @@ namespace INMOST
REPORT_VAL
(
"total found"
,
found
<<
" / "
<<
selems
[
1
].
size
());
REPORT_VAL
(
"total marked for data"
,
marked_for_data
<<
" / "
<<
selems
[
1
].
size
());
REPORT_VAL
(
"total marked ghost"
,
marked_ghost
<<
" / "
<<
selems
[
1
].
size
());
REPORT_VAL
(
"buffer position"
,
position
);
}
time
=
Timer
()
-
time
;
REPORT_STR
(
"unpack edges"
);
...
...
@@ -4169,6 +4195,7 @@ namespace INMOST
REPORT_VAL
(
"total found"
,
found
<<
" / "
<<
selems
[
2
].
size
());
REPORT_VAL
(
"total marked for data"
,
marked_for_data
<<
" / "
<<
selems
[
2
].
size
());
REPORT_VAL
(
"total marked ghost"
,
marked_ghost
<<
" / "
<<
selems
[
2
].
size
());
REPORT_VAL
(
"buffer position"
,
position
);
}
time
=
Timer
()
-
time
;
REPORT_STR
(
"unpack faces"
);
...
...
@@ -4258,6 +4285,7 @@ namespace INMOST
REPORT_VAL
(
"total found"
,
found
<<
" / "
<<
selems
[
3
].
size
());
REPORT_VAL
(
"total marked for data"
,
marked_for_data
<<
" / "
<<
selems
[
3
].
size
());
REPORT_VAL
(
"total marked ghost"
,
marked_ghost
<<
" / "
<<
selems
[
3
].
size
());
REPORT_VAL
(
"buffer position"
,
position
);
}
time
=
Timer
()
-
time
;
REPORT_STR
(
"unpack cells"
);
...
...
@@ -4395,6 +4423,7 @@ namespace INMOST
if
(
!
set
->
HaveSibling
())
set
.
AddSibling
(
ElementSet
(
this
,
selems
[
4
][
high_conn_nums
[
i
*
3
+
1
]]));
}
}
REPORT_VAL
(
"buffer position"
,
position
);
}
/////////////////////////////////////////////////////////////
//cout << rank << "UNPACK ESET COMPLETE" << endl;
...
...
@@ -4436,12 +4465,14 @@ namespace INMOST
if
(
defined
&
etype
)
REPORT_VAL
(
"defined on"
,
ElementTypeName
(
etype
));
if
(
sparse
&
etype
)
REPORT_VAL
(
"sparse on"
,
ElementTypeName
(
etype
));
}
REPORT_VAL
(
"buffer position"
,
position
);
tag_recv
.
push_back
(
tag_name
);
Tag
tag
=
CreateTag
(
tag_name
,
static_cast
<
enum
DataType
>
(
datatype
),
static_cast
<
ElementType
>
(
defined
),
static_cast
<
ElementType
>
(
sparse
),
datasize
);
//TODO 46 old
//UnpackTagData(tag,unpack_tags,0,NODE | EDGE | FACE | CELL | ESET, buffer,position,DefaultUnpack);
UnpackTagData
(
tag
,
selems
,
source
,
NODE
|
EDGE
|
FACE
|
CELL
|
ESET
,
unpack_tags_mrk
,
buffer
,
position
,
DefaultUnpack
);
//UnpackTagData(tag,selems,NODE | EDGE | FACE | CELL | ESET,0, buffer,position,DefaultUnpack);
REPORT_VAL
(
"buffer position"
,
position
);
}
}
...
...
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