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
bfa16bad
Commit
bfa16bad
authored
Mar 29, 2010
by
Thomas Witkowski
Browse files
Changed concept of local indices computation.
parent
3725bbeb
Changes
26
Hide whitespace changes
Inline
Side-by-side
AMDiS/other/include/Makefile_AMDiS.mk
View file @
bfa16bad
...
@@ -97,7 +97,7 @@ endif
...
@@ -97,7 +97,7 @@ endif
# ============================================================================
# ============================================================================
ifeq
($(strip $(DEBUG)), 0)
ifeq
($(strip $(DEBUG)), 0)
CPPFLAGS
+=
-O
2
CPPFLAGS
+=
-O
3
else
else
CPPFLAGS
+=
-g
-O0
CPPFLAGS
+=
-g
-O0
endif
endif
...
...
AMDiS/src/Assembler.cc
View file @
bfa16bad
...
@@ -252,12 +252,11 @@ namespace AMDiS {
...
@@ -252,12 +252,11 @@ namespace AMDiS {
{
{
FUNCNAME
(
"Assembler::matVecAssemble()"
);
FUNCNAME
(
"Assembler::matVecAssemble()"
);
Element
*
el
=
elInfo
->
getElement
();
double
*
uhOldLoc
=
new
double
[
nRow
];
double
*
uhOldLoc
=
new
double
[
nRow
];
operat
->
uhOld
->
getLocalVector
(
el
,
uhOldLoc
);
operat
->
uhOld
->
getLocalVector
(
el
Info
,
uhOldLoc
);
if
(
el
!=
lastMatEl
)
{
if
(
el
Info
->
getElement
()
!=
lastMatEl
)
{
set_to_zero
(
elementMatrix
);
set_to_zero
(
elementMatrix
);
calculateElementMatrix
(
elInfo
,
elementMatrix
);
calculateElementMatrix
(
elInfo
,
elementMatrix
);
}
}
...
...
AMDiS/src/BasisFunction.h
View file @
bfa16bad
...
@@ -275,7 +275,7 @@ namespace AMDiS {
...
@@ -275,7 +275,7 @@ namespace AMDiS {
virtual
void
coarseRestr
(
DOFVector
<
WorldVector
<
double
>
>*
,
RCNeighbourList
*
,
int
)
virtual
void
coarseRestr
(
DOFVector
<
WorldVector
<
double
>
>*
,
RCNeighbourList
*
,
int
)
{}
{}
/// Returns local dof indices of the element for the given
fe space
.
/// Returns local dof indices of the element for the given
DOF admin
.
virtual
const
DegreeOfFreedom
*
getLocalIndices
(
const
Element
*
el
,
virtual
const
DegreeOfFreedom
*
getLocalIndices
(
const
Element
*
el
,
const
DOFAdmin
*
admin
,
const
DOFAdmin
*
admin
,
DegreeOfFreedom
*
dofPtr
)
const
DegreeOfFreedom
*
dofPtr
)
const
...
@@ -283,17 +283,11 @@ namespace AMDiS {
...
@@ -283,17 +283,11 @@ namespace AMDiS {
return
NULL
;
return
NULL
;
}
}
inline
void
getLocalIndices
(
const
Element
*
el
,
/// Calculates local dof indices of the element for the given DOF admin.
const
DOFAdmin
*
admin
,
virtual
void
getLocalIndices
(
const
Element
*
el
,
std
::
vector
<
DegreeOfFreedom
>
&
indices
)
const
const
DOFAdmin
*
admin
,
{
std
::
vector
<
DegreeOfFreedom
>
&
indices
)
const
FUNCNAME
(
"BasisFunction::getLocalIndices()"
);
{}
TEST_EXIT_DBG
(
static_cast
<
int
>
(
indices
.
size
())
>=
nBasFcts
)
(
"Index vector is too small!
\n
"
);
getLocalIndices
(
el
,
admin
,
&
(
indices
[
0
]));
}
virtual
void
getLocalDofPtrVec
(
const
Element
*
el
,
virtual
void
getLocalDofPtrVec
(
const
Element
*
el
,
const
DOFAdmin
*
admin
,
const
DOFAdmin
*
admin
,
...
...
AMDiS/src/BoundaryManager.cc
View file @
bfa16bad
...
@@ -15,7 +15,6 @@ namespace AMDiS {
...
@@ -15,7 +15,6 @@ namespace AMDiS {
BoundaryManager
::
BoundaryManager
(
const
FiniteElemSpace
*
feSpace
)
BoundaryManager
::
BoundaryManager
(
const
FiniteElemSpace
*
feSpace
)
{
{
localBounds
.
resize
(
omp_get_overall_max_threads
());
localBounds
.
resize
(
omp_get_overall_max_threads
());
dofIndices
.
resize
(
omp_get_overall_max_threads
());
allocatedMemoryLocalBounds
=
feSpace
->
getBasisFcts
()
->
getNumber
();
allocatedMemoryLocalBounds
=
feSpace
->
getBasisFcts
()
->
getNumber
();
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
localBounds
.
size
());
i
++
)
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
localBounds
.
size
());
i
++
)
localBounds
[
i
]
=
new
BoundaryType
[
allocatedMemoryLocalBounds
];
localBounds
[
i
]
=
new
BoundaryType
[
allocatedMemoryLocalBounds
];
...
@@ -26,7 +25,6 @@ namespace AMDiS {
...
@@ -26,7 +25,6 @@ namespace AMDiS {
localBCs
=
bm
.
localBCs
;
localBCs
=
bm
.
localBCs
;
allocatedMemoryLocalBounds
=
bm
.
allocatedMemoryLocalBounds
;
allocatedMemoryLocalBounds
=
bm
.
allocatedMemoryLocalBounds
;
localBounds
.
resize
(
bm
.
localBounds
.
size
());
localBounds
.
resize
(
bm
.
localBounds
.
size
());
dofIndices
.
resize
(
bm
.
localBounds
.
size
());
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
localBounds
.
size
());
i
++
)
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
localBounds
.
size
());
i
++
)
localBounds
[
i
]
=
new
BoundaryType
[
allocatedMemoryLocalBounds
];
localBounds
[
i
]
=
new
BoundaryType
[
allocatedMemoryLocalBounds
];
}
}
...
@@ -49,54 +47,61 @@ namespace AMDiS {
...
@@ -49,54 +47,61 @@ namespace AMDiS {
return
result
;
return
result
;
}
}
void
BoundaryManager
::
fillBoundaryConditions
(
ElInfo
*
elInfo
,
void
BoundaryManager
::
fillBoundaryConditions
(
ElInfo
*
elInfo
,
DOFVectorBase
<
double
>
*
vec
)
DOFVectorBase
<
double
>
*
vec
)
{
{
if
(
localBCs
.
size
()
>
0
)
{
FUNCNAME
(
"BoundaryManager::fillBoundaryConditions()"
);
const
FiniteElemSpace
*
feSpace
=
vec
->
getFESpace
();
std
::
vector
<
DegreeOfFreedom
>
&
dofVec
=
dofIndices
[
omp_get_thread_num
()];
if
(
localBCs
.
size
()
<=
0
)
const
BasisFunction
*
basisFcts
=
feSpace
->
getBasisFcts
();
return
;
int
nBasFcts
=
basisFcts
->
getNumber
();
dofVec
.
resize
(
nBasFcts
);
const
FiniteElemSpace
*
feSpace
=
vec
->
getFESpace
();
const
BasisFunction
*
basisFcts
=
feSpace
->
getBasisFcts
();
// get boundaries of all DOFs
int
nBasFcts
=
basisFcts
->
getNumber
();
BoundaryType
*
localBound
=
localBounds
[
omp_get_thread_num
()];
basisFcts
->
getBound
(
elInfo
,
localBound
);
// get boundaries of all DOFs
BoundaryType
*
localBound
=
localBounds
[
omp_get_thread_num
()];
// get dof indices
basisFcts
->
getBound
(
elInfo
,
localBound
);
basisFcts
->
getLocalIndices
(
elInfo
->
getElement
(),
feSpace
->
getAdmin
(),
dofVec
);
// get dof indices
// apply non dirichlet boundary conditions
std
::
vector
<
DegreeOfFreedom
>
&
dofVec
=
elInfo
->
getLocalIndices
(
feSpace
);
for
(
BoundaryIndexMap
::
iterator
it
=
localBCs
.
begin
();
it
!=
localBCs
.
end
();
++
it
)
TEST_EXIT_DBG
(
static_cast
<
int
>
(
dofVec
.
size
())
==
nBasFcts
)
if
((
*
it
).
second
&&
!
(
*
it
).
second
->
isDirichlet
())
(
"Local index vector is too small!
\n
"
);
(
*
it
).
second
->
fillBoundaryCondition
(
vec
,
elInfo
,
&
dofVec
[
0
],
localBound
,
nBasFcts
);
// apply non dirichlet boundary conditions
for
(
BoundaryIndexMap
::
iterator
it
=
localBCs
.
begin
();
it
!=
localBCs
.
end
();
++
it
)
// apply dirichlet boundary conditions
if
((
*
it
).
second
&&
!
(
*
it
).
second
->
isDirichlet
())
for
(
BoundaryIndexMap
::
iterator
it
=
localBCs
.
begin
();
it
!=
localBCs
.
end
();
++
it
)
(
*
it
).
second
->
fillBoundaryCondition
(
vec
,
elInfo
,
&
dofVec
[
0
],
if
((
*
it
).
second
&&
(
*
it
).
second
->
isDirichlet
())
localBound
,
nBasFcts
);
(
*
it
).
second
->
fillBoundaryCondition
(
vec
,
elInfo
,
&
dofVec
[
0
],
localBound
,
nBasFcts
);
// apply dirichlet boundary conditions
}
for
(
BoundaryIndexMap
::
iterator
it
=
localBCs
.
begin
();
it
!=
localBCs
.
end
();
++
it
)
if
((
*
it
).
second
&&
(
*
it
).
second
->
isDirichlet
())
(
*
it
).
second
->
fillBoundaryCondition
(
vec
,
elInfo
,
&
dofVec
[
0
],
localBound
,
nBasFcts
);
}
}
void
BoundaryManager
::
fillBoundaryConditions
(
ElInfo
*
elInfo
,
DOFMatrix
*
mat
)
void
BoundaryManager
::
fillBoundaryConditions
(
ElInfo
*
elInfo
,
DOFMatrix
*
mat
)
{
{
FUNCNAME
(
"BoundaryManager::fillBoundaryConditions()"
);
if
(
localBCs
.
size
()
<=
0
)
if
(
localBCs
.
size
()
<=
0
)
return
;
return
;
const
FiniteElemSpace
*
feSpace
=
mat
->
getRowFESpace
();
const
FiniteElemSpace
*
feSpace
=
mat
->
getRowFESpace
();
std
::
vector
<
DegreeOfFreedom
>
&
dofVec
=
dofIndices
[
omp_get_thread_num
()];
const
BasisFunction
*
basisFcts
=
feSpace
->
getBasisFcts
();
const
BasisFunction
*
basisFcts
=
feSpace
->
getBasisFcts
();
int
nBasFcts
=
basisFcts
->
getNumber
();
int
nBasFcts
=
basisFcts
->
getNumber
();
dofVec
.
resize
(
nBasFcts
);
// get boundaries of all DOFs
// get boundaries of all DOFs
BoundaryType
*
localBound
=
localBounds
[
omp_get_thread_num
()];
BoundaryType
*
localBound
=
localBounds
[
omp_get_thread_num
()];
basisFcts
->
getBound
(
elInfo
,
localBound
);
basisFcts
->
getBound
(
elInfo
,
localBound
);
// get dof indices
// get dof indices
basisFcts
->
getLocalIndices
(
elInfo
->
getElement
(),
feSpace
->
getAdmin
(),
dofVec
);
std
::
vector
<
DegreeOfFreedom
>
&
dofVec
=
elInfo
->
getLocalIndices
(
feSpace
);
TEST_EXIT_DBG
(
static_cast
<
int
>
(
dofVec
.
size
())
==
nBasFcts
)
(
"Local index vector is too small!
\n
"
);
// apply non dirichlet boundary conditions
// apply non dirichlet boundary conditions
for
(
BoundaryIndexMap
::
iterator
it
=
localBCs
.
begin
();
it
!=
localBCs
.
end
();
++
it
)
for
(
BoundaryIndexMap
::
iterator
it
=
localBCs
.
begin
();
it
!=
localBCs
.
end
();
++
it
)
...
...
AMDiS/src/BoundaryManager.h
View file @
bfa16bad
...
@@ -125,9 +125,6 @@ namespace AMDiS {
...
@@ -125,9 +125,6 @@ namespace AMDiS {
/// Temporary thread-safe variable for functions fillBoundaryconditions.
/// Temporary thread-safe variable for functions fillBoundaryconditions.
std
::
vector
<
BoundaryType
*>
localBounds
;
std
::
vector
<
BoundaryType
*>
localBounds
;
/// Temporary thread-safe variable for functions fillBoundaryconditions.
std
::
vector
<
std
::
vector
<
DegreeOfFreedom
>
>
dofIndices
;
/** \brief
/** \brief
* Stores the number of byte that were allocated in the constructor for
* Stores the number of byte that were allocated in the constructor for
* each localBounds value. Is used to free the memory in the destructor.
* each localBounds value. Is used to free the memory in the destructor.
...
...
AMDiS/src/DOFMatrix.cc
View file @
bfa16bad
...
@@ -168,9 +168,12 @@ namespace AMDiS {
...
@@ -168,9 +168,12 @@ namespace AMDiS {
// === Get indices mapping from local to global matrix indices. ===
// === Get indices mapping from local to global matrix indices. ===
rowFESpace
->
getBasisFcts
()
->
getLocalIndices
(
rowElInfo
->
getElement
(),
std
::
vector
<
DegreeOfFreedom
>
&
rowIndices2
=
rowElInfo
->
getLocalIndices
(
rowFESpace
);
rowFESpace
->
getAdmin
(),
std
::
vector
<
DegreeOfFreedom
>
&
colIndices2
=
rowIndices2
;
rowIndices
);
// rowFESpace->getBasisFcts()->getLocalIndices(rowElInfo->getElement(),
// rowFESpace->getAdmin(),
// rowIndices);
if
(
rowFESpace
==
colFESpace
)
{
if
(
rowFESpace
==
colFESpace
)
{
colIndices
=
rowIndices
;
colIndices
=
rowIndices
;
}
else
{
}
else
{
...
@@ -188,21 +191,8 @@ namespace AMDiS {
...
@@ -188,21 +191,8 @@ namespace AMDiS {
using
namespace
mtl
;
using
namespace
mtl
;
#if 0
std::cout << "----- PRINT MAT --------" << std::endl;
std::cout << elMat << std::endl;
std::cout << "rows: ";
for (int i = 0; i < rowIndices.size(); i++)
std::cout << rowIndices[i] << " ";
std::cout << std::endl;
std::cout << "cols: ";
for (int i = 0; i < colIndices.size(); i++)
std::cout << colIndices[i] << " ";
std::cout << std::endl;
#endif
for
(
int
i
=
0
;
i
<
nRow
;
i
++
)
{
for
(
int
i
=
0
;
i
<
nRow
;
i
++
)
{
DegreeOfFreedom
row
=
rowIndices
[
i
];
DegreeOfFreedom
row
=
rowIndices
2
[
i
];
BoundaryCondition
*
condition
=
BoundaryCondition
*
condition
=
bound
?
boundaryManager
->
getBoundaryCondition
(
bound
[
i
])
:
NULL
;
bound
?
boundaryManager
->
getBoundaryCondition
(
bound
[
i
])
:
NULL
;
...
@@ -210,20 +200,15 @@ namespace AMDiS {
...
@@ -210,20 +200,15 @@ namespace AMDiS {
if
(
condition
&&
condition
->
isDirichlet
())
{
if
(
condition
&&
condition
->
isDirichlet
())
{
if
(
condition
->
applyBoundaryCondition
())
{
if
(
condition
->
applyBoundaryCondition
())
{
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
if
((
*
rankDofs
)[
row
Indices
[
i
]
])
if
((
*
rankDofs
)[
row
])
applyDBCs
.
insert
(
static_cast
<
int
>
(
row
));
applyDBCs
.
insert
(
static_cast
<
int
>
(
row
));
#else
#else
applyDBCs
.
insert
(
static_cast
<
int
>
(
row
));
applyDBCs
.
insert
(
static_cast
<
int
>
(
row
));
#endif
#endif
}
}
}
else
{
}
else
{
for
(
int
j
=
0
;
j
<
nCol
;
j
++
)
{
for
(
int
j
=
0
;
j
<
nCol
;
j
++
)
DegreeOfFreedom
col
=
colIndices
[
j
];
ins
[
row
][
colIndices2
[
j
]]
+=
elMat
[
i
][
j
];
double
entry
=
elMat
[
i
][
j
];
// std::cout << "ADD at " << row << " " << col << std::endl;
ins
[
row
][
col
]
+=
entry
;
}
}
}
}
}
}
}
...
...
AMDiS/src/DOFVector.cc
View file @
bfa16bad
...
@@ -108,13 +108,16 @@ namespace AMDiS {
...
@@ -108,13 +108,16 @@ namespace AMDiS {
// traverse mesh
// traverse mesh
std
::
vector
<
bool
>
visited
(
getUsedSize
(),
false
);
std
::
vector
<
bool
>
visited
(
getUsedSize
(),
false
);
TraverseStack
stack
;
TraverseStack
stack
;
Flag
fillFlag
=
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_GRD_LAMBDA
|
Mesh
::
FILL_COORDS
;
stack
.
addFeSpace
(
feSpace
);
Flag
fillFlag
=
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_GRD_LAMBDA
|
Mesh
::
FILL_COORDS
|
Mesh
::
FILL_LOCAL_INDICES
;
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
fillFlag
);
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
fillFlag
);
while
(
elInfo
)
{
while
(
elInfo
)
{
const
DegreeOfFreedom
**
dof
=
elInfo
->
getElement
()
->
getDOF
();
const
DegreeOfFreedom
**
dof
=
elInfo
->
getElement
()
->
getDOF
();
const
DimVec
<
WorldVector
<
double
>
>
&
grdLambda
=
elInfo
->
getGrdLambda
();
const
DimVec
<
WorldVector
<
double
>
>
&
grdLambda
=
elInfo
->
getGrdLambda
();
getLocalVector
(
elInfo
->
getElement
()
,
localUh
);
getLocalVector
(
elInfo
,
localUh
);
int
localDOFNr
=
0
;
int
localDOFNr
=
0
;
for
(
int
i
=
0
;
i
<
nNodes
;
i
++
)
{
// for all nodes
for
(
int
i
=
0
;
i
<
nNodes
;
i
++
)
{
// for all nodes
...
@@ -177,9 +180,11 @@ namespace AMDiS {
...
@@ -177,9 +180,11 @@ namespace AMDiS {
// traverse mesh
// traverse mesh
Mesh
*
mesh
=
feSpace
->
getMesh
();
Mesh
*
mesh
=
feSpace
->
getMesh
();
TraverseStack
stack
;
TraverseStack
stack
;
stack
.
addFeSpace
(
feSpace
);
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_DET
|
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_DET
|
Mesh
::
FILL_GRD_LAMBDA
|
Mesh
::
FILL_COORDS
);
Mesh
::
FILL_GRD_LAMBDA
|
Mesh
::
FILL_COORDS
|
Mesh
::
FILL_LOCAL_INDICES
);
double
*
localUh
=
new
double
[
basFcts
->
getNumber
()];
double
*
localUh
=
new
double
[
basFcts
->
getNumber
()];
...
@@ -187,7 +192,7 @@ namespace AMDiS {
...
@@ -187,7 +192,7 @@ namespace AMDiS {
double
det
=
elInfo
->
getDet
();
double
det
=
elInfo
->
getDet
();
const
DegreeOfFreedom
**
dof
=
elInfo
->
getElement
()
->
getDOF
();
const
DegreeOfFreedom
**
dof
=
elInfo
->
getElement
()
->
getDOF
();
const
DimVec
<
WorldVector
<
double
>
>
&
grdLambda
=
elInfo
->
getGrdLambda
();
const
DimVec
<
WorldVector
<
double
>
>
&
grdLambda
=
elInfo
->
getGrdLambda
();
getLocalVector
(
elInfo
->
getElement
()
,
localUh
);
getLocalVector
(
elInfo
,
localUh
);
basFcts
->
evalGrdUh
(
bary
,
grdLambda
,
localUh
,
&
grd
);
basFcts
->
evalGrdUh
(
bary
,
grdLambda
,
localUh
,
&
grd
);
for
(
int
i
=
0
;
i
<
dim
+
1
;
i
++
)
{
for
(
int
i
=
0
;
i
<
dim
+
1
;
i
++
)
{
...
@@ -249,7 +254,7 @@ namespace AMDiS {
...
@@ -249,7 +254,7 @@ namespace AMDiS {
}
}
double
*
localVec
=
localVectors
[
myRank
];
double
*
localVec
=
localVectors
[
myRank
];
getLocalVector
(
elInfo
->
getElement
()
,
localVec
);
getLocalVector
(
elInfo
,
localVec
);
DimVec
<
double
>
&
grd1
=
*
grdTmp
[
myRank
];
DimVec
<
double
>
&
grd1
=
*
grdTmp
[
myRank
];
int
parts
=
Global
::
getGeo
(
PARTS
,
dim
);
int
parts
=
Global
::
getGeo
(
PARTS
,
dim
);
...
@@ -334,7 +339,7 @@ namespace AMDiS {
...
@@ -334,7 +339,7 @@ namespace AMDiS {
}
}
double
*
localVec
=
localVectors
[
myRank
];
double
*
localVec
=
localVectors
[
myRank
];
getLocalVector
(
largeElInfo
->
getElement
()
,
localVec
);
getLocalVector
(
largeElInfo
,
localVec
);
const
BasisFunction
*
basFcts
=
feSpace
->
getBasisFcts
();
const
BasisFunction
*
basFcts
=
feSpace
->
getBasisFcts
();
mtl
::
dense2D
<
double
>
&
m
=
smallElInfo
->
getSubElemCoordsMat
(
basFcts
->
getDegree
());
mtl
::
dense2D
<
double
>
&
m
=
smallElInfo
->
getSubElemCoordsMat
(
basFcts
->
getDegree
());
...
@@ -391,8 +396,6 @@ namespace AMDiS {
...
@@ -391,8 +396,6 @@ namespace AMDiS {
TEST_EXIT_DBG
(
!
quadFast
||
quadFast
->
getBasisFunctions
()
==
feSpace
->
getBasisFcts
())
TEST_EXIT_DBG
(
!
quadFast
||
quadFast
->
getBasisFunctions
()
==
feSpace
->
getBasisFcts
())
(
"invalid basis functions"
);
(
"invalid basis functions"
);
Element
*
el
=
elInfo
->
getElement
();
int
myRank
=
omp_get_thread_num
();
int
myRank
=
omp_get_thread_num
();
int
dow
=
Global
::
getGeo
(
WORLD
);
int
dow
=
Global
::
getGeo
(
WORLD
);
int
nPoints
=
quadFast
?
quadFast
->
getQuadrature
()
->
getNumPoints
()
:
quad
->
getNumPoints
();
int
nPoints
=
quadFast
?
quadFast
->
getQuadrature
()
->
getNumPoints
()
:
quad
->
getNumPoints
();
...
@@ -412,7 +415,7 @@ namespace AMDiS {
...
@@ -412,7 +415,7 @@ namespace AMDiS {
}
}
double
*
localVec
=
localVectors
[
myRank
];
double
*
localVec
=
localVectors
[
myRank
];
getLocalVector
(
el
,
localVec
);
getLocalVector
(
el
Info
,
localVec
);
DimMat
<
double
>
D2Tmp
(
dim
,
DEFAULT_VALUE
,
0.0
);
DimMat
<
double
>
D2Tmp
(
dim
,
DEFAULT_VALUE
,
0.0
);
int
parts
=
Global
::
getGeo
(
PARTS
,
dim
);
int
parts
=
Global
::
getGeo
(
PARTS
,
dim
);
...
@@ -776,7 +779,7 @@ namespace AMDiS {
...
@@ -776,7 +779,7 @@ namespace AMDiS {
}
}
double
*
localVec
=
localVectors
[
omp_get_thread_num
()];
double
*
localVec
=
localVectors
[
omp_get_thread_num
()];
getLocalVector
(
largeElInfo
->
getElement
()
,
localVec
);
getLocalVector
(
largeElInfo
,
localVec
);
mtl
::
dense2D
<
double
>
&
m
=
smallElInfo
->
getSubElemCoordsMat
(
basFcts
->
getDegree
());
mtl
::
dense2D
<
double
>
&
m
=
smallElInfo
->
getSubElemCoordsMat
(
basFcts
->
getDegree
());
...
...
AMDiS/src/DOFVector.h
View file @
bfa16bad
...
@@ -67,7 +67,9 @@ namespace AMDiS {
...
@@ -67,7 +67,9 @@ namespace AMDiS {
* For the given element, this function returns an array of all DOFs of this
* For the given element, this function returns an array of all DOFs of this
* DOFVector that are defined on this element.
* DOFVector that are defined on this element.
*/
*/
virtual
const
T
*
getLocalVector
(
const
Element
*
el
,
T
*
localVec
)
const
;
const
T
*
getLocalVector
(
const
Element
*
el
,
T
*
localVec
)
const
;
const
T
*
getLocalVector
(
const
ElInfo
*
elInfo
,
T
*
localVec
)
const
;
/** \brief
/** \brief
* Evaluates the DOF vector at a set of quadrature points defined on the
* Evaluates the DOF vector at a set of quadrature points defined on the
...
...
AMDiS/src/DOFVector.hh
View file @
bfa16bad
...
@@ -147,9 +147,9 @@ namespace AMDiS {
...
@@ -147,9 +147,9 @@ namespace AMDiS {
{
{
FUNCNAME
(
"DOFVector::addElementVector()"
);
FUNCNAME
(
"DOFVector::addElementVector()"
);
std
::
vector
<
DegreeOfFreedom
>
indices
(
nBasFcts
);
std
::
vector
<
DegreeOfFreedom
>
&
indices
=
elInfo
->
getLocalIndices
(
feSpace
);
feSpace
->
getBasisFcts
()
->
getLocalIndices
(
elInfo
->
getElement
(),
feSpace
->
getAdmin
(),
TEST_EXIT_DBG
(
static_cast
<
int
>
(
indices
.
size
())
==
nBasFcts
)
indices
);
(
"Local index vector is too small!
\n
"
);
for
(
DegreeOfFreedom
i
=
0
;
i
<
nBasFcts
;
i
++
)
{
for
(
DegreeOfFreedom
i
=
0
;
i
<
nBasFcts
;
i
++
)
{
BoundaryCondition
*
condition
=
BoundaryCondition
*
condition
=
...
@@ -454,9 +454,11 @@ namespace AMDiS {
...
@@ -454,9 +454,11 @@ namespace AMDiS {
int
nPoints
=
quadFast
->
getNumPoints
();
int
nPoints
=
quadFast
->
getNumPoints
();
std
::
vector
<
T
>
uh_vec
(
nPoints
);
std
::
vector
<
T
>
uh_vec
(
nPoints
);
TraverseStack
stack
;
TraverseStack
stack
;
stack
.
addFeSpace
(
this
->
feSpace
);
ElInfo
*
elInfo
=
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
stack
.
traverseFirst
(
mesh
,
-
1
,
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_COORDS
|
Mesh
::
FILL_DET
);
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_COORDS
|
Mesh
::
FILL_DET
|
Mesh
::
FILL_LOCAL_INDICES
);
while
(
elInfo
)
{
while
(
elInfo
)
{
double
det
=
elInfo
->
getDet
();
double
det
=
elInfo
->
getDet
();
double
normT
=
0.0
;
double
normT
=
0.0
;
...
@@ -490,9 +492,11 @@ namespace AMDiS {
...
@@ -490,9 +492,11 @@ namespace AMDiS {
int
nPoints
=
quadFast
->
getNumPoints
();
int
nPoints
=
quadFast
->
getNumPoints
();
std
::
vector
<
T
>
uh_vec
(
nPoints
);
std
::
vector
<
T
>
uh_vec
(
nPoints
);
TraverseStack
stack
;
TraverseStack
stack
;
stack
.
addFeSpace
(
this
->
feSpace
);
ElInfo
*
elInfo
=
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
stack
.
traverseFirst
(
mesh
,
-
1
,
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_COORDS
|
Mesh
::
FILL_DET
);
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_COORDS
|
Mesh
::
FILL_DET
|
Mesh
::
FILL_LOCAL_INDICES
);
while
(
elInfo
)
{
while
(
elInfo
)
{
double
det
=
elInfo
->
getDet
();
double
det
=
elInfo
->
getDet
();
double
normT
=
0.0
;
double
normT
=
0.0
;
...
@@ -526,9 +530,11 @@ namespace AMDiS {
...
@@ -526,9 +530,11 @@ namespace AMDiS {
int
nPoints
=
quadFast
->
getNumPoints
();
int
nPoints
=
quadFast
->
getNumPoints
();
std
::
vector
<
T
>
uh_vec
(
nPoints
);
std
::
vector
<
T
>
uh_vec
(
nPoints
);
TraverseStack
stack
;
TraverseStack
stack
;
stack
.
addFeSpace
(
this
->
feSpace
);
ElInfo
*
elInfo
=
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
stack
.
traverseFirst
(
mesh
,
-
1
,
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_COORDS
|
Mesh
::
FILL_DET
);
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_COORDS
|
Mesh
::
FILL_DET
|
Mesh
::
FILL_LOCAL_INDICES
);
while
(
elInfo
)
{
while
(
elInfo
)
{
double
det
=
elInfo
->
getDet
();
double
det
=
elInfo
->
getDet
();
double
normT
=
0.0
;
double
normT
=
0.0
;
...
@@ -986,6 +992,49 @@ namespace AMDiS {
...
@@ -986,6 +992,49 @@ namespace AMDiS {
}
}
template
<
typename
T
>
const
T
*
DOFVectorBase
<
T
>::
getLocalVector
(
const
ElInfo
*
elInfo
,
T
*
d
)
const
{
FUNCNAME
(
"DOFVectorBase<T>::getLocalVector()"
);
TEST_EXIT_DBG
(
feSpace
->
getMesh
()
==
elInfo
->
getElement
()
->
getMesh
())
(
"Element is defined on a different mesh than the DOF vector!
\n
"
);
static
T
*
localVec
=
NULL
;
static
int
localVecSize
=
0
;
T
*
result
;
if
(
d
)
{
result
=
d
;
}
else
{
#ifdef _OPENMP
ERROR_EXIT
(
"Using static variable while using OpenMP parallelization!
\n
"
);
#endif
if
(
localVec
&&
nBasFcts
>
localVecSize
)
{
delete
[]
localVec
;
localVec
=
new
T
[
nBasFcts
];
}
if
(
!
localVec
)
localVec
=
new
T
[
nBasFcts
];
localVecSize
=
nBasFcts
;
result
=
localVec
;
}
std
::
vector
<
DegreeOfFreedom
>
&
localIndices
=
const_cast
<
ElInfo
*>
(
elInfo
)
->
getLocalIndices
(
feSpace
);
TEST_EXIT_DBG
(
static_cast
<
int
>
(
localIndices
.
size
())
==
nBasFcts
)
(
"Local indices vector is too small!
\n
"
);
for
(
int
i
=
0
;
i
<
nBasFcts
;
i
++
)
result
[
i
]
=
(
*
this
)[
localIndices
[
i
]];
return
result
;
}
template
<
typename
T
>
template
<
typename
T
>
const
T
*
DOFVectorBase
<
T
>::
getVecAtQPs
(
const
ElInfo
*
elInfo
,
const
T
*
DOFVectorBase
<
T
>::
getVecAtQPs
(
const
ElInfo
*
elInfo
,
const
Quadrature
*
quad
,
const
Quadrature
*
quad
,
...
@@ -1004,7 +1053,6 @@ namespace AMDiS {
...
@@ -1004,7 +1053,6 @@ namespace AMDiS {
TEST_EXIT_DBG
(
!
quadFast
||
quadFast
->
getBasisFunctions
()
==
feSpace
->
getBasisFcts
())
TEST_EXIT_DBG
(
!
quadFast
||
quadFast
->
getBasisFunctions
()
==
feSpace
->
getBasisFcts
())
(
"invalid basis functions"
);
(
"invalid basis functions"
);
Element
*
el
=
elInfo
->
getElement
();
const
Quadrature
*
quadrature
=
quadFast
?
quadFast
->
getQuadrature
()
:
quad
;
const
Quadrature
*
quadrature
=
quadFast
?
quadFast
->
getQuadrature
()
:
quad
;
const
BasisFunction
*
basFcts
=
feSpace
->
getBasisFcts
();
const
BasisFunction
*
basFcts
=
feSpace
->
getBasisFcts
();
int
nPoints
=
quadrature
->
getNumPoints
();
int
nPoints
=
quadrature
->
getNumPoints
();
...
@@ -1028,7 +1076,7 @@ namespace AMDiS {
...
@@ -1028,7 +1076,7 @@ namespace AMDiS {
}
}
T
*
localVec
=
localVectors
[
omp_get_thread_num
()];
T
*
localVec
=
localVectors
[
omp_get_thread_num
()];
getLocalVector
(
el
,
localVec
);
getLocalVector
(
el
Info
,
localVec
);