Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
36b70253
Commit
36b70253
authored
Oct 29, 2012
by
Thomas Witkowski
Browse files
blub bla
parent
8a4eba87
Changes
5
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/DOFMatrix.cc
View file @
36b70253
...
@@ -534,12 +534,10 @@ namespace AMDiS {
...
@@ -534,12 +534,10 @@ namespace AMDiS {
// Do the following only in sequential code. In parallel mode, the specific
// Do the following only in sequential code. In parallel mode, the specific
// solver method must care about dirichlet boundary conditions.
// solver method must care about dirichlet boundary conditions.
#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
inserter_type
&
ins
=
*
inserter
;
inserter_type
&
ins
=
*
inserter
;
for
(
std
::
set
<
int
>::
iterator
it
=
dirichletDofs
.
begin
();
for
(
std
::
set
<
int
>::
iterator
it
=
dirichletDofs
.
begin
();
it
!=
dirichletDofs
.
end
();
++
it
)
it
!=
dirichletDofs
.
end
();
++
it
)
ins
[
*
it
][
*
it
]
=
1.0
;
ins
[
*
it
][
*
it
]
=
1.0
;
#endif
}
}
...
...
AMDiS/src/Element.h
View file @
36b70253
...
@@ -438,9 +438,6 @@ namespace AMDiS {
...
@@ -438,9 +438,6 @@ namespace AMDiS {
bool
baseDofPtr
=
false
,
bool
baseDofPtr
=
false
,
vector
<
GeoIndex
>*
dofGeoIndex
=
NULL
)
const
=
0
;
vector
<
GeoIndex
>*
dofGeoIndex
=
NULL
)
const
=
0
;
virtual
void
getSubBoundary
(
BoundaryObject
bound
,
vector
<
BoundaryObject
>
&
subBound
)
const
=
0
;
/// Combines \ref getNodeDofs and \ref getHigherOrderDofs to one function.
/// Combines \ref getNodeDofs and \ref getHigherOrderDofs to one function.
/// See parameter description there.
/// See parameter description there.
void
getAllDofs
(
const
FiniteElemSpace
*
feSpace
,
void
getAllDofs
(
const
FiniteElemSpace
*
feSpace
,
...
@@ -449,6 +446,8 @@ namespace AMDiS {
...
@@ -449,6 +446,8 @@ namespace AMDiS {
bool
baseDofPtr
=
false
,
bool
baseDofPtr
=
false
,
vector
<
GeoIndex
>*
dofGeoIndex
=
NULL
);
vector
<
GeoIndex
>*
dofGeoIndex
=
NULL
);
virtual
void
getSubBoundary
(
BoundaryObject
bound
,
vector
<
BoundaryObject
>
&
subBound
)
const
=
0
;
/** \} */
/** \} */
...
...
AMDiS/src/Tetrahedron.cc
View file @
36b70253
...
@@ -345,8 +345,6 @@ namespace AMDiS {
...
@@ -345,8 +345,6 @@ namespace AMDiS {
{
{
FUNCNAME
(
"Tetrahedron::getHigherOrderDofs()"
);
FUNCNAME
(
"Tetrahedron::getHigherOrderDofs()"
);
TEST_EXIT
(
dofGeoIndex
!=
NULL
)(
"Not yet implemented!
\n
"
);
switch
(
bound
.
subObj
)
{
switch
(
bound
.
subObj
)
{
case
VERTEX
:
case
VERTEX
:
return
;
return
;
...
@@ -394,14 +392,20 @@ namespace AMDiS {
...
@@ -394,14 +392,20 @@ namespace AMDiS {
if
(
baseDofPtr
)
{
if
(
baseDofPtr
)
{
do
{
do
{
if
(
elDofIter
.
getCurrentPos
()
==
1
&&
if
(
elDofIter
.
getCurrentPos
()
==
1
&&
elDofIter
.
getCurrentElementPos
()
==
bound
.
ithObj
)
elDofIter
.
getCurrentElementPos
()
==
bound
.
ithObj
)
{
dofs
.
push_back
(
elDofIter
.
getBaseDof
());
dofs
.
push_back
(
elDofIter
.
getBaseDof
());
if
(
dofGeoIndex
!=
NULL
)
dofGeoIndex
->
push_back
(
EDGE
);
}
}
while
(
elDofIter
.
nextStrict
());
}
while
(
elDofIter
.
nextStrict
());
}
else
{
}
else
{
do
{
do
{
if
(
elDofIter
.
getCurrentPos
()
==
1
&&
if
(
elDofIter
.
getCurrentPos
()
==
1
&&
elDofIter
.
getCurrentElementPos
()
==
bound
.
ithObj
)
elDofIter
.
getCurrentElementPos
()
==
bound
.
ithObj
)
{
dofs
.
push_back
(
elDofIter
.
getDofPtr
());
dofs
.
push_back
(
elDofIter
.
getDofPtr
());
if
(
dofGeoIndex
!=
NULL
)
dofGeoIndex
->
push_back
(
EDGE
);
}
}
while
(
elDofIter
.
next
());
}
while
(
elDofIter
.
next
());
}
}
}
}
...
@@ -432,21 +436,27 @@ namespace AMDiS {
...
@@ -432,21 +436,27 @@ namespace AMDiS {
baseDofPtr
,
dofGeoIndex
);
baseDofPtr
,
dofGeoIndex
);
}
}
}
else
{
}
else
{
ElementDofIterator
elDofIter
(
feSpace
,
true
);
ElementDofIterator
elDofIter
(
feSpace
,
true
);
elDofIter
.
reset
(
this
);
elDofIter
.
reset
(
this
);
if
(
baseDofPtr
)
{
if
(
baseDofPtr
)
{
do
{
do
{
if
(
elDofIter
.
getCurrentPos
()
=
=
2
&&
if
(
elDofIter
.
getCurrentPos
()
>
=
1
&&
elDofIter
.
getCurrentElementPos
()
==
bound
.
ithObj
)
elDofIter
.
getCurrentElementPos
()
==
bound
.
ithObj
)
dofs
.
push_back
(
elDofIter
.
getBaseDof
());
dofs
.
push_back
(
elDofIter
.
getBaseDof
());
if
(
dofGeoIndex
!=
NULL
)
dofGeoIndex
->
push_back
(
elDofIter
.
getPosIndex
());
}
while
(
elDofIter
.
nextStrict
());
}
while
(
elDofIter
.
nextStrict
());
}
else
{
}
else
{
do
{
do
{
if
(
elDofIter
.
getCurrentPos
()
=
=
2
&&
if
(
elDofIter
.
getCurrentPos
()
>
=
1
&&
elDofIter
.
getCurrentElementPos
()
==
bound
.
ithObj
)
elDofIter
.
getCurrentElementPos
()
==
bound
.
ithObj
)
dofs
.
push_back
(
elDofIter
.
getDofPtr
());
dofs
.
push_back
(
elDofIter
.
getDofPtr
());
if
(
dofGeoIndex
!=
NULL
)
dofGeoIndex
->
push_back
(
elDofIter
.
getPosIndex
());
}
while
(
elDofIter
.
next
());
}
while
(
elDofIter
.
next
());
}
}
}
}
}
}
break
;
break
;
...
...
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
View file @
36b70253
...
@@ -65,7 +65,7 @@ namespace AMDiS {
...
@@ -65,7 +65,7 @@ namespace AMDiS {
matAssembly
();
matAssembly
();
removeDirichletRows
(
seqMat
);
//
removeDirichletRows(seqMat);
if
(
printMatInfo
)
{
if
(
printMatInfo
)
{
MatInfo
matInfo
;
MatInfo
matInfo
;
...
@@ -143,6 +143,8 @@ namespace AMDiS {
...
@@ -143,6 +143,8 @@ namespace AMDiS {
ParallelDofMapping
*
rowCoarseSpace
=
coarseSpaceMap
[
rowComponent
];
ParallelDofMapping
*
rowCoarseSpace
=
coarseSpaceMap
[
rowComponent
];
ParallelDofMapping
*
colCoarseSpace
=
coarseSpaceMap
[
colComponent
];
ParallelDofMapping
*
colCoarseSpace
=
coarseSpaceMap
[
colComponent
];
std
::
set
<
DegreeOfFreedom
>
&
dirichletRows
=
dofMat
->
getDirichletRows
();
traits
::
col
<
Matrix
>::
type
col
(
dofMat
->
getBaseMatrix
());
traits
::
col
<
Matrix
>::
type
col
(
dofMat
->
getBaseMatrix
());
traits
::
const_value
<
Matrix
>::
type
value
(
dofMat
->
getBaseMatrix
());
traits
::
const_value
<
Matrix
>::
type
value
(
dofMat
->
getBaseMatrix
());
...
@@ -151,6 +153,14 @@ namespace AMDiS {
...
@@ -151,6 +153,14 @@ namespace AMDiS {
cend
=
end
<
row
>
(
dofMat
->
getBaseMatrix
());
cursor
!=
cend
;
++
cursor
)
{
cend
=
end
<
row
>
(
dofMat
->
getBaseMatrix
());
cursor
!=
cend
;
++
cursor
)
{
bool
isRowCoarse
=
isCoarseSpace
(
rowComponent
,
*
cursor
);
bool
isRowCoarse
=
isCoarseSpace
(
rowComponent
,
*
cursor
);
// For the case, this is a dirichlet row we have to check whether the
// rank is also owner of this row DOF.
if
(
dirichletRows
.
count
(
*
cursor
))
{
if
((
!
isRowCoarse
&&
!
(
*
interiorMap
)[
rowComponent
].
isRankDof
(
*
cursor
))
||
(
isRowCoarse
&&
!
(
*
rowCoarseSpace
)[
rowComponent
].
isRankDof
(
*
cursor
)))
continue
;
}
cols
.
clear
();
cols
.
clear
();
colsOther
.
clear
();
colsOther
.
clear
();
...
@@ -236,7 +246,7 @@ namespace AMDiS {
...
@@ -236,7 +246,7 @@ namespace AMDiS {
matAssembly
();
matAssembly
();
removeDirichletRows
(
seqMat
);
//
removeDirichletRows(seqMat);
// === Create solver for the non primal (thus local) variables. ===
// === Create solver for the non primal (thus local) variables. ===
...
@@ -279,7 +289,7 @@ namespace AMDiS {
...
@@ -279,7 +289,7 @@ namespace AMDiS {
vecRhsAssembly
();
vecRhsAssembly
();
removeDirichletRows
(
vec
);
//
removeDirichletRows(vec);
// === For debugging allow to write the rhs vector to a file. ===
// === For debugging allow to write the rhs vector to a file. ===
...
@@ -575,6 +585,15 @@ namespace AMDiS {
...
@@ -575,6 +585,15 @@ namespace AMDiS {
}
}
if
(
hasCoarseSpace
())
{
if
(
hasCoarseSpace
())
{
MatZeroRows
(
getMatInteriorCoarse
(
0
),
dRowsInterior
.
size
(),
&
(
dRowsInterior
[
0
]),
0.0
,
PETSC_NULL
,
PETSC_NULL
);
MatZeroRows
(
getMatInteriorCoarse
(
1
),
dRowsInterior
.
size
(),
&
(
dRowsInterior
[
0
]),
0.0
,
PETSC_NULL
,
PETSC_NULL
);
MatZeroRows
(
getMatCoarseInterior
(
0
),
dRowsCoarse
.
size
(),
&
(
dRowsCoarse
[
0
]),
0.0
,
PETSC_NULL
,
PETSC_NULL
);
Mat
mpiMat
=
getMatCoarse
();
Mat
mpiMat
=
getMatCoarse
();
MatZeroRows
(
mpiMat
,
dRowsCoarse
.
size
(),
&
(
dRowsCoarse
[
0
]),
0.0
,
MatZeroRows
(
mpiMat
,
dRowsCoarse
.
size
(),
&
(
dRowsCoarse
[
0
]),
0.0
,
PETSC_NULL
,
PETSC_NULL
);
PETSC_NULL
,
PETSC_NULL
);
...
@@ -745,7 +764,7 @@ namespace AMDiS {
...
@@ -745,7 +764,7 @@ namespace AMDiS {
void
PetscSolverGlobalMatrix
::
setDofMatrix
(
DOFMatrix
*
seqMat
,
void
PetscSolverGlobalMatrix
::
setDofMatrix
(
DOFMatrix
*
seqMat
,
int
nRowMat
,
int
nColMat
)
int
rowComp
,
int
colComp
)
{
{
FUNCNAME
(
"PetscSolverGlobalMatrix::setDofMatrix()"
);
FUNCNAME
(
"PetscSolverGlobalMatrix::setDofMatrix()"
);
...
@@ -770,7 +789,8 @@ namespace AMDiS {
...
@@ -770,7 +789,8 @@ namespace AMDiS {
// Get periodic mapping object
// Get periodic mapping object
PeriodicMap
&
perMap
=
meshDistributor
->
getPeriodicMap
();
PeriodicMap
&
perMap
=
meshDistributor
->
getPeriodicMap
();
std
::
set
<
DegreeOfFreedom
>
&
dirichletRows
=
seqMat
->
getDirichletRows
();
const
FiniteElemSpace
*
rowFe
=
seqMat
->
getRowFeSpace
();
const
FiniteElemSpace
*
rowFe
=
seqMat
->
getRowFeSpace
();
const
FiniteElemSpace
*
colFe
=
seqMat
->
getColFeSpace
();
const
FiniteElemSpace
*
colFe
=
seqMat
->
getColFeSpace
();
...
@@ -781,7 +801,7 @@ namespace AMDiS {
...
@@ -781,7 +801,7 @@ namespace AMDiS {
cend
=
end
<
row
>
(
seqMat
->
getBaseMatrix
());
cursor
!=
cend
;
++
cursor
)
{
cend
=
end
<
row
>
(
seqMat
->
getBaseMatrix
());
cursor
!=
cend
;
++
cursor
)
{
// Global index of the current row DOF.
// Global index of the current row DOF.
MultiIndex
rowMultiIndex
;
MultiIndex
rowMultiIndex
;
if
((
*
interiorMap
)[
nRowMat
].
find
(
*
cursor
,
rowMultiIndex
)
==
false
)
if
((
*
interiorMap
)[
rowComp
].
find
(
*
cursor
,
rowMultiIndex
)
==
false
)
continue
;
continue
;
int
globalRowDof
=
rowMultiIndex
.
global
;
int
globalRowDof
=
rowMultiIndex
.
global
;
...
@@ -789,11 +809,15 @@ namespace AMDiS {
...
@@ -789,11 +809,15 @@ namespace AMDiS {
// Test if the current row DOF is a periodic DOF.
// Test if the current row DOF is a periodic DOF.
bool
periodicRow
=
perMap
.
isPeriodic
(
rowFe
,
globalRowDof
);
bool
periodicRow
=
perMap
.
isPeriodic
(
rowFe
,
globalRowDof
);
// Dirichlet rows can be set only be the owner ranks.
if
(
dirichletRows
.
count
(
*
cursor
)
&&
!
((
*
interiorMap
)[
rowComp
].
isRankDof
(
*
cursor
)))
continue
;
if
(
!
periodicRow
)
{
if
(
!
periodicRow
)
{
// === Row DOF index is not periodic. ===
// === Row DOF index is not periodic. ===
// Get PETSc's mat row index.
// Get PETSc's mat row index.
int
rowIndex
=
interiorMap
->
getMatIndex
(
nRowMat
,
globalRowDof
);
int
rowIndex
=
interiorMap
->
getMatIndex
(
rowComp
,
globalRowDof
);
cols
.
clear
();
cols
.
clear
();
values
.
clear
();
values
.
clear
();
...
@@ -803,14 +827,14 @@ namespace AMDiS {
...
@@ -803,14 +827,14 @@ namespace AMDiS {
// Global index of the current column index.
// Global index of the current column index.
MultiIndex
colMultiIndex
;
MultiIndex
colMultiIndex
;
if
((
*
interiorMap
)[
nColMat
].
find
(
col
(
*
icursor
),
colMultiIndex
)
==
false
)
if
((
*
interiorMap
)[
colComp
].
find
(
col
(
*
icursor
),
colMultiIndex
)
==
false
)
continue
;
continue
;
int
globalColDof
=
colMultiIndex
.
global
;
int
globalColDof
=
colMultiIndex
.
global
;
// Test if the current col dof is a periodic dof.
// Test if the current col dof is a periodic dof.
bool
periodicCol
=
perMap
.
isPeriodic
(
colFe
,
globalColDof
);
bool
periodicCol
=
perMap
.
isPeriodic
(
colFe
,
globalColDof
);
// Get PETSc's mat col index.
// Get PETSc's mat col index.
int
colIndex
=
interiorMap
->
getMatIndex
(
nColMat
,
globalColDof
);
int
colIndex
=
interiorMap
->
getMatIndex
(
colComp
,
globalColDof
);
// Ignore all zero entries, expect it is a diagonal entry.
// Ignore all zero entries, expect it is a diagonal entry.
if
(
value
(
*
icursor
)
==
0.0
&&
rowIndex
!=
colIndex
)
if
(
value
(
*
icursor
)
==
0.0
&&
rowIndex
!=
colIndex
)
...
@@ -839,7 +863,7 @@ namespace AMDiS {
...
@@ -839,7 +863,7 @@ namespace AMDiS {
vector
<
int
>
newCols
;
vector
<
int
>
newCols
;
perMap
.
mapDof
(
colFe
,
globalColDof
,
perAsc
,
newCols
);
perMap
.
mapDof
(
colFe
,
globalColDof
,
perAsc
,
newCols
);
for
(
unsigned
int
i
=
0
;
i
<
newCols
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
newCols
.
size
();
i
++
)
{
cols
.
push_back
(
interiorMap
->
getMatIndex
(
nColMat
,
newCols
[
i
]));
cols
.
push_back
(
interiorMap
->
getMatIndex
(
colComp
,
newCols
[
i
]));
values
.
push_back
(
scaledValue
);
values
.
push_back
(
scaledValue
);
}
}
}
}
...
@@ -861,7 +885,7 @@ namespace AMDiS {
...
@@ -861,7 +885,7 @@ namespace AMDiS {
for
(
icursor_type
icursor
=
begin
<
nz
>
(
cursor
),
icend
=
end
<
nz
>
(
cursor
);
for
(
icursor_type
icursor
=
begin
<
nz
>
(
cursor
),
icend
=
end
<
nz
>
(
cursor
);
icursor
!=
icend
;
++
icursor
)
{
icursor
!=
icend
;
++
icursor
)
{
// Global index of the current column index.
// Global index of the current column index.
int
globalColDof
=
(
*
interiorMap
)[
nColMat
][
col
(
*
icursor
)].
global
;
int
globalColDof
=
(
*
interiorMap
)[
colComp
][
col
(
*
icursor
)].
global
;
// Ignore all zero entries, expect it is a diagonal entry.
// Ignore all zero entries, expect it is a diagonal entry.
if
(
value
(
*
icursor
)
==
0.0
&&
globalRowDof
!=
globalColDof
)
if
(
value
(
*
icursor
)
==
0.0
&&
globalRowDof
!=
globalColDof
)
...
@@ -891,8 +915,8 @@ namespace AMDiS {
...
@@ -891,8 +915,8 @@ namespace AMDiS {
// === Translate the matrix entries to PETSc's matrix.
// === Translate the matrix entries to PETSc's matrix.
for
(
unsigned
int
i
=
0
;
i
<
entry
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
entry
.
size
();
i
++
)
{
int
rowIdx
=
interiorMap
->
getMatIndex
(
nRowMat
,
entry
[
i
].
first
);
int
rowIdx
=
interiorMap
->
getMatIndex
(
rowComp
,
entry
[
i
].
first
);
int
colIdx
=
interiorMap
->
getMatIndex
(
nColMat
,
entry
[
i
].
second
);
int
colIdx
=
interiorMap
->
getMatIndex
(
colComp
,
entry
[
i
].
second
);
colsMap
[
rowIdx
].
push_back
(
colIdx
);
colsMap
[
rowIdx
].
push_back
(
colIdx
);
valsMap
[
rowIdx
].
push_back
(
scaledValue
);
valsMap
[
rowIdx
].
push_back
(
scaledValue
);
...
@@ -920,7 +944,7 @@ namespace AMDiS {
...
@@ -920,7 +944,7 @@ namespace AMDiS {
void
PetscSolverGlobalMatrix
::
setDofVector
(
Vec
vecInterior
,
void
PetscSolverGlobalMatrix
::
setDofVector
(
Vec
vecInterior
,
Vec
vecCoarse
,
Vec
vecCoarse
,
DOFVector
<
double
>*
vec
,
DOFVector
<
double
>*
vec
,
int
nRowVec
,
int
rowComp
,
bool
rankOnly
)
bool
rankOnly
)
{
{
FUNCNAME
(
"PetscSolverGlobalMatrix::setDofVector()"
);
FUNCNAME
(
"PetscSolverGlobalMatrix::setDofVector()"
);
...
@@ -929,36 +953,43 @@ namespace AMDiS {
...
@@ -929,36 +953,43 @@ namespace AMDiS {
PeriodicMap
&
perMap
=
meshDistributor
->
getPeriodicMap
();
PeriodicMap
&
perMap
=
meshDistributor
->
getPeriodicMap
();
ParallelDofMapping
*
rowCoarseSpace
=
ParallelDofMapping
*
rowCoarseSpace
=
(
coarseSpaceMap
.
size
()
?
coarseSpaceMap
[
nRowVec
]
:
NULL
);
(
coarseSpaceMap
.
size
()
?
coarseSpaceMap
[
rowComp
]
:
NULL
);
map
<
DegreeOfFreedom
,
double
>
&
dirichletValues
=
vec
->
getDirichletValues
();
// Traverse all used DOFs in the dof vector.
// Traverse all used DOFs in the dof vector.
DOFVector
<
double
>::
Iterator
dofIt
(
vec
,
USED_DOFS
);
DOFVector
<
double
>::
Iterator
dofIt
(
vec
,
USED_DOFS
);
for
(
dofIt
.
reset
();
!
dofIt
.
end
();
++
dofIt
)
{
for
(
dofIt
.
reset
();
!
dofIt
.
end
();
++
dofIt
)
{
DegreeOfFreedom
dof
=
dofIt
.
getDOFIndex
();
if
(
rankOnly
&&
!
(
*
interiorMap
)[
rowComp
].
isRankDof
(
dof
))
continue
;
if
(
rankOnly
&&
!
(
*
interiorMap
)[
nRowVec
].
isRankDof
(
dofIt
.
getDOFIndex
()))
// Dirichlet rows can be set only be the owner ranks.
if
(
dirichletValues
.
count
(
dof
)
&&
!
((
*
interiorMap
)[
rowComp
].
isRankDof
(
dof
)))
continue
;
continue
;
if
(
isCoarseSpace
(
nRowVec
,
dofIt
.
getDOFIndex
()
))
{
if
(
isCoarseSpace
(
rowComp
,
dof
))
{
TEST_EXIT_DBG
(
vecCoarse
!=
PETSC_NULL
)(
"Should not happen!
\n
"
);
TEST_EXIT_DBG
(
vecCoarse
!=
PETSC_NULL
)(
"Should not happen!
\n
"
);
int
index
=
rowCoarseSpace
->
getMatIndex
(
nRowVec
,
dofIt
.
getDOFIndex
()
);
int
index
=
rowCoarseSpace
->
getMatIndex
(
rowComp
,
dof
);
VecSetValue
(
vecCoarse
,
index
,
*
dofIt
,
ADD_VALUES
);
VecSetValue
(
vecCoarse
,
index
,
*
dofIt
,
ADD_VALUES
);
}
else
{
}
else
{
if
((
*
interiorMap
)[
nRowVec
].
isSet
(
dof
It
.
getDOFIndex
()
)
==
false
)
if
((
*
interiorMap
)[
rowComp
].
isSet
(
dof
)
==
false
)
continue
;
continue
;
// Calculate global row index of the DOF.
// Calculate global row index of the DOF.
DegreeOfFreedom
globalRowDof
=
DegreeOfFreedom
globalRowDof
=
(
*
interiorMap
)[
rowComp
][
dof
].
global
;
(
*
interiorMap
)[
nRowVec
][
dofIt
.
getDOFIndex
()].
global
;
// Get PETSc's mat index of the row DOF.
// Get PETSc's mat index of the row DOF.
int
index
=
0
;
int
index
=
0
;
if
(
interiorMap
->
isMatIndexFromGlobal
())
if
(
interiorMap
->
isMatIndexFromGlobal
())
index
=
index
=
interiorMap
->
getMatIndex
(
nRowVec
,
globalRowDof
)
+
rStartInterior
;
interiorMap
->
getMatIndex
(
rowComp
,
globalRowDof
)
+
rStartInterior
;
else
else
index
=
index
=
interiorMap
->
getMatIndex
(
nRowVec
,
dofIt
.
getDOFIndex
()
)
+
rStartInterior
;
interiorMap
->
getMatIndex
(
rowComp
,
dof
)
+
rStartInterior
;
if
(
perMap
.
isPeriodic
(
feSpace
,
globalRowDof
))
{
if
(
perMap
.
isPeriodic
(
feSpace
,
globalRowDof
))
{
std
::
set
<
int
>&
perAsc
=
perMap
.
getAssociations
(
feSpace
,
globalRowDof
);
std
::
set
<
int
>&
perAsc
=
perMap
.
getAssociations
(
feSpace
,
globalRowDof
);
...
@@ -968,7 +999,7 @@ namespace AMDiS {
...
@@ -968,7 +999,7 @@ namespace AMDiS {
for
(
std
::
set
<
int
>::
iterator
perIt
=
perAsc
.
begin
();
for
(
std
::
set
<
int
>::
iterator
perIt
=
perAsc
.
begin
();
perIt
!=
perAsc
.
end
();
++
perIt
)
{
perIt
!=
perAsc
.
end
();
++
perIt
)
{
int
mappedDof
=
perMap
.
map
(
feSpace
,
*
perIt
,
globalRowDof
);
int
mappedDof
=
perMap
.
map
(
feSpace
,
*
perIt
,
globalRowDof
);
int
mappedIndex
=
interiorMap
->
getMatIndex
(
nRowVec
,
mappedDof
);
int
mappedIndex
=
interiorMap
->
getMatIndex
(
rowComp
,
mappedDof
);
VecSetValue
(
vecInterior
,
mappedIndex
,
value
,
ADD_VALUES
);
VecSetValue
(
vecInterior
,
mappedIndex
,
value
,
ADD_VALUES
);
}
}
...
...
AMDiS/src/parallel/PetscSolverGlobalMatrix.h
View file @
36b70253
...
@@ -94,19 +94,21 @@ namespace AMDiS {
...
@@ -94,19 +94,21 @@ namespace AMDiS {
virtual
void
exitPreconditioner
(
PC
pc
);
virtual
void
exitPreconditioner
(
PC
pc
);
/// Takes a DOF matrix and sends the values to the global PETSc matrix.
/// Takes a DOF matrix and sends the values to the global PETSc matrix.
void
setDofMatrix
(
DOFMatrix
*
mat
,
int
nRowMat
=
0
,
int
nColMat
=
0
);
void
setDofMatrix
(
DOFMatrix
*
mat
,
int
rowComp
=
0
,
int
colComp
=
0
);
/// Takes a DOF vector and sends its values to a given PETSc vector.
/// Takes a DOF vector and sends its values to a given PETSc vector.
void
setDofVector
(
Vec
vecInterior
,
void
setDofVector
(
Vec
vecInterior
,
Vec
vecCoarse
,
Vec
vecCoarse
,
DOFVector
<
double
>*
vec
,
DOFVector
<
double
>*
vec
,
int
nRowVec
,
bool
rankOnly
=
false
);
int
rowCompxo
,
bool
rankOnly
=
false
);
inline
void
setDofVector
(
Vec
vecInterior
,
inline
void
setDofVector
(
Vec
vecInterior
,
DOFVector
<
double
>*
vec
,
DOFVector
<
double
>*
vec
,
int
nRowVec
,
bool
rankOnly
=
false
)
int
rowComp
,
bool
rankOnly
=
false
)
{
{
setDofVector
(
vecInterior
,
PETSC_NULL
,
vec
,
nRowVec
,
rankOnly
);
setDofVector
(
vecInterior
,
PETSC_NULL
,
vec
,
rowComp
,
rankOnly
);
}
}
inline
void
setDofVector
(
Vec
vecInterior
,
inline
void
setDofVector
(
Vec
vecInterior
,
...
...
Write
Preview
Supports
Markdown
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