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
1e7a784a
Commit
1e7a784a
authored
May 30, 2012
by
Thomas Witkowski
Browse files
Bugfix for setDofVector in global matrix solver when using a coarse space.
parent
83248601
Changes
3
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/parallel/ParallelDofMapping.h
View file @
1e7a784a
...
@@ -120,7 +120,7 @@ namespace AMDiS {
...
@@ -120,7 +120,7 @@ namespace AMDiS {
/// global index must not be set.
/// global index must not be set.
MultiIndex
&
operator
[](
DegreeOfFreedom
d
)
MultiIndex
&
operator
[](
DegreeOfFreedom
d
)
{
{
TEST_EXIT_DBG
(
dofMap
.
count
(
d
))(
"
Should not happen
!
\n
"
);
TEST_EXIT_DBG
(
dofMap
.
count
(
d
))(
"
DOF %d is not in map
!
\n
"
,
d
);
return
dofMap
[
d
];
return
dofMap
[
d
];
}
}
...
...
AMDiS/src/parallel/PetscProblemStat.cc
View file @
1e7a784a
...
@@ -86,6 +86,16 @@ namespace AMDiS {
...
@@ -86,6 +86,16 @@ namespace AMDiS {
double
wtime
=
MPI
::
Wtime
();
double
wtime
=
MPI
::
Wtime
();
#if 0
double vm, rss;
processMemUsage(vm, rss);
MSG("STAGE 1\n");
MSG("My memory usage is VM = %.1f MB RSS = %.1f MB\n", vm, rss);
mpi::globalAdd(vm);
mpi::globalAdd(rss);
MSG("Overall memory usage is VM = %.1f MB RSS = %.1f MB\n", vm, rss);
#endif
if
(
createMatrixData
)
{
if
(
createMatrixData
)
{
petscSolver
->
setMeshDistributor
(
meshDistributor
,
petscSolver
->
setMeshDistributor
(
meshDistributor
,
meshDistributor
->
getMpiComm
(),
meshDistributor
->
getMpiComm
(),
...
@@ -96,6 +106,15 @@ namespace AMDiS {
...
@@ -96,6 +106,15 @@ namespace AMDiS {
petscSolver
->
fillPetscRhs
(
rhs
);
petscSolver
->
fillPetscRhs
(
rhs
);
#if 0
processMemUsage(vm, rss);
MSG("STAGE 2\n");
MSG("My memory usage is VM = %.1f MB RSS = %.1f MB\n", vm, rss);
mpi::globalAdd(vm);
mpi::globalAdd(rss);
MSG("Overall memory usage is VM = %.1f MB RSS = %.1f MB\n", vm, rss);
#endif
petscSolver
->
solvePetscMatrix
(
*
solution
,
adaptInfo
);
petscSolver
->
solvePetscMatrix
(
*
solution
,
adaptInfo
);
petscSolver
->
destroyVectorData
();
petscSolver
->
destroyVectorData
();
...
@@ -103,6 +122,15 @@ namespace AMDiS {
...
@@ -103,6 +122,15 @@ namespace AMDiS {
if
(
!
storeMatrixData
)
if
(
!
storeMatrixData
)
petscSolver
->
destroyMatrixData
();
petscSolver
->
destroyMatrixData
();
#if 0
processMemUsage(vm, rss);
MSG("STAGE 3\n");
MSG("My memory usage is VM = %.1f MB RSS = %.1f MB\n", vm, rss);
mpi::globalAdd(vm);
mpi::globalAdd(rss);
MSG("Overall memory usage is VM = %.1f MB RSS = %.1f MB\n", vm, rss);
#endif
INFO
(
info
,
8
)(
"solution of discrete system needed %.5f seconds
\n
"
,
INFO
(
info
,
8
)(
"solution of discrete system needed %.5f seconds
\n
"
,
MPI
::
Wtime
()
-
wtime
);
MPI
::
Wtime
()
-
wtime
);
}
}
...
...
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
View file @
1e7a784a
...
@@ -450,9 +450,16 @@ namespace AMDiS {
...
@@ -450,9 +450,16 @@ namespace AMDiS {
MatDestroy
(
&
matIntInt
);
MatDestroy
(
&
matIntInt
);
KSPDestroy
(
&
kspInterior
);
KSPDestroy
(
&
kspInterior
);
if
(
petscSolVec
!=
PETSC_NULL
)
if
(
coarseSpaceMap
)
{
MatDestroy
(
&
matCoarseCoarse
);
MatDestroy
(
&
matCoarseInt
);
MatDestroy
(
&
matIntCoarse
);
}
if
(
petscSolVec
!=
PETSC_NULL
)
{
VecDestroy
(
&
petscSolVec
);
VecDestroy
(
&
petscSolVec
);
petscSolVec
=
PETSC_NULL
;
petscSolVec
=
PETSC_NULL
;
}
}
}
...
@@ -461,6 +468,9 @@ namespace AMDiS {
...
@@ -461,6 +468,9 @@ namespace AMDiS {
FUNCNAME
(
"PetscSolverGlobalMatrix::destroyVectorData()"
);
FUNCNAME
(
"PetscSolverGlobalMatrix::destroyVectorData()"
);
VecDestroy
(
&
rhsInterior
);
VecDestroy
(
&
rhsInterior
);
if
(
coarseSpaceMap
)
VecDestroy
(
&
rhsCoarseSpace
);
}
}
...
@@ -702,22 +712,26 @@ namespace AMDiS {
...
@@ -702,22 +712,26 @@ namespace AMDiS {
if
(
rankOnly
&&
!
(
*
interiorMap
)[
feSpace
].
isRankDof
(
dofIt
.
getDOFIndex
()))
if
(
rankOnly
&&
!
(
*
interiorMap
)[
feSpace
].
isRankDof
(
dofIt
.
getDOFIndex
()))
continue
;
continue
;
// Calculate global row index of the DOF.
if
(
coarseSpaceMap
&&
isCoarseSpace
(
feSpace
,
dofIt
.
getDOFIndex
()))
{
DegreeOfFreedom
globalRowDof
=
TEST_EXIT_DBG
(
vecCoarse
!=
PETSC_NULL
)(
"Should not happen!
\n
"
);
(
*
interiorMap
)[
feSpace
][
dofIt
.
getDOFIndex
()].
global
;
// Get PETSc's mat index of the row DOF.
int
index
=
coarseSpaceMap
->
getMatIndex
(
nRowVec
,
dofIt
.
getDOFIndex
());
int
index
=
0
;
VecSetValue
(
vecCoarse
,
index
,
*
dofIt
,
ADD_VALUES
);
if
(
interiorMap
->
isMatIndexFromGlobal
())
}
else
{
index
=
// Calculate global row index of the DOF.
interiorMap
->
getMatIndex
(
nRowVec
,
globalRowDof
)
+
rStartInterior
;
DegreeOfFreedom
globalRowDof
=
else
(
*
interiorMap
)[
feSpace
][
dofIt
.
getDOFIndex
()].
global
;
index
=
interiorMap
->
getMatIndex
(
nRowVec
,
dofIt
.
getDOFIndex
())
+
rStartInterior
;
// Get PETSc's mat index of the row DOF.
int
index
=
0
;
if
(
perMap
.
isPeriodic
(
feSpace
,
globalRowDof
))
{
if
(
interiorMap
->
isMatIndexFromGlobal
())
if
(
coarseSpaceMap
&&
isCoarseSpace
(
feSpace
,
dofIt
.
getDOFIndex
()))
{
index
=
ERROR_EXIT
(
"Periodic coarse space not yet supported!
\n
"
);
interiorMap
->
getMatIndex
(
nRowVec
,
globalRowDof
)
+
rStartInterior
;
}
else
{
else
index
=
interiorMap
->
getMatIndex
(
nRowVec
,
dofIt
.
getDOFIndex
())
+
rStartInterior
;
if
(
perMap
.
isPeriodic
(
feSpace
,
globalRowDof
))
{
std
::
set
<
int
>&
perAsc
=
perMap
.
getAssociations
(
feSpace
,
globalRowDof
);
std
::
set
<
int
>&
perAsc
=
perMap
.
getAssociations
(
feSpace
,
globalRowDof
);
double
value
=
*
dofIt
/
(
perAsc
.
size
()
+
1.0
);
double
value
=
*
dofIt
/
(
perAsc
.
size
()
+
1.0
);
VecSetValue
(
vecInterior
,
index
,
value
,
ADD_VALUES
);
VecSetValue
(
vecInterior
,
index
,
value
,
ADD_VALUES
);
...
@@ -727,17 +741,10 @@ namespace AMDiS {
...
@@ -727,17 +741,10 @@ namespace AMDiS {
int
mappedDof
=
perMap
.
map
(
feSpace
,
*
perIt
,
globalRowDof
);
int
mappedDof
=
perMap
.
map
(
feSpace
,
*
perIt
,
globalRowDof
);
int
mappedIndex
=
interiorMap
->
getMatIndex
(
nRowVec
,
mappedDof
);
int
mappedIndex
=
interiorMap
->
getMatIndex
(
nRowVec
,
mappedDof
);
VecSetValue
(
vecInterior
,
mappedIndex
,
value
,
ADD_VALUES
);
VecSetValue
(
vecInterior
,
mappedIndex
,
value
,
ADD_VALUES
);
}
}
}
}
else
{
}
else
{
// The DOF index is not periodic.
// The DOF index is not periodic.
if
(
coarseSpaceMap
&&
isCoarseSpace
(
feSpace
,
dofIt
.
getDOFIndex
()))
{
TEST_EXIT_DBG
(
vecCoarse
!=
PETSC_NULL
)(
"Should not happen!
\n
"
);
index
=
coarseSpaceMap
->
getMatIndex
(
nRowVec
,
dofIt
.
getDOFIndex
());
VecSetValue
(
vecCoarse
,
index
,
*
dofIt
,
ADD_VALUES
);
}
else
{
VecSetValue
(
vecInterior
,
index
,
*
dofIt
,
ADD_VALUES
);
VecSetValue
(
vecInterior
,
index
,
*
dofIt
,
ADD_VALUES
);
}
}
}
}
...
...
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