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
4d363998
Commit
4d363998
authored
Mar 19, 2018
by
SilverLife
Browse files
Add ExchangeData for REFERENSES. Add ResolveSets. Add transfer to other processor for sets.
parent
949d38d0
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Source/Headers/inmost_mesh.h
View file @
4d363998
...
...
@@ -12,6 +12,7 @@
namespace
INMOST
{
std
::
string
ro
();
class
Mesh
;
class
Storage
;
...
...
@@ -38,6 +39,7 @@ namespace INMOST
static
const
SyncBitOp
SYNC_BIT_XOR
=
2
;
static
const
SyncBitOp
SYNC_BIT_AND
=
3
;
///Definition for data type of topology error or event. This type may be extended later to 64 bits
/// to accomodate more topological errors or events.
...
...
@@ -1286,12 +1288,11 @@ namespace INMOST
//INMOST_MPI_Group group;
Tag
tag_shared
;
Tag
tag_owner
;
Tag
tag_processors
;
Tag
tag_layers
;
Tag
tag_sendto
;
Tag
tag_bridge
;
Tag
tag_redistribute
;
private:
double
dist
(
Cell
a
,
Cell
b
);
void
AllocatePrivateMarkers
();
void
DeallocatePrivateMarkers
();
__INLINE
static
sparse_rec
mkrec
(
const
Tag
&
t
)
{
sparse_rec
ret
;
ret
.
tag
=
t
.
mem
;
ret
.
rec
=
NULL
;
return
ret
;}
...
...
@@ -1310,6 +1311,9 @@ namespace INMOST
void
AllocateSparseData
(
void
*
&
q
,
const
Tag
&
t
);
void
Init
(
std
::
string
name
);
public:
Tag
tag_sendto
;
TagInteger
tag_an_id
;
Tag
tag_processors
;
/// Go through all elements and detect presence of prescribed element in
/// any reference data tag.
void
ReportConnection
(
HandleType
h
);
...
...
@@ -2222,10 +2226,10 @@ namespace INMOST
class
elements_by_type
{
private:
element_set
container
[
4
];
element_set
container
[
5
];
public:
elements_by_type
()
{}
elements_by_type
(
const
elements_by_type
&
other
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
container
[
i
]
=
other
.
container
[
i
];}
elements_by_type
(
const
elements_by_type
&
other
)
{
for
(
int
i
=
0
;
i
<
5
;
i
++
)
container
[
i
]
=
other
.
container
[
i
];}
~
elements_by_type
(){}
element_set
&
operator
[](
int
i
){
return
container
[
i
];
}
const
element_set
&
operator
[](
int
i
)
const
{
return
container
[
i
];
}
...
...
@@ -2251,7 +2255,7 @@ namespace INMOST
private:
void
ComputeSharedProcs
();
proc_elements
ComputeSharedSkinSet
(
ElementType
bridge
);
void
PackTagData
(
const
Tag
&
tag
,
const
elements_by_type
&
elements
,
ElementType
mask
,
MarkerType
select
,
buffer_type
&
buffer
);
void
PackTagData
(
const
Tag
&
tag
,
const
elements_by_type
&
elements
,
int
destination
,
ElementType
mask
,
MarkerType
select
,
buffer_type
&
buffer
);
void
UnpackTagData
(
const
Tag
&
tag
,
const
elements_by_type
&
elements
,
ElementType
mask
,
MarkerType
select
,
buffer_type
&
buffer
,
int
&
position
,
ReduceOperation
op
);
void
PackElementsData
(
element_set
&
input
,
buffer_type
&
buffer
,
int
destination
,
const
std
::
vector
<
std
::
string
>
&
tag_list
);
void
UnpackElementsData
(
element_set
&
output
,
buffer_type
&
buffer
,
int
source
,
std
::
vector
<
std
::
string
>
&
tag_list
);
...
...
@@ -2263,6 +2267,7 @@ namespace INMOST
void
SortParallelStorage
(
parallel_storage
&
ghost
,
parallel_storage
&
shared
,
ElementType
mask
);
void
GatherParallelStorage
(
parallel_storage
&
ghost
,
parallel_storage
&
shared
,
ElementType
mask
);
public:
bool
FindSharedGhost
(
int
global_id
,
INMOST_DATA_INTEGER_TYPE
el_type_num
,
HandleType
&
res
);
#if defined(USE_PARALLEL_WRITE_TIME)
//this part is needed to test parallel performance
void
Enter
();
...
...
@@ -2417,7 +2422,9 @@ namespace INMOST
/// Set MPI communicator
void
SetCommunicator
(
INMOST_MPI_Comm
_comm
);
/// Find elements that are common between processors.
void
ResolveShared
();
void
ResolveShared
(
bool
only_new
=
false
);
/// Find sets that are common between processors.
void
ResolveSets
();
/// Delete all the ghost cells.
void
RemoveGhost
();
/// Delete some ghost cells provided in array.
...
...
@@ -3223,6 +3230,20 @@ namespace INMOST
bool
operator
()
(
HandleType
a
,
integer
gid
)
const
{
if
(
a
==
InvalidHandle
()
)
return
false
;
return
m
->
GlobalID
(
a
)
<
gid
;}
};
class
SetNameComparator
{
Mesh
*
m
;
public:
SetNameComparator
(
Mesh
*
m
)
:
m
(
m
)
{}
bool
operator
()(
HandleType
a
,
HandleType
b
)
const
{
if
(
a
==
InvalidHandle
()
||
b
==
InvalidHandle
()
)
return
a
>
b
;
return
ElementSet
(
m
,
a
).
GetName
()
<
ElementSet
(
m
,
b
).
GetName
();
}
};
class
HierarchyComparator
{
Mesh
*
m
;
...
...
Source/Mesh/modify.cpp
View file @
4d363998
...
...
@@ -6,6 +6,8 @@
// incident_matrix class should measure for minimal volume,
// possibly check and update from projects/OctreeCutcell/octgrid.cpp
using
namespace
std
;
namespace
INMOST
{
...
...
@@ -1523,9 +1525,80 @@ namespace INMOST
//Destroy(erase);//old approach
}
double
Mesh
::
dist
(
Cell
a
,
Cell
b
)
{
double
xyza
[
3
];
double
xyzb
[
3
];
a
.
Centroid
(
xyza
);
b
.
Centroid
(
xyzb
);
double
dx
=
xyza
[
0
]
-
xyzb
[
0
];
double
dy
=
xyza
[
1
]
-
xyzb
[
1
];
double
dz
=
xyza
[
2
]
-
xyzb
[
2
];
return
sqrt
(
dx
*
dx
+
dy
*
dy
+
dz
*
dz
);
}
void
OperationMinDistance
(
const
Tag
&
tag
,
const
Element
&
element
,
const
INMOST_DATA_BULK_TYPE
*
data
,
INMOST_DATA_ENUM_TYPE
size
)
{
int
owner
=
*
((
double
*
)
data
);
double
dist
=
*
((
double
*
)(
data
+
sizeof
(
double
)));
TagReal
r_tag
=
tag
;
if
(
dist
<
element
->
RealArray
(
tag
)[
1
])
{
element
->
RealArray
(
tag
)[
0
]
=
owner
;
element
->
RealArray
(
tag
)[
1
]
=
dist
;
}
}
void
Mesh
::
ResolveModification
()
{
throw
NotImplemented
;
int
rank
=
GetProcessorRank
(),
mpisize
=
GetProcessorsNumber
();
Tag
tag
=
CreateTag
(
"TEMP_DISTANSE"
,
DATA_REAL
,
CELL
,
CELL
,
2
);
for
(
Mesh
::
iteratorCell
it
=
BeginCell
();
it
!=
EndCell
();
it
++
)
if
(
GetMarker
(
*
it
,
NewMarker
()))
{
double
min
=
0
;
int
first
=
0
;
Cell
near_cell
;
for
(
Mesh
::
iteratorCell
jt
=
BeginCell
();
jt
!=
EndCell
();
jt
++
)
if
(
GetMarker
(
*
jt
,
NewMarker
())
==
false
)
{
double
d
=
dist
(
it
->
getAsCell
(),
jt
->
getAsCell
());
if
(
first
++
==
0
||
min
>
d
)
{
min
=
d
;
near_cell
=
jt
->
getAsCell
();
}
}
int
owner1
=
it
->
IntegerDF
(
tag_owner
);
int
owner2
=
near_cell
.
IntegerDF
(
tag_owner
);
it
->
RealArray
(
tag
)[
0
]
=
owner2
;
it
->
RealArray
(
tag
)[
1
]
=
min
;
}
ReduceData
(
tag
,
CELL
,
0
,
OperationMinDistance
);
ExchangeData
(
tag
,
CELL
,
0
);
for
(
Mesh
::
iteratorCell
it
=
BeginCell
();
it
!=
EndCell
();
it
++
)
if
(
GetMarker
(
*
it
,
NewMarker
()))
{
int
new_owner
=
it
->
RealArray
(
tag
)[
0
];
it
->
IntegerDF
(
tag_owner
)
=
new_owner
;
if
(
rank
==
new_owner
)
{
it
->
SetStatus
(
Element
::
Shared
);
}
else
{
it
->
SetStatus
(
Element
::
Ghost
);
}
}
}
void
Mesh
::
EndModification
()
...
...
Source/Mesh/parallel.cpp
View file @
4d363998
This diff is collapsed.
Click to expand it.
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