Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Backofen, Rainer
amdis
Commits
efd6a256
Commit
efd6a256
authored
May 27, 2009
by
Thomas Witkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some *_MEMORY macros
parent
f696ed01
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
108 additions
and
154 deletions
+108
-154
AMDiS/src/BoundaryManager.cc
AMDiS/src/BoundaryManager.cc
+5
-5
AMDiS/src/DOFVector.cc
AMDiS/src/DOFVector.cc
+3
-5
AMDiS/src/DataCollector.cc
AMDiS/src/DataCollector.cc
+3
-3
AMDiS/src/Element.cc
AMDiS/src/Element.cc
+11
-14
AMDiS/src/FixVec.cc
AMDiS/src/FixVec.cc
+5
-8
AMDiS/src/GNUPlotWriter.cc
AMDiS/src/GNUPlotWriter.cc
+10
-17
AMDiS/src/Mesh.cc
AMDiS/src/Mesh.cc
+5
-6
AMDiS/src/NonLinUpdater.cc
AMDiS/src/NonLinUpdater.cc
+17
-30
AMDiS/src/PeriodicBC.cc
AMDiS/src/PeriodicBC.cc
+16
-21
AMDiS/src/Quadrature.cc
AMDiS/src/Quadrature.cc
+23
-31
AMDiS/src/Recovery.cc
AMDiS/src/Recovery.cc
+5
-9
AMDiS/src/RecoveryEstimator.cc
AMDiS/src/RecoveryEstimator.cc
+5
-5
No files found.
AMDiS/src/BoundaryManager.cc
View file @
efd6a256
...
...
@@ -15,7 +15,7 @@ namespace AMDiS {
dofIndices
.
resize
(
omp_get_overall_max_threads
());
allocatedMemoryLocalBounds
=
feSpace
->
getBasisFcts
()
->
getNumber
();
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
localBounds
.
size
());
i
++
)
localBounds
[
i
]
=
GET_MEMORY
(
BoundaryType
,
allocatedMemoryLocalBounds
)
;
localBounds
[
i
]
=
new
BoundaryType
[
allocatedMemoryLocalBounds
]
;
}
BoundaryManager
::
BoundaryManager
(
BoundaryManager
&
bm
)
...
...
@@ -25,13 +25,13 @@ namespace AMDiS {
localBounds
.
resize
(
bm
.
localBounds
.
size
());
dofIndices
.
resize
(
bm
.
localBounds
.
size
());
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
localBounds
.
size
());
i
++
)
localBounds
[
i
]
=
GET_MEMORY
(
BoundaryType
,
allocatedMemoryLocalBounds
)
;
localBounds
[
i
]
=
new
BoundaryType
[
allocatedMemoryLocalBounds
]
;
}
BoundaryManager
::~
BoundaryManager
()
{
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
localBounds
.
size
());
i
++
)
FREE_MEMORY
(
localBounds
[
i
],
BoundaryType
,
allocatedMemoryL
ocalBounds
)
;
delete
[]
l
ocalBounds
[
i
]
;
}
double
BoundaryManager
::
boundResidual
(
ElInfo
*
elInfo
,
...
...
@@ -40,10 +40,10 @@ namespace AMDiS {
{
double
result
=
0.0
;
std
::
map
<
BoundaryType
,
BoundaryCondition
*>::
iterator
it
;
for
(
it
=
localBCs
.
begin
();
it
!=
localBCs
.
end
();
++
it
)
{
for
(
it
=
localBCs
.
begin
();
it
!=
localBCs
.
end
();
++
it
)
if
((
*
it
).
second
)
result
+=
(
*
it
).
second
->
boundResidual
(
elInfo
,
matrix
,
dv
);
}
return
result
;
}
...
...
AMDiS/src/DOFVector.cc
View file @
efd6a256
...
...
@@ -484,7 +484,7 @@ namespace AMDiS {
this
->
set
(
0.0
);
DegreeOfFreedom
*
myLocalIndices
=
localIndices
[
omp_get_thread_num
()];
double
*
sourceLocalCoeffs
=
GET_MEMORY
(
double
,
nSourceBasisFcts
)
;
double
*
sourceLocalCoeffs
=
new
double
[
nSourceBasisFcts
]
;
if
(
feSpace
->
getMesh
()
==
sourceFeSpace
->
getMesh
())
{
DimVec
<
double
>
*
coords
=
NULL
;
...
...
@@ -552,7 +552,7 @@ namespace AMDiS {
}
}
FREE_MEMORY
(
sourceLocalCoeffs
,
double
,
nSourceBasisFcts
)
;
delete
[]
sourceLocalCoeffs
;
}
...
...
@@ -564,12 +564,10 @@ namespace AMDiS {
this
->
set
(
nul
);
DimVec
<
double
>
*
coords
=
NULL
;
const
FiniteElemSpace
*
vFESpace
=
v
->
getFESpace
();
if
(
feSpace
==
vFESpace
)
{
if
(
feSpace
==
vFESpace
)
WARNING
(
"same FE-spaces
\n
"
);
}
const
BasisFunction
*
basFcts
=
feSpace
->
getBasisFcts
();
const
BasisFunction
*
vBasFcts
=
vFESpace
->
getBasisFcts
();
...
...
AMDiS/src/DataCollector.cc
View file @
efd6a256
...
...
@@ -124,7 +124,7 @@ namespace AMDiS {
basisFcts_
=
const_cast
<
BasisFunction
*>
(
feSpace_
->
getBasisFcts
());
nBasisFcts_
=
basisFcts_
->
getNumber
();
localDOFs_
=
GET_MEMORY
(
DegreeOfFreedom
,
nBasisFcts_
)
;
localDOFs_
=
new
DegreeOfFreedom
[
nBasisFcts_
]
;
TraverseStack
stack
;
...
...
@@ -161,10 +161,10 @@ namespace AMDiS {
}
}
FREE_MEMORY
(
localDOFs_
,
DegreeOfFreedom
,
nBasisFcts_
)
;
delete
[]
localDOFs_
;
valueDataCollected_
=
true
;
return
(
0
)
;
return
0
;
}
int
DataCollector
::
startCollectingPeriodicData
()
...
...
AMDiS/src/Element.cc
View file @
efd6a256
...
...
@@ -103,7 +103,7 @@ namespace AMDiS {
if
(
dof
[
j
])
{
if
(
deletedDOFs
.
count
(
dof
[
j
])
==
0
)
{
deletedDOFs
[
dof
[
j
]]
=
true
;
FREE_MEMORY
(
dof
[
j
],
DegreeOfFreedom
,
ndof
)
;
delete
[]
dof
[
j
]
;
}
}
j
++
;
...
...
@@ -113,12 +113,10 @@ namespace AMDiS {
FREE_MEMORY
(
dof
,
DegreeOfFreedom
*
,
mesh
->
getNumberOfNodes
());
if
(
child
[
0
])
{
if
(
child
[
0
])
child
[
0
]
->
deleteElementDOFs
();
}
if
(
child
[
1
])
{
if
(
child
[
1
])
child
[
1
]
->
deleteElementDOFs
();
}
}
Element
*
Element
::
cloneWithDOFs
()
...
...
@@ -144,7 +142,7 @@ namespace AMDiS {
/* =========== And here we clone the DOFs =========== */
el
->
dof
=
GET_MEMORY
(
DegreeOfFreedom
*
,
mesh
->
getNumberOfNodes
()
)
;
el
->
dof
=
new
DegreeOfFreedom
*
[
mesh
->
getNumberOfNodes
()
]
;
int
dim
=
mesh
->
getDim
();
int
j
=
0
;
...
...
@@ -153,18 +151,17 @@ namespace AMDiS {
GeoIndex
position
=
INDEX_OF_DIM
(
pos
,
dim
);
int
ndof
=
0
;
for
(
int
i
=
0
;
i
<
mesh
->
getNumberOfDOFAdmin
();
i
++
)
{
for
(
int
i
=
0
;
i
<
mesh
->
getNumberOfDOFAdmin
();
i
++
)
ndof
+=
mesh
->
getDOFAdmin
(
i
).
getNumberOfDOFs
(
position
);
}
if
(
ndof
>
0
)
{
for
(
int
i
=
0
;
i
<
mesh
->
getGeo
(
position
);
i
++
)
{
if
(
dof
[
j
]
!=
NULL
)
{
if
(
Mesh
::
serializedDOFs
[
dof
[
j
][
0
]]
==
NULL
)
{
el
->
dof
[
j
]
=
GET_MEMORY
(
DegreeOfFreedom
,
ndof
)
;
for
(
int
k
=
0
;
k
<
ndof
;
k
++
)
{
el
->
dof
[
j
]
=
new
DegreeOfFreedom
[
ndof
]
;
for
(
int
k
=
0
;
k
<
ndof
;
k
++
)
el
->
dof
[
j
][
k
]
=
dof
[
j
][
k
];
}
Mesh
::
serializedDOFs
[
dof
[
j
][
0
]]
=
el
->
dof
[
j
];
}
else
{
el
->
dof
[
j
]
=
Mesh
::
serializedDOFs
[
dof
[
j
][
0
]];
...
...
@@ -466,7 +463,7 @@ namespace AMDiS {
int
nodes
;
in
.
read
(
reinterpret_cast
<
char
*>
(
&
nodes
),
sizeof
(
int
));
dof
=
GET_MEMORY
(
DegreeOfFreedom
*
,
nodes
)
;
dof
=
new
DegreeOfFreedom
*
[
nodes
]
;
for
(
int
i
=
0
;
i
<
nodes
;
i
++
)
{
int
dofs
;
...
...
@@ -474,11 +471,11 @@ namespace AMDiS {
if
(
dofs
)
{
if
(
dofs
!=
-
1
)
{
dof
[
i
]
=
GET_MEMORY
(
DegreeOfFreedom
,
dofs
)
;
dof
[
i
]
=
new
DegreeOfFreedom
[
dofs
]
;
in
.
read
(
reinterpret_cast
<
char
*>
(
dof
[
i
]),
dofs
*
sizeof
(
DegreeOfFreedom
));
if
(
Mesh
::
serializedDOFs
[
dof
[
i
][
0
]]
!=
NULL
)
{
DegreeOfFreedom
*
dofPtr
=
Mesh
::
serializedDOFs
[
dof
[
i
][
0
]];
FREE_MEMORY
(
dof
[
i
],
DegreeOfFreedom
,
dof
s
)
;
delete
[]
dof
[
i
]
;
dof
[
i
]
=
dofPtr
;
}
else
{
Mesh
::
serializedDOFs
[
dof
[
i
][
0
]]
=
dof
[
i
];
...
...
AMDiS/src/FixVec.cc
View file @
efd6a256
...
...
@@ -9,24 +9,21 @@ namespace AMDiS {
va_start
(
arg
,
size
);
VectorOfFixVecs
<
DimVec
<
double
>
>
*
result
=
new
VectorOfFixVecs
<
DimVec
<
double
>
>
(
dim
,
size
,
NO_INIT
);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
for
(
int
j
=
0
;
j
<
dim
+
1
;
j
++
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
for
(
int
j
=
0
;
j
<
dim
+
1
;
j
++
)
(
*
result
)[
i
][
j
]
=
va_arg
(
arg
,
double
);
}
}
va_end
(
arg
);
return
result
;
}
;
}
double
*
createAndInitArray
(
int
size
,
...)
{
va_list
arg
;
va_start
(
arg
,
size
);
double
*
result
=
GET_MEMORY
(
double
,
size
)
;
double
*
result
=
new
double
[
size
]
;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
result
[
i
]
=
va_arg
(
arg
,
double
);
}
va_end
(
arg
);
return
result
;
...
...
AMDiS/src/GNUPlotWriter.cc
View file @
efd6a256
...
...
@@ -22,51 +22,44 @@ namespace AMDiS {
void
GNUPlotWriter
::
writeFiles
(
AdaptInfo
*
adaptInfo
,
bool
force
)
{
DOFVector
<
WorldVector
<
double
>
>
coords
(
feSpace_
,
"coords"
);
Mesh
*
mesh
=
feSpace_
->
getMesh
();
int
dow
=
Global
::
getGeo
(
WORLD
);
const
BasisFunction
*
basFcts
=
feSpace_
->
getBasisFcts
();
int
i
,
numFcts
=
basFcts
->
getNumber
();
DegreeOfFreedom
*
localDOFs
=
GET_MEMORY
(
DegreeOfFreedom
,
numFcts
)
;
int
numFcts
=
basFcts
->
getNumber
();
DegreeOfFreedom
*
localDOFs
=
new
DegreeOfFreedom
[
numFcts
]
;
TraverseStack
stack
;
ElInfo
*
elInfo
=
stack
.
traverseFirst
(
mesh
,
-
1
,
Mesh
::
CALL_LEAF_EL
|
Mesh
::
FILL_COORDS
);
while
(
elInfo
)
{
while
(
elInfo
)
{
basFcts
->
getLocalIndices
(
elInfo
->
getElement
(),
feSpace_
->
getAdmin
(),
localDOFs
);
for
(
i
=
0
;
i
<
numFcts
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numFcts
;
i
++
)
coords
[
localDOFs
[
i
]]
=
elInfo
->
getCoord
(
i
);
}
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
FREE_MEMORY
(
localDOFs
,
DegreeOfFreedom
,
numFcts
)
;
delete
[]
localDOFs
;
FILE
*
file
=
NULL
;
if
(
!
(
file
=
fopen
(
filename_
.
c_str
(),
"w"
)))
{
ERROR
(
"could not open file %s for writing
\n
"
,
filename_
.
c_str
());
}
ERROR
(
"could not open file %s for writing
\n
"
,
filename_
.
c_str
());
fprintf
(
file
,
"# line format: time x y z val1[x,y,z] val2[x,y,z] ...
\n
"
);
DOFVector
<
WorldVector
<
double
>
>::
Iterator
coordsIt
(
&
coords
,
USED_DOFS
);
int
index
,
numVecs
=
static_cast
<
int
>
(
dofVectors_
.
size
());
for
(
coordsIt
.
reset
();
!
coordsIt
.
end
();
++
coordsIt
)
{
for
(
coordsIt
.
reset
();
!
coordsIt
.
end
();
++
coordsIt
)
{
index
=
coordsIt
.
getDOFIndex
();
fprintf
(
file
,
"%e "
,
adaptInfo
->
getTime
());
for
(
i
=
0
;
i
<
dow
;
i
++
)
{
for
(
int
i
=
0
;
i
<
dow
;
i
++
)
fprintf
(
file
,
"%e "
,
(
*
coordsIt
)[
i
]);
}
for
(
i
=
0
;
i
<
numVecs
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numVecs
;
i
++
)
fprintf
(
file
,
"%e "
,
(
*
(
dofVectors_
[
i
]))[
index
]);
}
fprintf
(
file
,
"
\n
"
);
}
}
...
...
AMDiS/src/Mesh.cc
View file @
efd6a256
...
...
@@ -494,7 +494,7 @@ namespace AMDiS {
if
(
ndof
<=
0
)
return
NULL
;
DegreeOfFreedom
*
dof
=
GET_MEMORY
(
DegreeOfFreedom
,
ndof
)
;
DegreeOfFreedom
*
dof
=
new
DegreeOfFreedom
[
ndof
]
;
for
(
int
i
=
0
;
i
<
getNumberOfDOFAdmin
();
i
++
)
{
const
DOFAdmin
*
localAdmin
=
&
getDOFAdmin
(
i
);
...
...
@@ -505,9 +505,8 @@ namespace AMDiS {
TEST_EXIT_DBG
(
n
+
n0
<=
ndof
)(
"n=%d, n0=%d too large: ndof=%d
\n
"
,
n
,
n0
,
ndof
);
for
(
int
j
=
0
;
j
<
n
;
j
++
)
{
for
(
int
j
=
0
;
j
<
n
;
j
++
)
dof
[
n0
+
j
]
=
const_cast
<
DOFAdmin
*>
(
localAdmin
)
->
getDOFIndex
();
}
}
return
dof
;
...
...
@@ -521,7 +520,7 @@ namespace AMDiS {
if
(
nNodeEl
<=
0
)
return
NULL
;
DegreeOfFreedom
**
ptrs
=
GET_MEMORY
(
DegreeOfFreedom
*
,
nNodeEl
)
;
DegreeOfFreedom
**
ptrs
=
new
DegreeOfFreedom
*
[
nNodeEl
]
;
for
(
int
i
=
0
;
i
<
nNodeEl
;
i
++
)
ptrs
[
i
]
=
NULL
;
...
...
@@ -537,7 +536,7 @@ namespace AMDiS {
if
(
nNodeEl
<=
0
)
return
;
FREE_MEMORY
(
ptrs
,
DegreeOfFreedom
*
,
nNodeEl
)
;
delete
[]
ptrs
;
}
...
...
@@ -606,7 +605,7 @@ namespace AMDiS {
localAdmin
->
freeDOFIndex
(
dof
[
n0
+
j
]);
}
FREE_MEMORY
(
dof
,
DegreeOfFreedom
,
n
dof
)
;
delete
[]
dof
;
}
void
Mesh
::
freeElement
(
Element
*
el
)
...
...
AMDiS/src/NonLinUpdater.cc
View file @
efd6a256
...
...
@@ -26,9 +26,8 @@ namespace AMDiS {
const
FiniteElemSpace
*
feSpace
=
F
?
F
->
getFESpace
()
:
df
->
getFESpace
();
if
(
updateDF
)
{
if
(
updateDF
)
df
->
clear
();
}
BasisFunction
*
basFcts
=
const_cast
<
BasisFunction
*>
(
feSpace
->
getBasisFcts
());
...
...
@@ -43,24 +42,21 @@ namespace AMDiS {
Mesh
::
FILL_DET
|
Mesh
::
FILL_GRD_LAMBDA
;
BoundaryType
*
bound
=
GET_MEMORY
(
BoundaryType
,
feSpace
->
getBasisFcts
()
->
getNumber
()
)
;
BoundaryType
*
bound
=
new
BoundaryType
[
feSpace
->
getBasisFcts
()
->
getNumber
()
]
;
el_info
=
stack
.
traverseFirst
(
feSpace
->
getMesh
(),
-
1
,
fill_flag
);
while
(
el_info
)
{
basFcts
->
getBound
(
el_info
,
bound
);
if
(
updateDF
)
{
if
(
updateDF
)
df
->
assemble
(
1.0
,
el_info
,
bound
);
}
if
(
F
)
{
if
(
F
)
F
->
assemble
(
1.0
,
el_info
,
bound
);
}
el_info
=
stack
.
traverseNext
(
el_info
);
}
FREE_MEMORY
(
bound
,
BoundaryType
,
feSpace
->
getBasisFcts
()
->
getNumber
())
;
delete
[]
bound
;
}
void
NonLinUpdaterVec
::
update
(
bool
updateDF
,
...
...
@@ -89,13 +85,10 @@ namespace AMDiS {
if
(
updateDF
)
{
TEST_EXIT
(
df
)(
"df not set but update tried!
\n
"
);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
for
(
int
j
=
0
;
j
<
size
;
j
++
)
{
if
((
*
df
)[
i
][
j
])
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
for
(
int
j
=
0
;
j
<
size
;
j
++
)
if
((
*
df
)[
i
][
j
])
(
*
df
)[
i
][
j
]
->
clear
();
}
}
}
}
BasisFunction
*
basFcts
=
const_cast
<
BasisFunction
*>
(
feSpace
->
getBasisFcts
());
...
...
@@ -113,32 +106,26 @@ namespace AMDiS {
Mesh
::
FILL_DET
|
Mesh
::
FILL_GRD_LAMBDA
;
BoundaryType
*
bound
=
GET_MEMORY
(
BoundaryType
,
basFcts
->
getNumber
()
)
;
BoundaryType
*
bound
=
new
BoundaryType
[
basFcts
->
getNumber
()
]
;
el_info
=
stack
.
traverseFirst
(
feSpace
->
getMesh
(),
-
1
,
fill_flag
);
while
(
el_info
)
{
basFcts
->
getBound
(
el_info
,
bound
);
if
(
updateDF
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
for
(
int
j
=
0
;
j
<
size
;
j
++
)
{
if
((
*
df
)[
i
][
j
])
{
if
(
updateDF
)
for
(
int
i
=
0
;
i
<
size
;
i
++
)
for
(
int
j
=
0
;
j
<
size
;
j
++
)
if
((
*
df
)[
i
][
j
])
(
*
df
)[
i
][
j
]
->
assemble
(
1.0
,
el_info
,
bound
);
}
}
}
}
if
(
F
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
if
(
F
)
for
(
int
i
=
0
;
i
<
size
;
i
++
)
F
->
getDOFVector
(
i
)
->
assemble
(
1.0
,
el_info
,
bound
);
}
}
el_info
=
stack
.
traverseNext
(
el_info
);
}
FREE_MEMORY
(
bound
,
BoundaryType
,
basFcts
->
getNumber
())
;
}
;
delete
[]
bound
;
}
}
AMDiS/src/PeriodicBC.cc
View file @
efd6a256
...
...
@@ -9,18 +9,17 @@
namespace
AMDiS
{
::
std
::
vector
<
PeriodicDOFMapping
*>
PeriodicDOFMapping
::
mappings_
;
std
::
vector
<
PeriodicDOFMapping
*>
PeriodicDOFMapping
::
mappings_
;
PeriodicDOFMapping
*
PeriodicDOFMapping
::
providePeriodicDOFMapping
(
const
BasisFunction
*
basFcts
)
{
::
std
::
vector
<
PeriodicDOFMapping
*>::
iterator
it
;
::
std
::
vector
<
PeriodicDOFMapping
*>::
iterator
end
=
mappings_
.
end
();
for
(
it
=
mappings_
.
begin
();
it
!=
end
;
++
it
)
{
if
((
*
it
)
->
basFcts_
==
basFcts
)
{
std
::
vector
<
PeriodicDOFMapping
*>::
iterator
it
;
std
::
vector
<
PeriodicDOFMapping
*>::
iterator
end
=
mappings_
.
end
();
for
(
it
=
mappings_
.
begin
();
it
!=
end
;
++
it
)
if
((
*
it
)
->
basFcts_
==
basFcts
)
return
*
it
;
}
}
PeriodicDOFMapping
*
newMapping
=
new
PeriodicDOFMapping
(
basFcts
);
mappings_
.
push_back
(
newMapping
);
return
newMapping
;
...
...
@@ -32,9 +31,9 @@ namespace AMDiS {
{
FUNCNAME
(
"PeriodicDOFMapping::PeriodicDOFMapping()"
);
TEST_EXIT
(
basFcts_
->
getDim
()
>
1
)(
"dim == 1
\n
"
);
int
i
,
num
=
basFcts_
->
getNumber
();
int
num
=
basFcts_
->
getNumber
();
DimVec
<
double
>
*
lambda
;
for
(
i
=
0
;
i
<
num
;
i
++
)
{
for
(
int
i
=
0
;
i
<
num
;
i
++
)
{
lambda
=
basFcts_
->
getCoords
(
i
);
indexOfCoords_
[
*
lambda
]
=
i
;
}
...
...
@@ -42,16 +41,13 @@ namespace AMDiS {
PeriodicDOFMapping
::~
PeriodicDOFMapping
()
{
::
std
::
map
<
DimVec
<
int
>
,
DegreeOfFreedom
*
,
DimVecLess
<
int
>
>::
iterator
it
;
for
(
it
=
dofPermutation_
.
begin
();
it
!=
dofPermutation_
.
end
();
++
it
)
{
if
(
it
->
second
)
{
FREE_MEMORY
(
it
->
second
,
DegreeOfFreedom
,
basFcts_
->
getNumber
());
}
}
std
::
map
<
DimVec
<
int
>
,
DegreeOfFreedom
*
,
DimVecLess
<
int
>
>::
iterator
it
;
for
(
it
=
dofPermutation_
.
begin
();
it
!=
dofPermutation_
.
end
();
++
it
)
if
(
it
->
second
)
delete
[]
it
->
second
;
}
const
DegreeOfFreedom
*
PeriodicDOFMapping
::
getDOFPermutation
(
const
DimVec
<
int
>
&
vertexPermutation
)
const
DegreeOfFreedom
*
PeriodicDOFMapping
::
getDOFPermutation
(
const
DimVec
<
int
>
&
vertexPermutation
)
{
FUNCNAME
(
"PeriodicDOFMapping::getDOFPermutation()"
);
...
...
@@ -74,7 +70,7 @@ namespace AMDiS {
DimVec
<
double
>
*
lambda
;
DimVec
<
double
>
newLambda
(
dim
,
NO_INIT
);
DegreeOfFreedom
*
mapping
=
GET_MEMORY
(
DegreeOfFreedom
,
num
)
;
DegreeOfFreedom
*
mapping
=
new
DegreeOfFreedom
[
num
]
;
for
(
i
=
0
;
i
<
num
;
i
++
)
{
lambda
=
basFcts_
->
getCoords
(
i
);
...
...
@@ -121,7 +117,7 @@ namespace AMDiS {
boundaryType
);
const
BasisFunction
*
basFcts
=
rowFESpace
->
getBasisFcts
();
neighIndices_
=
GET_MEMORY
(
DegreeOfFreedom
,
basFcts
->
getNumber
()
)
;
neighIndices_
=
new
DegreeOfFreedom
[
basFcts
->
getNumber
()
]
;
}
}
...
...
@@ -210,8 +206,7 @@ namespace AMDiS {
TEST_EXIT
(
matrix
)(
"no matrix
\n
"
);
if
(
matrix
==
masterMatrix_
)
{
FREE_MEMORY
(
neighIndices_
,
DegreeOfFreedom
,
rowFESpace
()
->
getBasisFcts
()
->
getNumber
());
delete
[]
neighIndices_
;
masterMatrix_
=
NULL
;
}
...
...
AMDiS/src/Quadrature.cc
View file @
efd6a256
...
...
@@ -21,11 +21,10 @@ namespace AMDiS {
lambda
=
new
VectorOfFixVecs
<
DimVec
<
double
>
>
(
*
(
q
.
lambda
));
// copy weights
w
=
GET_MEMORY
(
double
,
n_points
)
;
w
=
new
double
[
n_points
]
;
for
(
int
i
=
0
;
i
<
n_points
;
i
++
)
{
for
(
int
i
=
0
;
i
<
n_points
;
i
++
)
w
[
i
]
=
q
.
w
[
i
];
}
}
/****************************************************************************/
...
...
@@ -83,16 +82,15 @@ namespace AMDiS {
}
else
{
if
(
static_cast
<
int
>
(
size
)
<
n_points
)
{
size_t
new_size
=
std
::
max
(
maxNQuadPoints
[
dim
],
n_points
);
FREE_MEMORY
(
quad_vec
,
double
,
size
)
;
quad_vec
=
GET_MEMORY
(
double
,
new_size
)
;
delete
[]
quad_vec
;
quad_vec
=
new
double
[
new_size
]
;
size
=
new_size
;
}
val
=
quad_vec
;
}
for
(
int
i
=
0
;
i
<
n_points
;
i
++
)
{
for
(
int
i
=
0
;
i
<
n_points
;
i
++
)
val
[
i
]
=
f
((
*
lambda
)[
i
]);
}
return
(
const_cast
<
const
double
*>
(
val
));
}
...
...
@@ -1509,17 +1507,15 @@ namespace AMDiS {
if
(
!
phi
&&
init_flag
.
isSet
(
INIT_PHI
))
{
// check flag
// allocate memory
phi
=
GET_MEMORY
(
double
*
,
nPoints
);
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
{
phi
[
i
]
=
GET_MEMORY
(
double
,
nBasFcts
);
}
phi
=
new
double
*
[
nPoints
];
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
phi
[
i
]
=
new
double
[
nBasFcts
];
// fill memory
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
{
lambda
=
quadrature
->
getLambda
(
i
);
for
(
int
j
=
0
;
j
<
nBasFcts
;
j
++
)
{
for
(
int
j
=
0
;
j
<
nBasFcts
;
j
++
)
phi
[
i
][
j
]
=
(
*
(
basisFunctions
->
getPhi
(
j
)))(
lambda
);
}
}
// update flag
...
...
@@ -1584,31 +1580,26 @@ namespace AMDiS {
int
nBasFcts
=
basisFunctions
->
getNumber
();
if
(
fastQuad
.
phi
)
{
phi
=
GET_MEMORY
(
double
*
,
nPoints
)
;
phi
=
new
double
*
[
nPoints
]
;
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
{
phi
[
i
]
=
GET_MEMORY
(
double
,
nBasFcts
)
;
for
(
int
j
=
0
;
j
<
nBasFcts
;
j
++
)
{
phi
[
i
]
=
new
double
[
nBasFcts
]
;
for
(
int
j
=
0
;
j
<
nBasFcts
;
j
++
)
phi
[
i
][
j
]
=
fastQuad
.
phi
[
i
][
j
];
}
}
}
if
(
fastQuad
.
grdPhi
)
{
grdPhi
=
new
MatrixOfFixVecs
<
DimVec
<
double
>
>
(
dim
,
nPoints
,
nBasFcts
,
NO_INIT
);
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nBasFcts
;
j
++
)
{
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
for
(
int
j
=
0
;
j
<
nBasFcts
;
j
++
)
(
*
grdPhi
)[
i
][
j
]
=
(
*
(
fastQuad
.
grdPhi
))[
i
][
j
];
}
}
}
if
(
fastQuad
.
D2Phi
)
{
D2Phi
=
new
MatrixOfFixVecs
<
DimMat
<
double
>
>
(
dim
,
nPoints
,
nBasFcts
,
NO_INIT
);
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nBasFcts
;
j
++
)
{
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
for
(
int
j
=
0
;
j
<
nBasFcts
;
j
++
)
(
*
D2Phi
)[
i
][
j
]
=
(
*
(
fastQuad
.
D2Phi
))[
i
][
j
];
}
}
}
}
...
...
@@ -1616,20 +1607,21 @@ namespace AMDiS {
{
int
nPoints
=
quadrature
->
getNumPoints
();
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
{
FREE_MEMORY
(
phi
[
i
],
double
,
basisFunctions
->
getNumber
());
}
for
(
int
i
=
0
;
i
<
nPoints
;
i
++
)
delete
[]
phi
[
i
];
FREE_MEMORY
(
phi
,
double
*
,
nPoints
)
;
delete
[]
phi
;
delete
grdPhi
;
delete
D2Phi
;
}
const
double
FastQuadrature
::
getSecDer
(
int
q
,
int
i
,
int
j
,
int
m
)
const
{