Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amdis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
iwr
amdis
Commits
f0dbbad4
Commit
f0dbbad4
authored
May 19, 2015
by
Praetorius, Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
matrix*vector in expressions allowed
parent
f5e1e642
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
119 additions
and
86 deletions
+119
-86
AMDiS/CMakeLists.txt
AMDiS/CMakeLists.txt
+4
-0
AMDiS/src/DOFIndexed.h
AMDiS/src/DOFIndexed.h
+42
-0
AMDiS/src/DOFVector.h
AMDiS/src/DOFVector.h
+1
-38
AMDiS/src/DOFVector.hh
AMDiS/src/DOFVector.hh
+1
-5
AMDiS/src/FixVec.h
AMDiS/src/FixVec.h
+0
-3
AMDiS/src/MatrixVector.h
AMDiS/src/MatrixVector.h
+60
-38
AMDiS/src/Traits.h
AMDiS/src/Traits.h
+11
-2
No files found.
AMDiS/CMakeLists.txt
View file @
f0dbbad4
...
...
@@ -651,6 +651,10 @@ FILE(GLOB HEADERS "${SOURCE_DIR}/*.hh")
INSTALL
(
FILES
${
HEADERS
}
DESTINATION include/amdis/
)
FILE
(
GLOB HEADERS
"
${
SOURCE_DIR
}
/*.hpp"
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION include/amdis/
)
FILE
(
GLOB HEADERS
"
${
SOURCE_DIR
}
/parallel/*.h"
)
INSTALL
(
FILES
${
HEADERS
}
DESTINATION include/amdis/parallel/
)
...
...
AMDiS/src/DOFIndexed.h
View file @
f0dbbad4
...
...
@@ -33,6 +33,15 @@
namespace
AMDiS
{
/// Specifies which operation should be done after coarsening
typedef
enum
{
NO_OPERATION
=
0
,
COARSE_RESTRICT
=
1
,
COARSE_INTERPOL
=
2
,
REFINE_INTERPOL
=
4
}
RefineCoarsenOperation
;
/** \ingroup DOFAdministration
* \brief
* Interface for objects that stores information indexed by DOF indices
...
...
@@ -42,6 +51,10 @@ namespace AMDiS {
class
DOFIndexedBase
{
public:
DOFIndexedBase
()
:
coarsenOperation
(
COARSE_INTERPOL
),
refineOperation
(
REFINE_INTERPOL
)
{}
virtual
~
DOFIndexedBase
()
{}
/// Returns the actual size. Must be overriden by sub classes
...
...
@@ -74,9 +87,38 @@ namespace AMDiS {
/// The default behavior is to do nothing.
virtual
void
coarseRestrict
(
RCNeighbourList
&
,
int
)
{}
/// Sets \ref coarsenOperation to op
inline
void
setCoarsenOperation
(
RefineCoarsenOperation
op
)
{
coarsenOperation
=
op
;
}
/// Returns \ref coarsenOperation
inline
RefineCoarsenOperation
getCoarsenOperation
()
{
return
coarsenOperation
;
}
/// Sets \ref refineOperation to op
inline
void
setRefineOperation
(
RefineCoarsenOperation
op
)
{
refineOperation
=
op
;
}
/// Returns \ref refineOperation
inline
RefineCoarsenOperation
getRefineOperation
()
{
return
refineOperation
;
}
/// Returns the finite element space of this DOFIndexed object. Must be
/// overriden in sub classes.
virtual
const
FiniteElemSpace
*
getFeSpace
()
const
=
0
;
protected:
/// Specifies what operation should be performed after coarsening
RefineCoarsenOperation
coarsenOperation
;
RefineCoarsenOperation
refineOperation
;
};
/** \ingroup DOFAdministration
...
...
AMDiS/src/DOFVector.h
View file @
f0dbbad4
...
...
@@ -276,14 +276,6 @@ namespace AMDiS {
};
/// Specifies which operation should be done after coarsening
typedef
enum
{
NO_OPERATION
=
0
,
COARSE_RESTRICT
=
1
,
COARSE_INTERPOL
=
2
,
REFINE_INTERPOL
=
4
}
RefineCoarsenOperation
;
/** \ingroup DOFAdministration
* \brief
...
...
@@ -345,8 +337,7 @@ namespace AMDiS {
public:
/// Empty constructor. No initialization!
DOFVector
()
:
DOFVectorBase
<
T
>
(),
coarsenOperation
(
NO_OPERATION
)
:
DOFVectorBase
<
T
>
()
{}
/// Constructs a DOFVector with name n belonging to FiniteElemSpace f
...
...
@@ -395,30 +386,6 @@ namespace AMDiS {
/// \ref DOFIndexedBase::compress()
virtual
void
compressDOFIndexed
(
int
first
,
int
last
,
std
::
vector
<
DegreeOfFreedom
>
&
newDof
);
/// Sets \ref coarsenOperation to op
inline
void
setCoarsenOperation
(
RefineCoarsenOperation
op
)
{
coarsenOperation
=
op
;
}
/// Returns \ref coarsenOperation
inline
RefineCoarsenOperation
getCoarsenOperation
()
{
return
coarsenOperation
;
}
/// Sets \ref refineOperation to op
inline
void
setRefineOperation
(
RefineCoarsenOperation
op
)
{
refineOperation
=
op
;
}
/// Returns \ref refineOperation
inline
RefineCoarsenOperation
getRefineOperation
()
{
return
refineOperation
;
}
/// Restriction after coarsening. Implemented for DOFVector<double>
inline
void
coarseRestrict
(
RCNeighbourList
&
,
int
)
{}
...
...
@@ -672,10 +639,6 @@ namespace AMDiS {
/// Data container
std
::
vector
<
T
>
vec
;
/// Specifies what operation should be performed after coarsening
RefineCoarsenOperation
coarsenOperation
;
RefineCoarsenOperation
refineOperation
;
};
...
...
AMDiS/src/DOFVector.hh
View file @
f0dbbad4
...
...
@@ -112,9 +112,7 @@ namespace AMDiS {
template
<
typename
T
>
DOFVector
<
T
>::
DOFVector
(
const
FiniteElemSpace
*
f
,
std
::
string
n
,
bool
addToSynch
)
:
DOFVectorBase
<
T
>
(
f
,
n
),
coarsenOperation
(
COARSE_INTERPOL
),
refineOperation
(
REFINE_INTERPOL
)
:
DOFVectorBase
<
T
>
(
f
,
n
)
{
vec
.
resize
(
0
);
init
(
f
,
n
,
addToSynch
);
...
...
@@ -1041,8 +1039,6 @@ namespace AMDiS {
this
->
nBasFcts
=
rhs
.
nBasFcts
;
vec
=
rhs
.
vec
;
this
->
elementVector
.
change_dim
(
this
->
nBasFcts
);
coarsenOperation
=
rhs
.
coarsenOperation
;
refineOperation
=
rhs
.
refineOperation
;
this
->
operators
=
rhs
.
operators
;
this
->
operatorFactor
=
rhs
.
operatorFactor
;
...
...
AMDiS/src/FixVec.h
View file @
f0dbbad4
...
...
@@ -108,9 +108,6 @@ namespace AMDiS {
else
return
Global
::
getGeo
(
d
,
dim
);
}
public:
friend
class
GLWindow
;
};
...
...
AMDiS/src/MatrixVector.h
View file @
f0dbbad4
...
...
@@ -59,26 +59,26 @@ namespace AMDiS {
/// Copy constructor for other of different value_type
// TODO: notwendig?
template
<
typename
S
>
Vector
(
Vector
<
S
>
const
&
rhs
)
:
Serializable
(),
size
(
rhs
.
getSize
()),
valArray
(
new
T
[
rhs
.
getSize
()]
)
{
setValues
(
rhs
.
getValArray
()
);
}
//
template <typename S>
//
Vector(Vector<S> const& rhs)
//
: Serializable(),
//
size(rhs.getSize()),
// valArray(size ? new T[size] : NULL
)
//
{
// setValues(rhs.valArray
);
//
}
#if HAS_RVALUE_REFERENCES
/// move constructor
Vector
(
self
&&
other
)
:
Vector
()
{
swap
(
*
this
,
other
);
}
#endif
//
#if HAS_RVALUE_REFERENCES
//
/// move constructor
//
Vector(self&& other)
//
: Vector()
//
{
//
swap(*this, other);
//
}
//
#endif
/// Destructor.
~
Vector
()
virtual
~
Vector
()
{
if
(
valArray
!=
NULL
)
{
delete
[]
valArray
;
...
...
@@ -92,13 +92,13 @@ namespace AMDiS {
}
/// Change the size of the vector to newSize.
inline
void
resize
(
int
newSize
)
inline
void
resize
(
int
s
)
{
if
(
size
!=
newSize
&&
newSize
>
0
)
{
if
(
size
!=
s
&&
s
>
0
)
{
if
(
valArray
!=
NULL
)
delete
[]
valArray
;
valArray
=
new
T
[
newSize
];
size
=
newSize
;
valArray
=
new
T
[
s
];
size
=
s
;
}
}
...
...
@@ -107,15 +107,21 @@ namespace AMDiS {
typename
disable_if
<
boost
::
is_same
<
S
,
T
>
,
self
>::
type
&
operator
=
(
Vector
<
S
>
const
&
other
)
{
resize
(
other
.
getSize
());
assert
(
size
==
other
.
getSize
()
);
// resize(other.getSize());
setValues
(
other
.
getValArray
());
return
*
this
;
}
/// copy assignment operator
self
&
operator
=
(
self
other
)
// self& operator=(self other)
// {
// swap(*this, other);
self
&
operator
=
(
self
const
&
other
)
{
swap
(
*
this
,
other
);
assert
(
size
==
other
.
getSize
()
);
setValues
(
other
.
getValArray
());
return
*
this
;
}
...
...
@@ -149,14 +155,22 @@ namespace AMDiS {
typename
enable_if
<
boost
::
is_convertible
<
S
,
T
>
>::
type
set
(
S
value
)
{
std
::
fill
(
begin
(),
end
(),
value
);
for
(
T
*
thisIt
=
this
->
begin
();
thisIt
!=
this
->
end
();
++
thisIt
)
*
thisIt
=
value
;
// std::fill(begin(), end(), value);
}
/// Sets all entries.
template
<
typename
S
>
void
setValues
(
const
S
*
values
)
inline
void
setValues
(
const
S
*
values
)
{
std
::
copy
(
values
,
values
+
size
,
valArray
);
T
*
thisIt
;
const
S
*
valuesIt
;
for
(
thisIt
=
this
->
begin
(),
valuesIt
=
values
;
thisIt
!=
this
->
end
();
++
thisIt
,
++
valuesIt
)
*
thisIt
=
*
valuesIt
;
// std::copy(values, values + size, valArray);
}
/// Comparison operator.
...
...
@@ -275,14 +289,14 @@ namespace AMDiS {
cols
(
other
.
getNumCols
())
{
}
#if HAS_RVALUE_REFERENCES
/// move constructor
Matrix
(
self
&&
other
)
:
Matrix
()
{
swap
(
*
this
,
other
);
}
#endif
//
#if HAS_RVALUE_REFERENCES
//
/// move constructor
//
Matrix(self&& other)
//
: Matrix()
//
{
//
swap(*this, other);
//
}
//
#endif
/// Changes the size of the matrix to newRows x newCols.
inline
void
resize
(
int
newRows
,
int
newCols
)
...
...
@@ -294,9 +308,16 @@ namespace AMDiS {
}
}
self
&
operator
=
(
self
other
)
// self& operator=(self other)
// {
// swap(*this, other);
// return *this;
// }
self
&
operator
=
(
self
const
&
other
)
{
swap
(
*
this
,
other
);
assert
(
this
->
size
==
other
.
getSize
()
&&
rows
==
other
.
getNumRows
()
&&
cols
==
other
.
getNumCols
()
);
this
->
setValues
(
other
.
getValArray
());
return
*
this
;
}
...
...
@@ -304,7 +325,8 @@ namespace AMDiS {
template
<
typename
S
>
inline
self
&
operator
=
(
const
Matrix
<
S
>&
other
)
{
resize
(
other
.
getNumRows
(),
other
.
getNumCols
());
assert
(
rows
==
other
.
getNumRows
()
&&
cols
==
other
.
getNumCols
()
);
// resize(other.getNumRows(), other.getNumCols());
this
->
setValues
(
other
.
getValArray
());
return
*
this
;
}
...
...
AMDiS/src/Traits.h
View file @
f0dbbad4
...
...
@@ -55,7 +55,7 @@ namespace AMDiS
typedef
typename
boost
::
mpl
::
if_c
<
(
sizeof
(
T1
)
>
sizeof
(
T2
)),
T1
,
T2
>::
type
type
;
};
#if
def HAS_CPP11
_DECLTYPE
#if
HAS
_DECLTYPE
/// determines the type of the product T1*T2
template
<
typename
T1
,
typename
T2
>
...
...
@@ -158,6 +158,15 @@ namespace AMDiS
};
/// Matrix*Vector => Vector
template
<
template
<
class
>
class
MatrixType
,
typename
T1
,
template
<
class
>
class
VectorType
,
typename
T2
>
struct
mult_type_dispatch
<
MatrixType
<
T1
>
,
VectorType
<
T2
>
,
tag
::
matrix
,
tag
::
vector
>
{
typedef
typename
mult_type
<
T1
,
T2
>::
type
value_type
;
typedef
VectorType
<
value_type
>
type
;
};
// addition types
// _________________________________________________________________________
template
<
typename
T1
,
typename
T2
,
typename
Category1
,
typename
Category2
>
...
...
@@ -215,7 +224,7 @@ namespace AMDiS
typedef
Container
<
value_type
>
type
;
};
#endif // endif(HAS_
CPP11_
DECLTYPE)
#endif // endif(HAS_DECLTYPE)
}
// end namespace traits
...
...
Write
Preview
Markdown
is supported
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