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
37ff8894
Commit
37ff8894
authored
Apr 27, 2009
by
Thomas Witkowski
Browse files
Nothing really important
parent
50c856b0
Changes
4
Show whitespace changes
Inline
Side-by-side
AMDiS/src/BasisFunction.h
View file @
37ff8894
...
@@ -168,54 +168,38 @@ namespace AMDiS {
...
@@ -168,54 +168,38 @@ namespace AMDiS {
*/
*/
virtual
void
getBound
(
const
ElInfo
*
,
BoundaryType
*
)
const
{};
virtual
void
getBound
(
const
ElInfo
*
,
BoundaryType
*
)
const
{};
/** \brief
/// Returns \ref degree of BasisFunction
* Returns \ref degree of BasisFunction
*/
inline
const
int
getDegree
()
const
{
inline
const
int
getDegree
()
const
{
return
degree
;
return
degree
;
}
}
/** \brief
/// Returns \ref dim of BasisFunction
* Returns \ref dim of BasisFunction
*/
inline
const
int
getDim
()
const
{
inline
const
int
getDim
()
const
{
return
dim
;
return
dim
;
}
}
/** \brief
/// Returns \ref nBasFcts which is the number of local basis functions
* Returns \ref nBasFcts which is the number of local basis functions
*/
inline
const
int
getNumber
()
const
{
inline
const
int
getNumber
()
const
{
return
nBasFcts
;
return
nBasFcts
;
}
}
/** \brief
/// Returns \ref name of BasisFunction
* Returns \ref name of BasisFunction
*/
inline
const
std
::
string
&
getName
()
const
{
inline
const
std
::
string
&
getName
()
const
{
return
name
;
return
name
;
}
}
/** \brief
/// Returns \ref nDOF[i]
* Returns \ref nDOF[i]
*/
int
getNumberOfDOFs
(
int
i
)
const
;
int
getNumberOfDOFs
(
int
i
)
const
;
/** \brief
/// Returns \ref nDOF
* Returns \ref nDOF
*/
inline
DimVec
<
int
>*
getNumberOfDOFs
()
const
{
inline
DimVec
<
int
>*
getNumberOfDOFs
()
const
{
return
nDOF
;
return
nDOF
;
}
}
/** \brief
/// Initialisation of the \ref nDOF vector. Must be implemented by sub classes
* Initialisation of the \ref nDOF vector. Must be implemented by sub classes
*/
virtual
void
setNDOF
()
=
0
;
virtual
void
setNDOF
()
=
0
;
/** \brief
/// Returns the barycentric coordinates of the i-th basis function.
* Returns the barycentric coordinates of the i-th basis function.
*/
virtual
DimVec
<
double
>
*
getCoords
(
int
i
)
const
=
0
;
virtual
DimVec
<
double
>
*
getCoords
(
int
i
)
const
=
0
;
/** \brief
/** \brief
...
...
AMDiS/src/ElInfo1d.cc
View file @
37ff8894
...
@@ -271,17 +271,32 @@ namespace AMDiS {
...
@@ -271,17 +271,32 @@ namespace AMDiS {
void
ElInfo1d
::
getRefSimplexCoords
(
const
BasisFunction
*
basisFcts
,
void
ElInfo1d
::
getRefSimplexCoords
(
const
BasisFunction
*
basisFcts
,
DimMat
<
double
>
*
coords
)
const
DimMat
<
double
>
*
coords
)
const
{
{
FUNCNAME
(
"ElInfo1d::getRefSimplexCoords()"
);
switch
(
basisFcts
->
getDegree
())
{
case
1
:
(
*
coords
)[
0
][
0
]
=
1.0
;
(
*
coords
)[
0
][
0
]
=
1.0
;
(
*
coords
)[
1
][
0
]
=
0.0
;
(
*
coords
)[
1
][
0
]
=
0.0
;
(
*
coords
)[
0
][
1
]
=
0.0
;
(
*
coords
)[
0
][
1
]
=
0.0
;
(
*
coords
)[
1
][
1
]
=
1.0
;
(
*
coords
)[
1
][
1
]
=
1.0
;
break
;
case
2
:
ERROR_EXIT
(
"DDA
\n
"
);
break
;
default:
ERROR_EXIT
(
"Not yet implemented!
\n
"
);
}
}
}
void
ElInfo1d
::
getSubElementCoords
(
const
BasisFunction
*
basisFcts
,
void
ElInfo1d
::
getSubElementCoords
(
const
BasisFunction
*
basisFcts
,
int
iChild
,
int
iChild
,
DimMat
<
double
>
*
coords
)
const
DimMat
<
double
>
*
coords
)
const
{
{
FUNCNAME
(
"ElInfo1d::getSubElementCoords()"
);
switch
(
basisFcts
->
getDegree
())
{
case
1
:
if
(
iChild
==
0
)
{
if
(
iChild
==
0
)
{
(
*
coords
)[
0
][
1
]
=
((
*
coords
)[
0
][
0
]
+
(
*
coords
)[
0
][
1
])
*
0.5
;
(
*
coords
)[
0
][
1
]
=
((
*
coords
)[
0
][
0
]
+
(
*
coords
)[
0
][
1
])
*
0.5
;
(
*
coords
)[
1
][
1
]
=
((
*
coords
)[
1
][
0
]
+
(
*
coords
)[
1
][
1
])
*
0.5
;
(
*
coords
)[
1
][
1
]
=
((
*
coords
)[
1
][
0
]
+
(
*
coords
)[
1
][
1
])
*
0.5
;
...
@@ -289,6 +304,12 @@ namespace AMDiS {
...
@@ -289,6 +304,12 @@ namespace AMDiS {
(
*
coords
)[
0
][
0
]
=
((
*
coords
)[
0
][
0
]
+
(
*
coords
)[
0
][
1
])
*
0.5
;
(
*
coords
)[
0
][
0
]
=
((
*
coords
)[
0
][
0
]
+
(
*
coords
)[
0
][
1
])
*
0.5
;
(
*
coords
)[
1
][
0
]
=
((
*
coords
)[
1
][
0
]
+
(
*
coords
)[
1
][
1
])
*
0.5
;
(
*
coords
)[
1
][
0
]
=
((
*
coords
)[
1
][
0
]
+
(
*
coords
)[
1
][
1
])
*
0.5
;
}
}
break
;
case
2
:
break
;
default:
ERROR_EXIT
(
"Not yet implemented!
\n
"
);
}
}
}
}
}
AMDiS/src/FixVec.h
View file @
37ff8894
...
@@ -22,10 +22,6 @@
...
@@ -22,10 +22,6 @@
#ifndef AMDIS_FIXVEC_H
#ifndef AMDIS_FIXVEC_H
#define AMDIS_FIXVEC_H
#define AMDIS_FIXVEC_H
// ===========================================================================
// ===== includes ============================================================
// ===========================================================================
#include
"Global.h"
#include
"Global.h"
#include
"MemoryManager.h"
#include
"MemoryManager.h"
#include
<iostream>
#include
<iostream>
...
@@ -33,20 +29,11 @@
...
@@ -33,20 +29,11 @@
namespace
AMDiS
{
namespace
AMDiS
{
// ===========================================================================
// ===== forward declarations ================================================
// ===========================================================================
class
Mesh
;
class
Mesh
;
template
<
typename
T
>
class
DimMat
;
template
<
typename
T
>
class
DimMat
;
template
<
typename
T
>
class
WorldVector
;
template
<
typename
T
>
class
WorldVector
;
template
<
typename
T
>
class
WorldMatrix
;
template
<
typename
T
>
class
WorldMatrix
;
// ===========================================================================
// ===== definitions =========================================================
// ===========================================================================
/** determines how to initialize a FixVec when constructed */
/** determines how to initialize a FixVec when constructed */
enum
InitType
enum
InitType
{
{
...
@@ -57,10 +44,6 @@ namespace AMDiS {
...
@@ -57,10 +44,6 @@ namespace AMDiS {
UNIT_MATRIX
=
4
/**< values at the diagonal of a matrix are set to one */
UNIT_MATRIX
=
4
/**< values at the diagonal of a matrix are set to one */
};
};
// ===========================================================================
// ===== class FixVec ========================================================
// ===========================================================================
/** \ingroup Common
/** \ingroup Common
* \brief
* \brief
* A FixVec is a template vector of a fixed size.
* A FixVec is a template vector of a fixed size.
...
@@ -361,10 +344,6 @@ namespace AMDiS {
...
@@ -361,10 +344,6 @@ namespace AMDiS {
};
};
// ===========================================================================
// ===== class DimVec ========================================================
// ===========================================================================
/** \ingroup Common
/** \ingroup Common
* \brief
* \brief
* A DimVec is a FixVec with dim + 1 entries. It can be used for storing
* A DimVec is a FixVec with dim + 1 entries. It can be used for storing
...
@@ -397,9 +376,6 @@ namespace AMDiS {
...
@@ -397,9 +376,6 @@ namespace AMDiS {
void
multMatrixVec
(
DimMat
<
T
>
&
m
,
DimVec
<
T
>
&
v
);
void
multMatrixVec
(
DimMat
<
T
>
&
m
,
DimVec
<
T
>
&
v
);
};
};
// ===========================================================================
// ===== class DimMat ========================================================
// ===========================================================================
/** \ingroup Common
/** \ingroup Common
* \brief
* \brief
...
@@ -411,16 +387,12 @@ namespace AMDiS {
...
@@ -411,16 +387,12 @@ namespace AMDiS {
public:
public:
MEMORY_MANAGED
(
DimMat
<
T
>
);
MEMORY_MANAGED
(
DimMat
<
T
>
);
/** \brief
/// Calls the corresponding constructor of VectorOfFixVecs
* Calls the corresponding constructor of VectorOfFixVecs
*/
DimMat
(
int
dim
,
InitType
initType
=
NO_INIT
)
DimMat
(
int
dim
,
InitType
initType
=
NO_INIT
)
:
Matrix
<
T
>
(
dim
+
1
,
dim
+
1
)
:
Matrix
<
T
>
(
dim
+
1
,
dim
+
1
)
{}
{}
/** \brief
/// Calls the corresponding constructor of VectorOfFixVecs
* Calls the corresponding constructor of VectorOfFixVecs
*/
DimMat
(
int
dim
,
InitType
initType
,
const
T
&
ini
)
DimMat
(
int
dim
,
InitType
initType
,
const
T
&
ini
)
:
Matrix
<
T
>
(
dim
+
1
,
dim
+
1
)
:
Matrix
<
T
>
(
dim
+
1
,
dim
+
1
)
{
{
...
@@ -429,9 +401,7 @@ namespace AMDiS {
...
@@ -429,9 +401,7 @@ namespace AMDiS {
this
->
set
(
ini
);
this
->
set
(
ini
);
}
}
/** \brief
/// Calls the corresponding constructor of VectorOfFixVecs
* Calls the corresponding constructor of VectorOfFixVecs
*/
DimMat
(
int
dim
,
InitType
initType
,
T
*
ini
)
DimMat
(
int
dim
,
InitType
initType
,
T
*
ini
)
:
Matrix
<
T
>
(
dim
+
1
,
dim
+
1
)
:
Matrix
<
T
>
(
dim
+
1
,
dim
+
1
)
{
{
...
...
AMDiS/src/MatrixVector.h
View file @
37ff8894
...
@@ -31,22 +31,14 @@ namespace AMDiS {
...
@@ -31,22 +31,14 @@ namespace AMDiS {
template
<
typename
T
>
class
DOFVector
;
template
<
typename
T
>
class
DOFVector
;
// ============================================================================
/// Class for efficient vector operations of fixed size numerical vectors.
// ===== class Vector =========================================================
// ============================================================================
/** \brief
* Class for efficient vector operations of fixed size numerical vectors.
*/
template
<
typename
T
>
template
<
typename
T
>
class
Vector
:
public
Serializable
class
Vector
:
public
Serializable
{
{
public:
public:
MEMORY_MANAGED
(
Vector
<
T
>
);
MEMORY_MANAGED
(
Vector
<
T
>
);
/** \brief
/// Constructor.
* Constructor.
*/
Vector
(
int
i
=
0
)
Vector
(
int
i
=
0
)
:
size
(
i
)
:
size
(
i
)
{
{
...
@@ -60,9 +52,7 @@ namespace AMDiS {
...
@@ -60,9 +52,7 @@ namespace AMDiS {
return
(
valArray
!=
NULL
);
return
(
valArray
!=
NULL
);
}
}
/** \brief
/// Change the size of the vector to newSize.
* Change the size of the vector to newSize.
*/
inline
void
resize
(
int
newSize
)
{
inline
void
resize
(
int
newSize
)
{
if
(
size
!=
newSize
)
{
if
(
size
!=
newSize
)
{
if
(
valArray
)
if
(
valArray
)
...
@@ -72,9 +62,7 @@ namespace AMDiS {
...
@@ -72,9 +62,7 @@ namespace AMDiS {
}
}
}
}
/** \brief
/// Copy constructor.
* Copy constructor.
*/
Vector
(
const
Vector
<
T
>&
rhs
)
Vector
(
const
Vector
<
T
>&
rhs
)
:
Serializable
(),
size
(
rhs
.
size
)
:
Serializable
(),
size
(
rhs
.
size
)
{
{
...
@@ -82,16 +70,12 @@ namespace AMDiS {
...
@@ -82,16 +70,12 @@ namespace AMDiS {
*
this
=
rhs
;
// uses operator=()
*
this
=
rhs
;
// uses operator=()
}
}
/** \brief
/// Destructor.
* Destructor.
*/
virtual
~
Vector
()
{
virtual
~
Vector
()
{
delete
[]
valArray
;
delete
[]
valArray
;
}
}
/** \brief
/// Assignement operator
* Assignement operator
*/
inline
const
Vector
<
T
>&
operator
=
(
const
Vector
<
T
>&
rhs
)
{
inline
const
Vector
<
T
>&
operator
=
(
const
Vector
<
T
>&
rhs
)
{
TEST_EXIT_DBG
(
rhs
.
size
==
size
)(
"invalid size
\n
"
);
TEST_EXIT_DBG
(
rhs
.
size
==
size
)(
"invalid size
\n
"
);
T
*
rhsIt
,
*
thisIt
;
T
*
rhsIt
,
*
thisIt
;
...
@@ -104,9 +88,7 @@ namespace AMDiS {
...
@@ -104,9 +88,7 @@ namespace AMDiS {
return
*
this
;
return
*
this
;
}
}
/** \brief
/// Assignement operator
* Assignement operator
*/
inline
const
Vector
<
T
>&
operator
=
(
const
T
&
scal
)
{
inline
const
Vector
<
T
>&
operator
=
(
const
T
&
scal
)
{
T
*
thisIt
;
T
*
thisIt
;
for
(
thisIt
=
this
->
begin
();
for
(
thisIt
=
this
->
begin
();
...
@@ -118,9 +100,7 @@ namespace AMDiS {
...
@@ -118,9 +100,7 @@ namespace AMDiS {
return
*
this
;
return
*
this
;
}
}
/** \brief
/// Assignement operator
* Assignement operator
*/
inline
const
Vector
<
T
>&
operator
=
(
const
T
*
vec
)
{
inline
const
Vector
<
T
>&
operator
=
(
const
T
*
vec
)
{
T
*
thisIt
;
T
*
thisIt
;
const
T
*
vecIt
;
const
T
*
vecIt
;
...
@@ -133,16 +113,12 @@ namespace AMDiS {
...
@@ -133,16 +113,12 @@ namespace AMDiS {
return
*
this
;
return
*
this
;
}
}
/** \brief
/// Sets all entries to scal.
* Sets all entries to scal.
*/
inline
const
Vector
<
T
>&
set
(
const
T
&
scal
)
{
inline
const
Vector
<
T
>&
set
(
const
T
&
scal
)
{
return
*
this
=
scal
;
return
*
this
=
scal
;
}
}
/** \brief
/// Sets all entries.
* Sets all entries.
*/
inline
const
Vector
<
T
>&
setValues
(
const
T
*
values
)
{
inline
const
Vector
<
T
>&
setValues
(
const
T
*
values
)
{
T
*
thisIt
;
T
*
thisIt
;
const
T
*
valuesIt
;
const
T
*
valuesIt
;
...
@@ -155,18 +131,14 @@ namespace AMDiS {
...
@@ -155,18 +131,14 @@ namespace AMDiS {
return
*
this
;
return
*
this
;
}
}
/** \brief
/// Sets all entries.
* Sets all entries.
*/
inline
void
fill
(
const
T
value
)
{
inline
void
fill
(
const
T
value
)
{
for
(
T
*
thisIt
=
this
->
begin
();
thisIt
!=
this
->
end
();
thisIt
++
)
{
for
(
T
*
thisIt
=
this
->
begin
();
thisIt
!=
this
->
end
();
thisIt
++
)
{
*
thisIt
=
value
;
*
thisIt
=
value
;
}
}
}
}
/** \brief
/// Comparison operator.
* Comparison operator.
*/
inline
bool
operator
==
(
const
Vector
<
T
>&
rhs
)
const
{
inline
bool
operator
==
(
const
Vector
<
T
>&
rhs
)
const
{
if
(
size
!=
rhs
.
size
)
return
false
;
if
(
size
!=
rhs
.
size
)
return
false
;
T
*
rhsIt
,
*
thisIt
;
T
*
rhsIt
,
*
thisIt
;
...
@@ -179,53 +151,39 @@ namespace AMDiS {
...
@@ -179,53 +151,39 @@ namespace AMDiS {
return
true
;
return
true
;
}
}
/** \brief
/// Comparison operator.
* Comparison operator.
*/
inline
bool
operator
!=
(
const
Vector
<
T
>&
rhs
)
const
{
inline
bool
operator
!=
(
const
Vector
<
T
>&
rhs
)
const
{
return
!
(
*
this
==
rhs
);
return
!
(
*
this
==
rhs
);
}
}
/** \brief
/// Access to the i-th vector element.
* Access to the i-th vector element.
*/
inline
T
&
operator
[](
int
i
)
{
inline
T
&
operator
[](
int
i
)
{
TEST_EXIT_DBG
(
i
<
size
&&
i
>=
0
)(
"invalid index
\n
"
);
TEST_EXIT_DBG
(
i
<
size
&&
i
>=
0
)(
"invalid index
\n
"
);
return
valArray
[
i
];
return
valArray
[
i
];
}
}
/** \brief
/// Access to the i-th vector element for const vectors.
* Access to the i-th vector element for const vectors.
*/
inline
const
T
&
operator
[]
(
int
i
)
const
{
inline
const
T
&
operator
[]
(
int
i
)
const
{
TEST_EXIT_DBG
(
i
<
size
&&
i
>=
0
)(
"invalid index
\n
"
);
TEST_EXIT_DBG
(
i
<
size
&&
i
>=
0
)(
"invalid index
\n
"
);
return
valArray
[
i
];
return
valArray
[
i
];
}
}
/** \brief
/// Returns pointer to the first vector element.
* Returns pointer to the first vector element.
*/
inline
T
*
begin
()
const
{
inline
T
*
begin
()
const
{
return
valArray
;
return
valArray
;
}
}
/** \brief
/// Returns pointer after the last vector element.
* Returns pointer after the last vector element.
*/
inline
T
*
end
()
const
{
inline
T
*
end
()
const
{
return
valArray
+
size
;
return
valArray
+
size
;
}
}
/** \brief
/// Returns \ref size.
* Returns \ref size.
*/
virtual
int
getSize
()
const
{
virtual
int
getSize
()
const
{
return
size
;
return
size
;
}
}
/** \brief
/// Returns \ref valArray as T-array
* Returns \ref valArray as T-array
*/
inline
T
*
getValArray
()
{
inline
T
*
getValArray
()
{
return
valArray
;
return
valArray
;
}
}
...
@@ -238,8 +196,6 @@ namespace AMDiS {
...
@@ -238,8 +196,6 @@ namespace AMDiS {
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
}
}
// ===== Serializable implementation =====
void
serialize
(
std
::
ostream
&
out
)
{
void
serialize
(
std
::
ostream
&
out
)
{
out
.
write
(
reinterpret_cast
<
const
char
*>
(
&
size
),
sizeof
(
int
));
out
.
write
(
reinterpret_cast
<
const
char
*>
(
&
size
),
sizeof
(
int
));
out
.
write
(
reinterpret_cast
<
const
char
*>
(
valArray
),
size
*
sizeof
(
T
));
out
.
write
(
reinterpret_cast
<
const
char
*>
(
valArray
),
size
*
sizeof
(
T
));
...
@@ -255,44 +211,29 @@ namespace AMDiS {
...
@@ -255,44 +211,29 @@ namespace AMDiS {
}
}
protected:
protected:
/** \brief
/// Size of the vector.
* Size of the vector.
*/
int
size
;
int
size
;
/** \brief
/// Internal storage pointer.
* Internal storage pointer.
*/
T
*
valArray
;
T
*
valArray
;
};
};
/// Class for efficient matrix operations of fixed size numerical matrices.
// ============================================================================
// ===== class Matrix =========================================================
// ============================================================================
/** \brief
* Class for efficient matrix operations of fixed size numerical matrices.
*/
template
<
typename
T
>
template
<
typename
T
>
class
Matrix
:
public
Vector
<
T
>
class
Matrix
:
public
Vector
<
T
>
{
{
public:
public:
MEMORY_MANAGED
(
Matrix
<
T
>
);
MEMORY_MANAGED
(
Matrix
<
T
>
);
/** \brief
/// Constructor.
* Constructor.
*/
Matrix
(
int
r
,
int
c
)
Matrix
(
int
r
,
int
c
)
:
Vector
<
T
>
(
r
*
c
),
:
Vector
<
T
>
(
r
*
c
),
rows
(
r
),
rows
(
r
),
cols
(
c
)
cols
(
c
)
{}
{}
/** \brief
/// Changes the size of the matrix to newRows x newCols.
* Changes the size of the matrix to newRows x newCols.
*/
inline
void
resize
(
int
newRows
,
int
newCols
)
{
inline
void
resize
(
int
newRows
,
int
newCols
)
{
if
((
newRows
!=
rows
)
||
(
newCols
!=
cols
))
{
if
((
newRows
!=
rows
)
||
(
newCols
!=
cols
))
{
Vector
<
T
>::
resize
(
newRows
*
newCols
);
Vector
<
T
>::
resize
(
newRows
*
newCols
);
...
@@ -301,64 +242,49 @@ namespace AMDiS {
...
@@ -301,64 +242,49 @@ namespace AMDiS {
}
}
}
}