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
iwr
amdis
Commits
831ce194
Commit
831ce194
authored
Nov 05, 2014
by
Praetorius, Simon
Browse files
removed some warnings and minor errors in the code
parent
99303ce3
Changes
17
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/AbstractFunction.h
View file @
831ce194
...
...
@@ -44,6 +44,7 @@ namespace AMDiS {
* To create your own function you have to derive AbstractFunction and
* overload operator().
*/
// #ifndef HAS_VARIADIC_TEMPLATES
template
<
typename
ReturnType
,
typename
ArgumentType
>
class
AbstractFunction
{
...
...
@@ -67,7 +68,8 @@ namespace AMDiS {
protected:
int
degree_
;
};
// #endif
/**
* \ingroup Common
*
...
...
@@ -173,6 +175,7 @@ namespace AMDiS {
int
degree_
;
};
// #ifndef HAS_VARIADIC_TEMPLATES
///////////////////////////////////////////////////////////////
// test of AbstractFunction with arbitrary number of arguments
...
...
@@ -195,17 +198,46 @@ namespace AMDiS {
int degree_; \
}; \
// template< typename ReturnType,
// BOOST_PP_ENUM_PARAMS(N, typename T) // expands to typename T0, typename T1, typename T2...
// >
// class CONCAT_STR(AbstractFunction,N)
#if 0 // description of the macro
template< typename ReturnType, BOOST_PP_ENUM_PARAMS(N, typename T) >// expands to typename T0, typename T1, typename T2...
class CONCAT_STR(AbstractFunction,N)
{
public:
CONCAT_STR(AbstractFunction,N)(int degree = 0) :
degree_(degree)
{}
virtual ~CONCAT_STR(AbstractFunction,N)() {}
/// Returns \ref degree_.
inline int getDegree() const
{
return degree_;
}
/// function evaluation.
virtual ReturnType operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, const T, &t)) const = 0;
protected:
int degree_;
};
#endif
BOOST_PP_REPEAT_FROM_TO
(
1
,
11
,
ABSTRACT_FUNCTION_MACRO
,
nil
)
// #else
//
// /// C++11 implementation of abstract functions with arbitrary nr of arguments using variadic templates
// template< typename ReturnType, typename... Ts >
// class AbstractFunction
// {
// public:
//
CONCAT_STR(
AbstractFunction
,N)
(int degree = 0)
:
// degree_(degree)
// AbstractFunction(int degree = 0)
//
:
degree_(degree)
// {}
//
// virtual ~
CONCAT_STR(
AbstractFunction
,N)
() {}
// virtual ~AbstractFunction() {}
//
// /// Returns \ref degree_.
// inline int getDegree() const
...
...
@@ -214,15 +246,13 @@ namespace AMDiS {
// }
//
// /// function evaluation.
// virtual ReturnType operator()(
BOOST_PP_ENUM_BINARY_PARAMS(N, const T, &t)
) const = 0;
// virtual ReturnType operator()(
Ts const&... args
) const = 0;
//
// protected:
// int degree_;
// };
BOOST_PP_REPEAT_FROM_TO
(
1
,
11
,
ABSTRACT_FUNCTION_MACRO
,
nil
)
//
// #endif
}
#endif // AMDIS_ABSTRACTFUNCTION_H
AMDiS/src/Expressions.h
View file @
831ce194
...
...
@@ -77,17 +77,17 @@
*
*
* with F a functor that implements
* typedef (...)
value
_type;
* typedef (...)
result
_type;
* int getDegree(int d0);
*
value
_type operator()(const T0& v0) const;
*
result
_type operator()(const T0& v0) const;
*
* respective
* int getDegree(int d0, int d1);
*
value
_type operator()(const T0& v0, const T1& v1) const;
*
result
_type operator()(const T0& v0, const T1& v1) const;
*
* respective
* int getDegree(int d0, int d1, int d2);
*
value
_type operator()(const T0& v0, const T1& v1, const T2& v2) const;
*
result
_type operator()(const T0& v0, const T1& v1, const T2& v2) const;
*
* where the d0, d1, d2 give the polynomial degrees of the v0, v1, v2 terms.
* */
...
...
AMDiS/src/Expressions.hh
View file @
831ce194
...
...
@@ -96,7 +96,6 @@ template<typename Term, typename Functor>
inline
typename
boost
::
enable_if
<
typename
traits
::
is_expr
<
Term
>::
type
,
typename
Term
::
value_type
>::
type
accumulate
(
Term
term
,
Functor
f
,
typename
Term
::
value_type
value0
)
{
typedef
typename
Term
::
value_type
TOut
;
typename
GenericOperatorTerm
<
Term
>::
type
ot
(
term
);
std
::
set
<
const
FiniteElemSpace
*>
feSpaces
=
ot
.
getAuxFeSpaces
();
...
...
AMDiS/src/Global.h
View file @
831ce194
...
...
@@ -46,6 +46,9 @@
#if !((defined BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_DECLTYPE))
#define HAS_CPP11_DECLTYPE
#endif
#if !((defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) || (defined BOOST_NO_VARIADIC_TEMPLATES)) || (defined BOOST_HAS_VARIADIC_TMPL)
#define HAS_VARIADIC_TEMPLATES
#endif
/** \brief current AMDiS version */
#ifndef AMDIS_VERSION
...
...
AMDiS/src/io/detail/Arh2Reader.cc
View file @
831ce194
...
...
@@ -567,7 +567,7 @@ namespace AMDiS { namespace io {
vector
<
vector
<
int
>
>
sortedFeSpaces
(
nFeSpaces
);
// Read macro table
for
(
int
i
=
0
;
i
<
nMacroElements
;
i
++
)
{
for
(
u
int
32_t
i
=
0
;
i
<
nMacroElements
;
i
++
)
{
file
.
read
(
reinterpret_cast
<
char
*>
(
&
macroElIndex
[
i
]),
4
);
file
.
read
(
reinterpret_cast
<
char
*>
(
&
macroElSize
[
i
]),
4
);
}
...
...
@@ -576,7 +576,7 @@ namespace AMDiS { namespace io {
file
.
seekg
(
nFeSpaces
*
4
*
4
,
ios_base
::
cur
);
// Read value table
for
(
int
i
=
0
;
i
<
nValueVectors
;
i
++
)
{
for
(
u
int
32_t
i
=
0
;
i
<
nValueVectors
;
i
++
)
{
string
tmpString
(
""
);
uint32_t
tmpInt
=
0
;
file
.
read
(
reinterpret_cast
<
char
*>
(
&
tmpInt
),
4
);
...
...
@@ -586,7 +586,7 @@ namespace AMDiS { namespace io {
sortedFeSpaces
[
tmpInt
].
push_back
(
i
);
}
for
(
u
nsigned
in
t
i
=
0
;
i
<
nMacroElements
;
i
++
)
{
for
(
u
int32_
t
i
=
0
;
i
<
nMacroElements
;
i
++
)
{
stringstream
dataStream
(
ios
::
out
|
ios
::
in
|
ios
::
binary
);
int
size
=
0
;
...
...
@@ -623,7 +623,7 @@ namespace AMDiS { namespace io {
if
(
nValueVectors
>
0
)
{
for
(
u
nsigned
in
t
j
=
0
;
j
<
nFeSpaces
;
j
++
)
{
for
(
u
int32_
t
j
=
0
;
j
<
nFeSpaces
;
j
++
)
{
uint32_t
nValuesPerVector
=
0
;
dataStream
.
read
(
reinterpret_cast
<
char
*>
(
&
nValuesPerVector
),
4
);
dataStream
.
seekg
(
sortedFeSpaces
[
j
].
size
()
*
8
*
nValuesPerVector
,
ios_base
::
cur
);
...
...
AMDiS/src/solver/BlockMTLMatrix.h
View file @
831ce194
...
...
@@ -33,7 +33,7 @@ namespace AMDiS {
/// A wrapper for AMDiS::SolverMatrix to be used in MTL/ITL solvers
struct
BlockMTLMatrix
{
typedef
typename
mtl
::
Collection
<
MTLTypes
::
MTLMatrix
>::
size_type
size_type
;
typedef
mtl
::
Collection
<
MTLTypes
::
MTLMatrix
>::
size_type
size_type
;
size_type
n
;
// overall number of rows
size_type
m
;
// overall number of columns
...
...
@@ -42,11 +42,11 @@ namespace AMDiS {
size_t
n_cols
;
// number of column blocks
BlockMTLMatrix
()
:
A
(
NULL
),
initialized
(
false
)
:
initialized
(
false
)
,
A
(
NULL
)
{
}
BlockMTLMatrix
(
const
SolverMatrix
<
Matrix
<
DOFMatrix
*>
>&
A_
)
:
A
(
&
A_
),
initialized
(
false
)
:
initialized
(
false
)
,
A
(
&
A_
)
{
init
();
}
...
...
@@ -163,7 +163,7 @@ namespace mtl
struct
Collection
<
AMDiS
::
BlockMTLMatrix
>
{
typedef
double
value_type
;
typedef
int
size_type
;
typedef
AMDiS
::
BlockMTLMatrix
::
size_type
size_type
;
};
namespace
ashape
...
...
AMDiS/src/solver/Mapper.h
View file @
831ce194
...
...
@@ -193,8 +193,8 @@ namespace AMDiS {
{
const
Matrix
<
DOFMatrix
*
>&
orMat
(
*
sm
.
getOriginalMat
());
for
(
int
i
=
0
;
i
<
nRowComp
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nColComp
;
j
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
nRowComp
;
i
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
nColComp
;
j
++
)
{
if
(
orMat
[
i
][
j
])
{
sizes_rows
[
i
]
=
orMat
[
i
][
j
]
->
getRowFeSpace
()
->
getAdmin
()
->
getUsedSize
();
sizes_cols
[
j
]
=
orMat
[
i
][
j
]
->
getColFeSpace
()
->
getAdmin
()
->
getUsedSize
();
...
...
@@ -202,7 +202,7 @@ namespace AMDiS {
}
nrow
+=
sizes_rows
[
i
];
}
for
(
int
j
=
0
;
j
<
nColComp
;
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
nColComp
;
j
++
)
ncol
+=
sizes_cols
[
j
];
}
...
...
AMDiS/src/solver/PetscTypes.hh
View file @
831ce194
...
...
@@ -42,7 +42,7 @@ namespace AMDiS {
bool
initMatrix
=
false
;
unsigned
nRows
(
0
);
unsigned
nEntries
(
0
);
//
unsigned nEntries(0);
std
::
vector
<
int
>
nRowsBlock
(
A
.
getNumRows
());
for
(
int
i
(
0
);
i
<
A
.
getNumRows
();
++
i
)
{
int
j
(
0
);
...
...
AMDiS/src/solver/itl/block_diagonal.hpp
View file @
831ce194
...
...
@@ -26,7 +26,7 @@ class diagonal<AMDiS::BlockMTLMatrix, mtl::Collection<AMDiS::BlockMTLMatrix>::va
for
(
size_t
i
=
0
;
i
<
A
.
n_rows
;
i
++
)
inv_diag
[
A
.
getRowRange
(
i
)]
=
mtl
::
matrix
::
diagonal
(
A
.
getSubMatrix
(
i
,
i
));
for
(
size_type
i
=
0
;
i
<
num_rows
(
A
);
++
i
)
for
(
size_type
i
=
0
;
i
<
num_rows
(
A
);
++
i
)
inv_diag
[
i
]
=
reciprocal
(
inv_diag
[
i
]);
}
...
...
AMDiS/src/time/RosenbrockAdaptInstationary.cc
View file @
831ce194
...
...
@@ -36,13 +36,13 @@ namespace AMDiS {
firstTimestep
(
true
),
lastTimestepRejected
(
false
),
succRejection
(
false
),
maxRejectedSolverError
(
3
),
fixFirstTimesteps
(
0
),
tau
(
1.0
),
tauGamma
(
1.0
),
minusTauGamma
(
-
1.0
),
invTauGamma
(
1.0
),
minusInvTauGamma
(
-
1.0
),
maxRejectedSolverError
(
3
),
dbgTimestepStudy
(
false
)
{
initConstructor
(
problemStat
);
...
...
@@ -61,13 +61,13 @@ namespace AMDiS {
firstTimestep
(
true
),
lastTimestepRejected
(
false
),
succRejection
(
false
),
maxRejectedSolverError
(
3
),
fixFirstTimesteps
(
0
),
tau
(
1.0
),
tauGamma
(
1.0
),
minusTauGamma
(
-
1.0
),
invTauGamma
(
1.0
),
minusInvTauGamma
(
-
1.0
),
maxRejectedSolverError
(
3
),
dbgTimestepStudy
(
false
)
{
initConstructor
(
&
problemStat
);
...
...
AMDiS/src/time/RosenbrockStationary.cc
View file @
831ce194
...
...
@@ -160,12 +160,12 @@ namespace AMDiS {
}
double
RosenbrockStationary
::
estimateTimeError
(
AdaptInfo
*
adaptInfo
)
void
RosenbrockStationary
::
estimateTimeError
(
AdaptInfo
*
adaptInfo
)
{
for
(
int
i
=
0
;
i
<
nComponents
;
i
++
)
{
(
*
(
lowSol
->
getDOFVector
(
i
)))
-=
(
*
(
newUn
->
getDOFVector
(
i
)));
adaptInfo
->
setTimeEstSum
(
lowSol
->
getDOFVector
(
i
)
->
L2Norm
(),
i
+
componentShift
);
}
}
}
...
...
AMDiS/src/time/RosenbrockStationary.h
View file @
831ce194
...
...
@@ -70,8 +70,8 @@ namespace AMDiS {
public:
RosenbrockStationary
(
std
::
string
name
,
int
componentShift_
=
0
)
:
ProblemStat
(
name
),
componentShift
(
componentShift_
),
first
(
true
),
componentShift
(
componentShift_
),
minusOne
(
-
1.0
),
stageTime
(
0.0
),
oldTime
(
0.0
),
...
...
@@ -88,7 +88,7 @@ namespace AMDiS {
virtual
Flag
stageIteration
(
AdaptInfo
*
adaptInfo
,
Flag
flag
,
bool
asmMatrix
,
bool
asmVector
);
virtual
double
estimateTimeError
(
AdaptInfo
*
adaptInfo
);
virtual
void
estimateTimeError
(
AdaptInfo
*
adaptInfo
);
/// update solution vector and oldTime value
void
acceptTimestep
(
AdaptInfo
*
adaptInfo
);
...
...
extensions/base_problems/PolarizationField.hh
View file @
831ce194
...
...
@@ -193,8 +193,7 @@ void PolarizationField<P>::fillLaplacian()
template
<
typename
P
>
void
PolarizationField
<
P
>::
closeTimestep
(
AdaptInfo
*
adaptInfo
)
{
FUNCNAME
(
"PolarizationField::closeTimestep()"
);
{
calcVectorField
();
for
(
size_t
i
=
0
;
i
<
self
::
dow
;
i
++
)
oldSolution
[
i
]
->
copy
(
*
self
::
prob
->
getSolution
()
->
getDOFVector
(
i
));
...
...
@@ -205,8 +204,7 @@ void PolarizationField<P>::closeTimestep(AdaptInfo *adaptInfo)
template
<
typename
P
>
void
PolarizationField
<
P
>::
writeFiles
(
AdaptInfo
*
adaptInfo
,
bool
force
)
{
FUNCNAME
(
"PolarizationField::closeTimestep()"
);
{
super
::
writeFiles
(
adaptInfo
,
force
);
self
::
fileWriter
->
writeFiles
(
adaptInfo
,
false
);
}
...
...
extensions/base_problems/QuasiCrystal.h
View file @
831ce194
...
...
@@ -27,7 +27,7 @@ namespace detail {
~
QuasiCrystal
()
{};
void
fillOperators
()
override
;
void
fillBoundaryConditions
()
{}
override
;
void
fillBoundaryConditions
()
override
{}
;
void
finalizeData
()
override
;
...
...
extensions/base_problems/QuasiCrystal.hh
View file @
831ce194
...
...
@@ -30,8 +30,7 @@ namespace AMDiS { namespace base_problems {
template
<
typename
P
>
void
QuasiCrystal
<
P
>::
fillOperators
()
{
FUNCNAME
(
"QuasiCrystal::fillOperators()"
);
{
const
FiniteElemSpace
*
feSpace
=
self
::
getFeSpace
(
0
);
DOFVector
<
double
>*
rho
=
self
::
prob
->
getSolution
()
->
getDOFVector
(
0
);
...
...
extensions/preconditioner/PetscPreconPfc.cc
View file @
831ce194
...
...
@@ -23,8 +23,7 @@ namespace AMDiS {
/// solve Pfc Preconditioner
PetscErrorCode
pcPfcShell
(
PC
pc
,
Vec
b
,
Vec
x
)
// solve Px=b
{
FUNCNAME
(
"pcPfcShell()"
);
{
void
*
ctx
;
PCShellGetContext
(
pc
,
&
ctx
);
PfcData
*
data
=
static_cast
<
PfcData
*>
(
ctx
);
...
...
@@ -130,9 +129,7 @@ namespace AMDiS {
void
PetscPreconPfc
::
exit
()
{
FUNCNAME
(
"PetscPreconPfc::exit()"
);
{
MatDestroy
(
&
MpK
);
MatDestroy
(
&
MpK2
);
...
...
extensions/preconditioner/PetscPreconPfcDiag.cc
View file @
831ce194
...
...
@@ -23,8 +23,7 @@ namespace AMDiS {
/// solve Pfc Preconditioner
PetscErrorCode
pcPfcDiagShell
(
PC
pc
,
Vec
b
,
Vec
x
)
// solve Px=b
{
FUNCNAME
(
"pcPfcShell()"
);
{
void
*
ctx
;
PCShellGetContext
(
pc
,
&
ctx
);
PfcDiagData
*
data
=
static_cast
<
PfcDiagData
*>
(
ctx
);
...
...
@@ -143,9 +142,7 @@ namespace AMDiS {
void
PetscPreconPfcDiag
::
exit
()
{
FUNCNAME
(
"PetscPreconPfcDiag::exit()"
);
{
MatDestroy
(
&
MpK
);
MatDestroy
(
&
matS
);
...
...
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