Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mpp
Mpp
Commits
eabb9627
Commit
eabb9627
authored
Jan 20, 2022
by
daniele.corallo
Browse files
[403-add-stdist-warnings] added warnings to stdisc
parent
fa34b96d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib2_mesh/distribution/Distribution.cpp
View file @
eabb9627
...
...
@@ -69,7 +69,7 @@ void Distribution::DistributeMesh(Mesh &mesh) {
if
(
distribute
)
{
for
(
int
i
=
startDist
;
i
<
cells
.
size
();
++
i
){
for
(
int
i
=
startDist
;
i
<
cells
.
size
();
++
i
)
{
distributedCells
.
emplace_back
(
cells
[
i
]());
}
...
...
@@ -85,8 +85,7 @@ void Distribution::DistributeMesh(Mesh &mesh) {
<<
endl
;
if
(
PPM
->
Min
(
cellCount
,
commSplit
)
==
0
)
VerboseWarning
(
"At least one processor has no cells!"
,
1
);
VerboseWarning
(
"At least one processor has no cells!"
,
1
);
emptyData
(
clearDistributed
);
mout
.
EndBlock
(
true
);
...
...
@@ -97,7 +96,7 @@ void Distribution::Communicate(Mesh &mesh) {
for
(
int
q
=
0
;
q
<
PPM
->
Size
(
commSplit
);
++
q
)
{
for
(
auto
c
=
markedCells
[
q
].
begin
();
c
!=
markedCells
[
q
].
end
();
++
c
)
{
for
(
int
i
=
0
;
i
<
c
->
Corners
();
++
i
)
{
mesh
.
procSets
.
Add
(
c
->
Corner
(
i
),
q
);
mesh
.
procSets
.
Add
(
c
->
Corner
(
i
),
q
);
}
for
(
int
i
=
0
;
i
<
c
->
SpaceCell
().
Edges
();
++
i
)
mesh
.
procSets
.
Add
(
c
->
SpaceCell
().
Edge
(
i
),
q
);
...
...
@@ -327,6 +326,21 @@ bool TLess_t(const cell &c0, const cell &c1) {
return
false
;
}
std
::
function
<
bool
(
const
cell
&
,
const
cell
&
)
>
GetLess
(
char
var
)
{
switch
(
var
)
{
case
'x'
:
return
Less_x
;
case
'y'
:
return
Less_y
;
case
'z'
:
return
Less_z
;
case
't'
:
return
Less_t
;
default:
THROW
(
"Dimension "
+
std
::
to_string
(
var
)
+
" not known"
);
}
}
void
Distribution
::
RCB_x
(
int
rekDepth
,
int
begin
,
int
end
)
{
if
(
rekDepth
==
0
)
return
;
sort
(
cells
.
begin
()
+
begin
,
cells
.
begin
()
+
end
,
Less_x
);
...
...
@@ -794,19 +808,7 @@ void Distribution::timeOpt(int tProc, int level, int begin, int end) {
void
Distribution
::
timercb
(
int
level
,
int
begin
,
int
end
,
char
d
)
{
int
N
=
end
-
begin
;
switch
(
d
)
{
case
'x'
:
sort
(
cells
.
begin
()
+
begin
,
cells
.
begin
()
+
end
,
TLess_x
);
break
;
case
'y'
:
sort
(
cells
.
begin
()
+
begin
,
cells
.
begin
()
+
end
,
TLess_y
);
break
;
case
't'
:
sort
(
cells
.
begin
()
+
begin
,
cells
.
begin
()
+
end
,
TLess_t
);
break
;
default:
break
;
}
sort
(
cells
.
begin
()
+
begin
,
cells
.
begin
()
+
end
,
GetLess
(
d
));
if
(
level
==
0
)
{
return
;
}
else
{
...
...
@@ -865,23 +867,8 @@ void Distribution::timercb_weighted(int tlevel, int xlevel, int ylevel,
int
default_weight
)
{
int
N
=
end
-
begin
;
int
level
=
tlevel
+
xlevel
+
ylevel
;
switch
(
d
)
{
case
'x'
:
sort
(
cells
.
begin
()
+
begin
,
cells
.
begin
()
+
end
,
TLess_x
);
break
;
case
'y'
:
sort
(
cells
.
begin
()
+
begin
,
cells
.
begin
()
+
end
,
TLess_y
);
break
;
case
't'
:
sort
(
cells
.
begin
()
+
begin
,
cells
.
begin
()
+
end
,
TLess_t
);
break
;
default:
break
;
}
sort
(
cells
.
begin
()
+
begin
,
cells
.
begin
()
+
end
,
GetLess
(
d
));
if
(
PPM
->
proc
()
==
0
)
{
int
W_sum
=
0
;
for
(
int
i
=
begin
;
i
<
end
;
++
i
)
{
if
(
W
.
find
(
cells
[
i
]())
!=
W
.
end
())
...
...
@@ -919,7 +906,7 @@ void Distribution::timercb_weighted(int tlevel, int xlevel, int ylevel,
while
(
cells
[
mid
]().
t
()
==
cells
[
mid
-
1
]().
t
()
||
a
==
b
)
{
--
mid
;
if
(
mid
<
begin
)
break
;
if
(
mid
<
begin
||
mid
==
0
)
break
;
a
=
cells
[
mid
]().
CopyWithT
(
0.0
);
b
=
cells
[
mid
+
1
]().
CopyWithT
(
0.0
);
}
...
...
@@ -1046,25 +1033,30 @@ void Distribution::DistributeSTMesh(Mesh &mesh) {
}
else
if
(
_distName
==
"deformed_optimized"
)
{
int
S
=
mesh
.
steps
()
-
1
;
int
Slice_Maximum
=
int
(
log
(
double
(
S
))
/
log
(
2.0
)
+
1e-10
);
int
X_Maximum
=
int
(
log
(
double
(
sqrt
(
N
/
(
S
)
)))
/
log
(
2.0
)
+
1e-10
);
int
X_Maximum
=
int
(
log
(
double
(
sqrt
(
N
/
S
)))
/
log
(
2.0
)
+
1e-10
);
int
Y_Maximum
=
X_Maximum
;
if
(
Slice_Maximum
==
0
&&
X_Maximum
==
0
&&
Y_Maximum
==
0
)
{
THROW
(
"Not enough cells to distribute. Level: "
+
mesh
.
Level
().
str
())
}
int
tL
=
0
;
int
yL
=
0
;
int
xL
=
0
;
int
L0
=
rekDepth
;
for
(
int
i
=
0
;
i
<
rekDepth
;
++
i
)
{
if
(
L0
==
0
)
break
;
if
(
tL
<
Slice_Maximum
)
{
if
(
tL
<
Slice_Maximum
&&
Slice_Maximum
>
0
)
{
++
tL
;
--
L0
;
}
if
(
L0
==
0
)
break
;
if
(
xL
<
X_Maximum
)
{
if
(
xL
<
X_Maximum
&&
X_Maximum
>
0
)
{
++
xL
;
--
L0
;
}
if
(
L0
==
0
)
break
;
if
(
yL
<
Y_Maximum
)
{
if
(
yL
<
Y_Maximum
&&
Y_Maximum
>
0
)
{
++
yL
;
--
L0
;
}
...
...
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