Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Backofen, Rainer
amdis
Commits
8b8abdb5
Commit
8b8abdb5
authored
Oct 22, 2012
by
Thomas Witkowski
Browse files
No, does not work, so merge to juropa and go on with debugging.
parent
96a3d58b
Changes
1
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/parallel/PetscSolverFeti.cc
View file @
8b8abdb5
...
@@ -259,31 +259,28 @@ namespace AMDiS {
...
@@ -259,31 +259,28 @@ namespace AMDiS {
}
}
MSG
(
"FETI-DP data created on mesh level %d
\n
"
,
meshLevel
);
MSG
(
"FETI-DP data created on mesh level %d
\n
"
,
meshLevel
);
for
(
unsigned
int
i
=
0
;
i
<
meshDistributor
->
getFeSpaces
().
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
meshDistributor
->
get
Component
FeSpaces
().
size
();
i
++
)
{
const
FiniteElemSpace
*
feSpace
=
meshDistributor
->
getFeSpace
(
i
);
const
FiniteElemSpace
*
feSpace
=
meshDistributor
->
getFeSpace
(
i
);
MSG
(
"FETI-DP data for %d-ith FE space: %p
\n
"
,
i
,
feSpace
);
MSG
(
"FETI-DP data for %d-ith component (FE space %p):
\n
"
,
i
,
feSpace
);
if
(
feSpace
==
pressureFeSpace
)
{
if
(
feSpace
==
pressureFeSpace
)
{
MSG
(
" nRankInterface = %d nOverallInterface = %d
\n
"
,
MSG
(
" nRankInterface = %d nOverallInterface = %d
\n
"
,
interfaceDofMap
[
feSpace
].
nRankDofs
,
interfaceDofMap
[
i
].
nRankDofs
,
interfaceDofMap
[
feSpace
].
nOverallDofs
);
interfaceDofMap
[
i
].
nOverallDofs
);
}
else
{
}
else
{
MSG
(
" nRankPrimals = %d nLocalPrimals = %d nOverallPrimals = %d
\n
"
,
MSG
(
" nRankPrimals = %d nLocalPrimals = %d nOverallPrimals = %d
\n
"
,
primalDofMap
[
feSpace
].
nRankDofs
,
primalDofMap
[
i
].
nRankDofs
,
primalDofMap
[
feSpace
].
nLocalDofs
,
primalDofMap
[
i
].
nLocalDofs
,
primalDofMap
[
feSpace
].
nOverallDofs
);
primalDofMap
[
i
].
nOverallDofs
);
MSG
(
" nRankDuals = %d nOverallDuals = %d
\n
"
,
MSG
(
" nRankDuals = %d nOverallDuals = %d
\n
"
,
dualDofMap
[
feSpace
].
nRankDofs
,
dualDofMap
[
i
].
nRankDofs
,
dualDofMap
[
feSpace
].
nOverallDofs
);
dualDofMap
[
i
].
nOverallDofs
);
MSG
(
" nRankLagrange = %d nOverallLagrange = %d
\n
"
,
MSG
(
" nRankLagrange = %d nOverallLagrange = %d
\n
"
,
lagrangeMap
[
feSpace
].
nRankDofs
,
lagrangeMap
[
i
].
nRankDofs
,
lagrangeMap
[
feSpace
].
nOverallDofs
);
lagrangeMap
[
i
].
nOverallDofs
);
// TEST_EXIT_DBG(localDofMap[feSpace].size() + primalDofMap[feSpace].size() ==
// static_cast<unsigned int>(feSpace->getAdmin()->getUsedDofs()))
// ("Should not happen!\n");
}
}
}
}
...
@@ -534,7 +531,7 @@ namespace AMDiS {
...
@@ -534,7 +531,7 @@ namespace AMDiS {
// === appropriate number of Lagrange constraints. ===
// === appropriate number of Lagrange constraints. ===
int
nRankLagrange
=
0
;
int
nRankLagrange
=
0
;
DofMap
&
dualMap
=
dualDofMap
[
feSpace
].
getMap
();
DofMap
&
dualMap
=
dualDofMap
[
component
].
getMap
();
for
(
DofMap
::
iterator
it
=
dualMap
.
begin
();
it
!=
dualMap
.
end
();
++
it
)
{
for
(
DofMap
::
iterator
it
=
dualMap
.
begin
();
it
!=
dualMap
.
end
();
++
it
)
{
if
(
meshDistributor
->
getDofMap
()[
feSpace
].
isRankDof
(
it
->
first
))
{
if
(
meshDistributor
->
getDofMap
()[
feSpace
].
isRankDof
(
it
->
first
))
{
lagrangeMap
[
component
].
insertRankDof
(
it
->
first
,
nRankLagrange
);
lagrangeMap
[
component
].
insertRankDof
(
it
->
first
,
nRankLagrange
);
...
@@ -598,8 +595,8 @@ namespace AMDiS {
...
@@ -598,8 +595,8 @@ namespace AMDiS {
// === And finally, add the global indicies of all dual nodes. ===
// === And finally, add the global indicies of all dual nodes. ===
for
(
DofMap
::
iterator
it
=
dualDofMap
[
feSpace
].
getMap
().
begin
();
for
(
DofMap
::
iterator
it
=
dualDofMap
[
component
].
getMap
().
begin
();
it
!=
dualDofMap
[
feSpace
].
getMap
().
end
();
++
it
)
{
it
!=
dualDofMap
[
component
].
getMap
().
end
();
++
it
)
{
if
(
meshLevel
==
0
)
{
if
(
meshLevel
==
0
)
{
localDofMap
[
component
].
insertRankDof
(
it
->
first
);
localDofMap
[
component
].
insertRankDof
(
it
->
first
);
}
else
{
}
else
{
...
@@ -638,19 +635,19 @@ namespace AMDiS {
...
@@ -638,19 +635,19 @@ namespace AMDiS {
// === m == r, than the rank sets -1.0 for the corresponding ===
// === m == r, than the rank sets -1.0 for the corresponding ===
// === constraint. ===
// === constraint. ===
for
(
unsigned
int
k
=
0
;
k
<
feSpaces
.
size
();
k
++
)
{
for
(
unsigned
int
component
=
0
;
component
<
feSpaces
.
size
();
component
++
)
{
DofMap
&
dualMap
=
dualDofMap
[
feSpaces
[
k
]
].
getMap
();
DofMap
&
dualMap
=
dualDofMap
[
component
].
getMap
();
for
(
DofMap
::
iterator
it
=
dualMap
.
begin
();
it
!=
dualMap
.
end
();
++
it
)
{
for
(
DofMap
::
iterator
it
=
dualMap
.
begin
();
it
!=
dualMap
.
end
();
++
it
)
{
TEST_EXIT_DBG
(
boundaryDofRanks
[
feSpaces
[
k
]].
count
(
it
->
first
))
TEST_EXIT_DBG
(
boundaryDofRanks
[
feSpaces
[
component
]].
count
(
it
->
first
))
(
"Should not happen!
\n
"
);
(
"Should not happen!
\n
"
);
// Global index of the first Lagrange constriant for this node.
// Global index of the first Lagrange constriant for this node.
int
index
=
lagrangeMap
.
getMatIndex
(
k
,
it
->
first
);
int
index
=
lagrangeMap
.
getMatIndex
(
component
,
it
->
first
);
// Copy set of all ranks that contain this dual node.
// Copy set of all ranks that contain this dual node.
vector
<
int
>
W
(
boundaryDofRanks
[
feSpaces
[
k
]][
it
->
first
].
begin
(),
vector
<
int
>
W
(
boundaryDofRanks
[
feSpaces
[
component
]][
it
->
first
].
begin
(),
boundaryDofRanks
[
feSpaces
[
k
]][
it
->
first
].
end
());
boundaryDofRanks
[
feSpaces
[
component
]][
it
->
first
].
end
());
// Number of ranks that contain this dual node.
// Number of ranks that contain this dual node.
int
degree
=
W
.
size
();
int
degree
=
W
.
size
();
...
@@ -662,7 +659,7 @@ namespace AMDiS {
...
@@ -662,7 +659,7 @@ namespace AMDiS {
if
(
W
[
i
]
==
mpiRank
||
W
[
j
]
==
mpiRank
)
{
if
(
W
[
i
]
==
mpiRank
||
W
[
j
]
==
mpiRank
)
{
MatSetValue
(
mat_lagrange
,
MatSetValue
(
mat_lagrange
,
index
+
counter
,
index
+
counter
,
localDofMap
.
getMatIndex
(
k
,
it
->
first
)
+
rStartInterior
,
localDofMap
.
getMatIndex
(
component
,
it
->
first
)
+
rStartInterior
,
(
W
[
i
]
==
mpiRank
?
1.0
:
-
1.0
),
(
W
[
i
]
==
mpiRank
?
1.0
:
-
1.0
),
INSERT_VALUES
);
INSERT_VALUES
);
}
}
...
@@ -673,7 +670,7 @@ namespace AMDiS {
...
@@ -673,7 +670,7 @@ namespace AMDiS {
// === Create scaling factors for scaling the lagrange matrix, which ===
// === Create scaling factors for scaling the lagrange matrix, which ===
// === is required for FETI-DP preconditioners. ===
// === is required for FETI-DP preconditioners. ===
if
(
meshDistributor
->
getDofMap
()[
feSpaces
[
k
]].
isRankDof
(
it
->
first
))
{
if
(
meshDistributor
->
getDofMap
()[
feSpaces
[
component
]].
isRankDof
(
it
->
first
))
{
int
nConstraints
=
(
degree
*
(
degree
-
1
))
/
2
;
int
nConstraints
=
(
degree
*
(
degree
-
1
))
/
2
;
for
(
int
i
=
0
;
i
<
nConstraints
;
i
++
)
{
for
(
int
i
=
0
;
i
<
nConstraints
;
i
++
)
{
VecSetValue
(
vec_scale_lagrange
,
VecSetValue
(
vec_scale_lagrange
,
...
@@ -1228,12 +1225,12 @@ namespace AMDiS {
...
@@ -1228,12 +1225,12 @@ namespace AMDiS {
TEST_EXIT_DBG
(
meshLevel
==
0
)
TEST_EXIT_DBG
(
meshLevel
==
0
)
(
"Should not happen, check usage of localDofMap!
\n
"
);
(
"Should not happen, check usage of localDofMap!
\n
"
);
for
(
unsigned
int
i
=
0
;
i
<
feSpaces
.
size
();
i
++
)
{
for
(
unsigned
int
component
=
0
;
component
<
feSpaces
.
size
();
component
++
)
{
DofMap
&
dualMap
=
dualDofMap
[
feSpaces
[
i
]
].
getMap
();
DofMap
&
dualMap
=
dualDofMap
[
component
].
getMap
();
for
(
DofMap
::
iterator
it
=
dualMap
.
begin
();
it
!=
dualMap
.
end
();
++
it
)
{
for
(
DofMap
::
iterator
it
=
dualMap
.
begin
();
it
!=
dualMap
.
end
();
++
it
)
{
DegreeOfFreedom
d
=
it
->
first
;
DegreeOfFreedom
d
=
it
->
first
;
int
matIndexLocal
=
localDofMap
.
getLocalMatIndex
(
i
,
d
);
int
matIndexLocal
=
localDofMap
.
getLocalMatIndex
(
component
,
d
);
int
matIndexDual
=
dualDofMap
.
getLocalMatIndex
(
i
,
d
);
int
matIndexDual
=
dualDofMap
.
getLocalMatIndex
(
component
,
d
);
fetiDirichletPreconData
.
localToDualMap
[
matIndexLocal
]
=
matIndexDual
;
fetiDirichletPreconData
.
localToDualMap
[
matIndexLocal
]
=
matIndexDual
;
}
}
}
}
...
@@ -1271,15 +1268,15 @@ namespace AMDiS {
...
@@ -1271,15 +1268,15 @@ namespace AMDiS {
MatGetVecs
(
mat_duals_duals
,
PETSC_NULL
,
MatGetVecs
(
mat_duals_duals
,
PETSC_NULL
,
&
(
lumpedData
->
tmp_vec_duals1
));
&
(
lumpedData
->
tmp_vec_duals1
));
for
(
unsigned
int
i
=
0
;
i
<
feSpaces
.
size
();
i
++
)
{
for
(
unsigned
int
component
=
0
;
component
<
feSpaces
.
size
();
component
++
)
{
if
(
stokesMode
&&
i
==
pressureComponent
)
if
(
stokesMode
&&
component
==
pressureComponent
)
continue
;
continue
;
DofMap
&
dualMap
=
dualDofMap
[
feSpaces
[
i
]
].
getMap
();
DofMap
&
dualMap
=
dualDofMap
[
component
].
getMap
();
for
(
DofMap
::
iterator
it
=
dualMap
.
begin
();
it
!=
dualMap
.
end
();
++
it
)
{
for
(
DofMap
::
iterator
it
=
dualMap
.
begin
();
it
!=
dualMap
.
end
();
++
it
)
{
DegreeOfFreedom
d
=
it
->
first
;
DegreeOfFreedom
d
=
it
->
first
;
int
matIndexLocal
=
localDofMap
.
getLocalMatIndex
(
i
,
d
);
int
matIndexLocal
=
localDofMap
.
getLocalMatIndex
(
component
,
d
);
int
matIndexDual
=
dualDofMap
.
getLocalMatIndex
(
i
,
d
);
int
matIndexDual
=
dualDofMap
.
getLocalMatIndex
(
component
,
d
);
lumpedData
->
localToDualMap
[
matIndexLocal
]
=
matIndexDual
;
lumpedData
->
localToDualMap
[
matIndexLocal
]
=
matIndexDual
;
}
}
}
}
...
@@ -1588,7 +1585,7 @@ namespace AMDiS {
...
@@ -1588,7 +1585,7 @@ namespace AMDiS {
std
::
set
<
DegreeOfFreedom
>
&
dirichletRows
=
seqMat
->
getDirichletRows
();
std
::
set
<
DegreeOfFreedom
>
&
dirichletRows
=
seqMat
->
getDirichletRows
();
for
(
std
::
set
<
DegreeOfFreedom
>::
iterator
it
=
dirichletRows
.
begin
();
for
(
std
::
set
<
DegreeOfFreedom
>::
iterator
it
=
dirichletRows
.
begin
();
it
!=
dirichletRows
.
end
();
++
it
)
{
it
!=
dirichletRows
.
end
();
++
it
)
{
if
(
localDofMap
[
feSpace
].
isSet
(
*
it
))
{
if
(
localDofMap
[
i
].
isSet
(
*
it
))
{
MSG
(
"Dirichlet dof %d in component %d with interior mat index %d
\n
"
,
MSG
(
"Dirichlet dof %d in component %d with interior mat index %d
\n
"
,
*
it
,
i
,
localDofMap
.
getMatIndex
(
i
,
*
it
));
*
it
,
i
,
localDofMap
.
getMatIndex
(
i
,
*
it
));
}
}
...
@@ -1640,7 +1637,7 @@ namespace AMDiS {
...
@@ -1640,7 +1637,7 @@ namespace AMDiS {
// === Create scatter to get solutions of all primal nodes that are ===
// === Create scatter to get solutions of all primal nodes that are ===
// === contained in rank's domain. ===
// === contained in rank's domain. ===
vector
<
const
FiniteElemSpace
*>
feSpaces
=
vec
.
getComponentFeSpaces
();
int
nComponents
=
vec
.
getSize
();
vector
<
PetscInt
>
globalIsIndex
,
localIsIndex
;
vector
<
PetscInt
>
globalIsIndex
,
localIsIndex
;
globalIsIndex
.
reserve
(
primalDofMap
.
getLocalDofs
());
globalIsIndex
.
reserve
(
primalDofMap
.
getLocalDofs
());
...
@@ -1648,10 +1645,10 @@ namespace AMDiS {
...
@@ -1648,10 +1645,10 @@ namespace AMDiS {
{
{
int
cnt
=
0
;
int
cnt
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
feSpaces
.
size
();
i
++
)
{
for
(
unsigned
int
component
=
0
;
component
<
nComponents
;
component
++
)
{
DofMap
&
dofMap
=
primalDofMap
[
feSpaces
[
i
]
].
getMap
();
DofMap
&
dofMap
=
primalDofMap
[
component
].
getMap
();
for
(
DofMap
::
iterator
it
=
dofMap
.
begin
();
it
!=
dofMap
.
end
();
++
it
)
{
for
(
DofMap
::
iterator
it
=
dofMap
.
begin
();
it
!=
dofMap
.
end
();
++
it
)
{
globalIsIndex
.
push_back
(
primalDofMap
.
getMatIndex
(
i
,
it
->
first
));
globalIsIndex
.
push_back
(
primalDofMap
.
getMatIndex
(
component
,
it
->
first
));
localIsIndex
.
push_back
(
cnt
++
);
localIsIndex
.
push_back
(
cnt
++
);
}
}
}
}
...
@@ -1692,26 +1689,27 @@ namespace AMDiS {
...
@@ -1692,26 +1689,27 @@ namespace AMDiS {
// === And copy from PETSc local vectors to the DOF vectors. ===
// === And copy from PETSc local vectors to the DOF vectors. ===
vector
<
const
FiniteElemSpace
*>
feSpaces
=
vec
.
getComponentFeSpaces
();
int
cnt
=
0
;
int
cnt
=
0
;
for
(
int
i
=
0
;
i
<
vec
.
getSize
();
i
++
)
{
for
(
int
component
=
0
;
component
<
nComponents
;
component
++
)
{
DOFVector
<
double
>&
dofVec
=
*
(
vec
.
getDOFVector
(
i
));
DOFVector
<
double
>&
dofVec
=
*
(
vec
.
getDOFVector
(
component
));
for
(
DofMap
::
iterator
it
=
localDofMap
[
feSpaces
[
i
]
].
getMap
().
begin
();
for
(
DofMap
::
iterator
it
=
localDofMap
[
component
].
getMap
().
begin
();
it
!=
localDofMap
[
feSpaces
[
i
]
].
getMap
().
end
();
++
it
)
{
it
!=
localDofMap
[
component
].
getMap
().
end
();
++
it
)
{
if
(
meshLevel
==
0
)
{
if
(
meshLevel
==
0
)
{
int
petscIndex
=
localDofMap
.
getLocalMatIndex
(
i
,
it
->
first
);
int
petscIndex
=
localDofMap
.
getLocalMatIndex
(
component
,
it
->
first
);
dofVec
[
it
->
first
]
=
localSolB
[
petscIndex
];
dofVec
[
it
->
first
]
=
localSolB
[
petscIndex
];
}
else
{
}
else
{
if
(
meshDistributor
->
getDofMapSd
()[
feSpaces
[
i
]].
isRankDof
(
it
->
first
))
{
if
(
meshDistributor
->
getDofMapSd
()[
feSpaces
[
component
]].
isRankDof
(
it
->
first
))
{
int
petscIndex
=
localDofMap
.
getLocalMatIndex
(
i
,
it
->
first
);
int
petscIndex
=
localDofMap
.
getLocalMatIndex
(
component
,
it
->
first
);
TEST_EXIT
(
petscIndex
<
bsize
)(
"Should not happen!
\n
"
);
TEST_EXIT
(
petscIndex
<
bsize
)(
"Should not happen!
\n
"
);
dofVec
[
it
->
first
]
=
localSolB
[
petscIndex
];
dofVec
[
it
->
first
]
=
localSolB
[
petscIndex
];
}
}
}
}
}
}
for
(
DofMap
::
iterator
it
=
primalDofMap
[
feSpaces
[
i
]
].
getMap
().
begin
();
for
(
DofMap
::
iterator
it
=
primalDofMap
[
component
].
getMap
().
begin
();
it
!=
primalDofMap
[
feSpaces
[
i
]
].
getMap
().
end
();
++
it
)
it
!=
primalDofMap
[
component
].
getMap
().
end
();
++
it
)
dofVec
[
it
->
first
]
=
localSolPrimal
[
cnt
++
];
dofVec
[
it
->
first
]
=
localSolPrimal
[
cnt
++
];
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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