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
amdis
amdis-core
Commits
c4620783
Commit
c4620783
authored
Sep 12, 2018
by
Praetorius, Simon
Browse files
Changed template parameter of DOFVector to GlobalBasis + Range
parent
9d6a1e4c
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/amdis/DirichletBC.hpp
View file @
c4620783
...
...
@@ -82,13 +82,13 @@ namespace AMDiS
using
Dune
::
Functions
::
interpolate
;
Dune
::
Hybrid
::
ifElse
(
std
::
is_same
<
RangeType_t
<
typename
RowBasis
::
LocalView
::
Tree
>
,
Range
>
{},
[
&
](
auto
id
)
{
auto
rhsWrapper
=
wrapper
(
rhs
.
getV
ector
());
auto
rhsWrapper
=
wrapper
(
rhs
.
v
ector
());
interpolate
(
id
(
rowBasis
),
rhsWrapper
,
values_
,
dirichletNodes_
);
});
Dune
::
Hybrid
::
ifElse
(
std
::
is_same
<
RangeType_t
<
typename
ColBasis
::
LocalView
::
Tree
>
,
Range
>
{},
[
&
](
auto
id
)
{
auto
solutionWrapper
=
wrapper
(
solution
.
getV
ector
());
auto
solutionWrapper
=
wrapper
(
solution
.
v
ector
());
interpolate
(
id
(
colBasis
),
solutionWrapper
,
values_
,
dirichletNodes_
);
});
...
...
src/amdis/FileWriter.hpp
View file @
c4620783
...
...
@@ -43,14 +43,13 @@ namespace AMDiS
constexpr
std
::
size_t
VTKFieldSize
=
Size
<
Range
>
;
template
<
class
Traits
,
class
TreePath
>
template
<
class
GlobalBasis
,
class
RangeType
,
class
TreePath
>
class
FileWriter
:
public
FileWriterInterface
{
private:
// typedefs and static constants
using
GlobalBasis
=
typename
Traits
::
GlobalBasis
;
using
GridView
=
typename
GlobalBasis
::
GridView
;
using
Vector
=
DOFVectorConstView
<
Traits
,
TreePath
>
;
using
Vector
=
DOFVectorConstView
<
GlobalBasis
,
RangeType
,
TreePath
>
;
using
Range
=
typename
Vector
::
Range
;
/// Dimension of the mesh
...
...
@@ -123,12 +122,12 @@ namespace AMDiS
};
template
<
class
Traits
,
class
TreePath
>
std
::
shared_ptr
<
FileWriter
<
Traits
,
TreePath
>>
makeFileWriterPtr
(
std
::
string
baseName
,
DOFVectorConstView
<
Traits
,
TreePath
>
const
&
dofvector
)
template
<
class
GlobalBasis
,
class
Range
,
class
TreePath
>
std
::
shared_ptr
<
FileWriter
<
GlobalBasis
,
Range
,
TreePath
>>
makeFileWriterPtr
(
std
::
string
baseName
,
DOFVectorConstView
<
GlobalBasis
,
Range
,
TreePath
>
const
&
dofvector
)
{
return
std
::
make_shared
<
FileWriter
<
Traits
,
TreePath
>>
(
baseName
,
dofvector
);
return
std
::
make_shared
<
FileWriter
<
GlobalBasis
,
Range
,
TreePath
>>
(
baseName
,
dofvector
);
}
}
// end namespace AMDiS
src/amdis/ProblemStat.hpp
View file @
c4620783
...
...
@@ -68,7 +68,7 @@ namespace AMDiS
static
constexpr
int
dow
=
Grid
::
dimensionworld
;
using
SystemMatrix
=
DOFMatrix
<
GlobalBasis
,
GlobalBasis
,
double
>
;
using
SystemVector
=
DOFVector
<
Trait
s
,
double
>
;
using
SystemVector
=
DOFVector
<
GlobalBasi
s
,
double
>
;
using
LinearSolverType
=
LinearSolverInterface
<
typename
SystemMatrix
::
BaseMatrix
,
typename
SystemVector
::
BaseVector
>
;
...
...
src/amdis/ProblemStat.inc.hpp
View file @
c4620783
...
...
@@ -281,7 +281,7 @@ solve(AdaptInfo& adaptInfo, bool createMatrixData, bool storeMatrixData)
solution_
->
compress
();
linearSolver_
->
solve
(
systemMatrix_
->
getMatrix
(),
solution_
->
getV
ector
(),
rhs_
->
getV
ector
(),
linearSolver_
->
solve
(
systemMatrix_
->
getMatrix
(),
solution_
->
v
ector
(),
rhs_
->
v
ector
(),
solverInfo
);
if
(
solverInfo
.
getInfo
()
>
0
)
{
...
...
src/amdis/gridfunctions/DOFVectorView.hpp
View file @
c4620783
...
...
@@ -20,13 +20,12 @@ namespace AMDiS
* @{
**/
template
<
class
Traits
,
class
TreePathType
>
template
<
class
GlobalBasisType
,
class
RangeType
,
class
TreePathType
>
class
DOFVectorConstView
{
public:
using
GlobalBasis
=
typename
Traits
::
GlobalBasis
;
using
GlobalBasis
=
GlobalBasis
Type
;
using
TreePath
=
TreePathType
;
using
Vector
=
DOFVector
<
Traits
>
;
using
Tree
=
typename
GlobalBasis
::
LocalView
::
Tree
;
using
SubTree
=
typename
Dune
::
TypeTree
::
ChildForTreePath
<
Tree
,
TreePath
>
;
...
...
@@ -37,6 +36,8 @@ namespace AMDiS
using
Domain
=
typename
EntitySet
::
GlobalCoordinate
;
using
Range
=
RangeType_t
<
SubTree
>
;
static_assert
(
std
::
is_arithmetic
<
RangeType
>::
value
,
""
);
// Don't know how to determine Range with non-trivial RangeType
using
RawSignature
=
typename
Dune
::
Functions
::
SignatureTraits
<
Range
(
Domain
)
>::
RawSignature
;
using
DerivativeTraits
=
Dune
::
Functions
::
DefaultDerivativeTraits
<
RawSignature
>
;
...
...
@@ -201,11 +202,11 @@ namespace AMDiS
public:
/// Constructor. Stores a pointer to the dofVector and a copy of the treePath.
DOFVectorConstView
(
DOFVector
<
Traits
>
const
&
dofVector
,
TreePath
const
&
treePath
)
DOFVectorConstView
(
DOFVector
<
GlobalBasis
,
RangeType
>
const
&
dofVector
,
TreePath
const
&
treePath
)
:
dofVector_
(
&
dofVector
)
,
treePath_
(
treePath
)
,
entitySet_
(
dofVector
.
getFeSpace
().
gridView
())
,
nodeToRangeEntry_
(
Dune
::
Functions
::
makeDefaultNodeToRangeMap
(
dofVector
.
getFeSpace
(),
treePath
))
,
entitySet_
(
dofVector
.
basis
().
gridView
())
,
nodeToRangeEntry_
(
Dune
::
Functions
::
makeDefaultNodeToRangeMap
(
dofVector
.
basis
(),
treePath
))
{}
/// Evaluate the view on this DOFVector in global coordinates
...
...
@@ -230,7 +231,7 @@ namespace AMDiS
/// Return global basis
GlobalBasis
const
&
basis
()
const
{
return
dofVector_
->
getFeSpace
();
return
dofVector_
->
basis
();
}
/// Return treePath associated with this view
...
...
@@ -240,13 +241,13 @@ namespace AMDiS
}
/// Return const coefficient vector
DOFVector
<
Traits
>
const
&
coefficients
()
const
DOFVector
<
GlobalBasis
,
RangeType
>
const
&
coefficients
()
const
{
return
*
dofVector_
;
}
protected:
DOFVector
<
Traits
>
const
*
dofVector_
;
DOFVector
<
GlobalBasis
,
RangeType
>
const
*
dofVector_
;
TreePath
const
treePath_
;
EntitySet
entitySet_
;
...
...
@@ -255,18 +256,18 @@ namespace AMDiS
// A mutable version of DOFVectorView
template
<
class
Traits
,
class
TreePathType
>
template
<
class
GlobalBasisType
,
class
RangeType
,
class
TreePathType
>
class
DOFVectorMutableView
:
public
DOFVectorConstView
<
Traits
,
TreePathType
>
:
public
DOFVectorConstView
<
GlobalBasisType
,
RangeType
,
TreePathType
>
{
using
Super
=
DOFVectorConstView
<
Traits
,
TreePathType
>
;
using
Super
=
DOFVectorConstView
<
GlobalBasisType
,
RangeType
,
TreePathType
>
;
using
GlobalBasis
=
typename
Traits
::
GlobalBasis
;
using
GlobalBasis
=
GlobalBasis
Type
;
using
TreePath
=
TreePathType
;
public:
/// Constructor. Stores a pointer to the mutable `dofvector`.
DOFVectorMutableView
(
DOFVector
<
Traits
>&
dofVector
,
TreePath
const
&
treePath
)
DOFVectorMutableView
(
DOFVector
<
GlobalBasis
,
RangeType
>&
dofVector
,
TreePath
const
&
treePath
)
:
Super
(
dofVector
,
treePath
)
,
mutableDofVector_
(
&
dofVector
)
{}
...
...
@@ -281,11 +282,11 @@ namespace AMDiS
auto
&&
gridFct
=
makeGridFunction
(
std
::
forward
<
Expr
>
(
expr
),
basis
.
gridView
());
DOFVector
<
Traits
>
tmp
(
basis
,
"tmp"
);
DOFVector
<
GlobalBasis
,
RangeType
>
tmp
(
*
mutableDofVector_
);
Dune
::
Functions
::
interpolate
(
basis
,
treePath
,
tmp
,
std
::
forward
<
decltype
(
gridFct
)
>
(
gridFct
));
// move data from temporary vector into stored DOFVector
mutableDofVector_
->
getV
ector
()
=
std
::
move
(
tmp
.
getV
ector
());
mutableDofVector_
->
v
ector
()
=
std
::
move
(
tmp
.
v
ector
());
return
*
this
;
}
...
...
@@ -297,13 +298,13 @@ namespace AMDiS
/// Return the mutable DOFVector
DOFVector
<
Traits
>&
coefficients
()
{
return
*
mutableDofVector_
;
}
DOFVector
<
GlobalBasis
,
RangeType
>&
coefficients
()
{
return
*
mutableDofVector_
;
}
/// Return the const DOFVector
using
Super
::
coefficients
;
protected:
DOFVector
<
Traits
>*
mutableDofVector_
;
DOFVector
<
GlobalBasis
,
RangeType
>*
mutableDofVector_
;
};
/** @} **/
...
...
@@ -311,34 +312,34 @@ namespace AMDiS
#ifndef DOXYGEN
// A Generator for a const \ref DOFVectorView.
template
<
class
Traits
,
class
TreePath
>
auto
makeDOFVectorView
(
DOFVector
<
Traits
>
const
&
dofVector
,
TreePath
const
&
treePath
)
template
<
class
GlobalBasis
,
class
RangeType
,
class
TreePath
>
auto
makeDOFVectorView
(
DOFVector
<
GlobalBasis
,
RangeType
>
const
&
dofVector
,
TreePath
const
&
treePath
)
{
return
DOFVectorConstView
<
Traits
,
TreePath
>
{
dofVector
,
treePath
};
return
DOFVectorConstView
<
GlobalBasis
,
RangeType
,
TreePath
>
{
dofVector
,
treePath
};
}
// A Generator for a mutable \ref DOFVectorView.
template
<
class
Traits
,
class
TreePath
>
auto
makeDOFVectorView
(
DOFVector
<
Traits
>&
dofVector
,
TreePath
const
&
treePath
)
template
<
class
GlobalBasis
,
class
RangeType
,
class
TreePath
>
auto
makeDOFVectorView
(
DOFVector
<
GlobalBasis
,
RangeType
>&
dofVector
,
TreePath
const
&
treePath
)
{
return
DOFVectorMutableView
<
Traits
,
TreePath
>
{
dofVector
,
treePath
};
return
DOFVectorMutableView
<
GlobalBasis
,
RangeType
,
TreePath
>
{
dofVector
,
treePath
};
}
// A Generator for a const \ref DOFVectorView.
template
<
class
Traits
>
auto
makeDOFVectorView
(
DOFVector
<
Traits
>
const
&
dofVector
)
template
<
class
GlobalBasis
,
class
RangeType
>
auto
makeDOFVectorView
(
DOFVector
<
GlobalBasis
,
RangeType
>
const
&
dofVector
)
{
auto
treePath
=
Dune
::
TypeTree
::
hybridTreePath
();
return
DOFVectorConstView
<
Traits
,
decltype
(
treePath
)
>
{
dofVector
,
treePath
};
return
DOFVectorConstView
<
GlobalBasis
,
RangeType
,
decltype
(
treePath
)
>
{
dofVector
,
treePath
};
}
// A Generator for a mutable \ref DOFVectorView.
template
<
class
Traits
>
auto
makeDOFVectorView
(
DOFVector
<
Traits
>&
dofVector
)
template
<
class
GlobalBasis
,
class
RangeType
>
auto
makeDOFVectorView
(
DOFVector
<
GlobalBasis
,
RangeType
>&
dofVector
)
{
auto
treePath
=
Dune
::
TypeTree
::
hybridTreePath
();
return
DOFVectorMutableView
<
Traits
,
decltype
(
treePath
)
>
{
dofVector
,
treePath
};
return
DOFVectorMutableView
<
GlobalBasis
,
RangeType
,
decltype
(
treePath
)
>
{
dofVector
,
treePath
};
}
#endif
...
...
src/amdis/gridfunctions/DOFVectorView.inc.hpp
View file @
c4620783
...
...
@@ -4,8 +4,8 @@
namespace
AMDiS
{
template
<
class
Traits
,
class
T
reePath
>
typename
DOFVectorConstView
<
Traits
,
TreePath
>::
Range
DOFVectorConstView
<
Traits
,
TreePath
>::
template
<
class
GB
,
class
RT
,
class
T
P
>
typename
DOFVectorConstView
<
GB
,
RT
,
TP
>::
Range
DOFVectorConstView
<
GB
,
RT
,
TP
>::
LocalFunction
::
operator
()(
LocalDomain
const
&
x
)
const
{
assert
(
bound_
);
...
...
@@ -48,8 +48,8 @@ LocalFunction::operator()(LocalDomain const& x) const
}
template
<
class
Traits
,
class
T
reePath
>
typename
DOFVectorConstView
<
Traits
,
TreePath
>::
DerivativeRange
DOFVectorConstView
<
Traits
,
TreePath
>::
template
<
class
GB
,
class
RT
,
class
T
P
>
typename
DOFVectorConstView
<
GB
,
RT
,
TP
>::
DerivativeRange
DOFVectorConstView
<
GB
,
RT
,
TP
>::
GradientLocalFunction
::
operator
()(
LocalDomain
const
&
x
)
const
{
assert
(
bound_
);
...
...
src/amdis/linear_algebra/istl/DOFVector.hpp
View file @
c4620783
...
...
@@ -50,13 +50,13 @@ namespace AMDiS
}
/// Return the data-vector \ref vector
BaseVector
const
&
getV
ector
()
const
BaseVector
const
&
v
ector
()
const
{
return
*
vector
;
}
/// Return the data-vector \ref vector
BaseVector
&
getV
ector
()
BaseVector
&
v
ector
()
{
return
*
vector
;
}
...
...
@@ -107,7 +107,7 @@ namespace AMDiS
/// Calls the copy assignment operator of the BaseVector \ref vector
void
copy
(
Self
const
&
that
)
{
*
vector
=
that
.
getV
ector
();
*
vector
=
that
.
v
ector
();
}
private:
...
...
src/amdis/linear_algebra/mtl/BlockMTLVector.hpp
View file @
c4620783
...
...
@@ -91,7 +91,7 @@ namespace AMDiS
explicit
BlockVectorWrapper
(
BlockVector
&
blockVector
,
bool
copyBack
=
!
std
::
is_const
<
BlockVector
>::
value
)
:
blockVector
(
blockVector
)
,
vector
(
num_rows
(
blockVector
))
,
vector
_
(
num_rows
(
blockVector
))
,
copyBack
(
copyBack
)
{
assignTo
();
...
...
@@ -107,8 +107,8 @@ namespace AMDiS
BlockVector
const
&
getBlockVector
()
const
{
return
blockVector
;
}
/// Return a reference to the contiguose-vector
Vector
&
getV
ector
()
{
return
vector
;
}
Vector
const
&
getV
ector
()
const
{
return
vector
;
}
Vector
&
v
ector
()
{
return
vector
_
;
}
Vector
const
&
v
ector
()
const
{
return
vector
_
;
}
private:
/// copy from block-vector to vector
...
...
@@ -119,7 +119,7 @@ namespace AMDiS
std
::
size_t
finish
=
start
+
num_rows
(
blockVector
[
r
]);
mtl
::
irange
range
(
start
,
finish
);
vector
[
range
]
=
blockVector
[
r
];
vector
_
[
range
]
=
blockVector
[
r
];
start
=
finish
;
}
}
...
...
@@ -137,14 +137,14 @@ namespace AMDiS
std
::
size_t
finish
=
start
+
num_rows
(
blockVector
[
r
]);
mtl
::
irange
range
(
start
,
finish
);
blockVector
[
r
]
=
vector
[
range
];
blockVector
[
r
]
=
vector
_
[
range
];
start
=
finish
;
}
}
private:
BlockVector
&
blockVector
;
Vector
vector
;
Vector
vector
_
;
/// Copy data back to block-vector on destruction
bool
copyBack
;
...
...
@@ -159,16 +159,16 @@ namespace AMDiS
"This specialization is for contiguose vectors only."
);
public:
explicit
BlockVectorWrapper
(
BlockVector
&
vector
,
bool
=
false
)
:
vector
(
vector
)
:
vector
_
(
vector
)
{}
/// Return a reference to the vector
BlockVector
const
&
getBlockVector
()
const
{
return
vector
;
}
BlockVector
&
getV
ector
()
{
return
vector
;
}
BlockVector
const
&
getV
ector
()
const
{
return
vector
;
}
BlockVector
const
&
getBlockVector
()
const
{
return
vector
_
;
}
BlockVector
&
v
ector
()
{
return
vector
_
;
}
BlockVector
const
&
v
ector
()
const
{
return
vector
_
;
}
private:
BlockVector
&
vector
;
BlockVector
&
vector
_
;
};
template
<
class
BlockVector
,
class
Vector
>
...
...
src/amdis/linear_algebra/mtl/DOFVector.hpp
View file @
c4620783
...
...
@@ -16,117 +16,114 @@
namespace
AMDiS
{
/// The basic container that stores a base vector and a corresponding
feSpace
template
<
class
Trait
s
,
class
Valu
eType
=
double
>
/// The basic container that stores a base vector and a corresponding
basis
template
<
class
GlobalBasi
s
,
class
Rang
eType
=
double
>
class
DOFVector
{
using
Self
=
DOFVector
;
public:
/// The type of the \ref
feSpace
using
Global
Basis
=
typename
Traits
::
GlobalBasis
;
/// The type of the \ref
basis
using
Basis
=
GlobalBasis
;
/// The type of the base vector
using
BaseVector
=
MTLDenseVector
<
Valu
eType
>
;
using
BaseVector
=
MTLDenseVector
<
Rang
eType
>
;
/// The index/size - type
using
size_type
=
typename
GlobalBasis
::
size_type
;
/// The type of the elements of the DOFVector
using
value_type
=
ValueType
;
/// The underlying field-type (typically the same as \ref value_type)
using
field_type
=
typename
BaseVector
::
value_type
;
using
range_type
=
RangeType
;
/// Constructor. Constructs new BaseVector.
DOFVector
(
GlobalBasis
const
&
feSpace
,
std
::
string
name
)
:
feSpace
(
feSpace
)
,
name
(
name
)
,
vector
(
ClonablePtr
<
BaseVector
>::
make
())
DOFVector
(
GlobalBasis
const
&
basis
,
std
::
string
name
)
:
basis_
(
&
basis
)
,
name
_
(
name
)
,
vector
_
(
ClonablePtr
<
BaseVector
>::
make
())
{
compress
();
}
/// Constructor. Takes reference to existing BaseVector
DOFVector
(
GlobalBasis
const
&
feSpace
,
std
::
string
name
,
DOFVector
(
GlobalBasis
const
&
basis
,
std
::
string
name
,
BaseVector
&
vector_ref
)
:
feSpace
(
feSpace
)
,
name
(
name
)
,
vector
(
vector_ref
)
:
basis_
(
&
basis
)
,
name
_
(
name
)
,
vector
_
(
vector_ref
)
{}
/// Return the basis \ref
feSpace
of the vector
Global
Basis
const
&
getFeSpace
()
const
/// Return the basis \ref
basis
of the vector
Basis
const
&
basis
()
const
{
return
feSpace
;
return
*
basis_
;
}
/// Return the data-vector \ref vector
BaseVector
const
&
getV
ector
()
const
BaseVector
const
&
v
ector
()
const
{
return
*
vector
;
return
*
vector
_
;
}
/// Return the data-vector \ref vector
BaseVector
&
getV
ector
()
BaseVector
&
v
ector
()
{
return
*
vector
;
return
*
vector
_
;
}
/// Return the size of the \ref
feSpace
size_type
getS
ize
()
const
/// Return the size of the \ref
basis
size_type
s
ize
()
const
{
return
feSpace
.
dimension
();
return
basis_
->
dimension
();
}
/// Return the \ref name of this vector
std
::
string
getN
ame
()
const
std
::
string
n
ame
()
const
{
return
name
;
return
name
_
;
}
/// Resize the \ref vector to the size of the \ref
feSpace
.
/// Resize the \ref vector to the size of the \ref
basis
.
void
compress
()
{
if
(
num_rows
(
*
vector
)
!=
getS
ize
())
{
resize
(
getS
ize
());
*
vector
=
ValueT
ype
(
0
);
if
(
num_rows
(
*
vector
_
)
!=
s
ize
())
{
resize
(
s
ize
());
*
vector
_
=
range_t
ype
(
0
);
}
}
template
<
class
SizeInfo
>
void
resize
(
SizeInfo
s
)
{
vector
->
change_dim
(
size_type
(
s
));
vector
_
->
change_dim
(
size_type
(
s
));
}
/// Access the entry \p i of the \ref vector with read-access.
template
<
class
Index
>
valu
e_type
const
&
operator
[](
Index
idx
)
const
rang
e_type
const
&
operator
[](
Index
idx
)
const
{
auto
const
i
=
flatMultiIndex
(
idx
);
test_exit_dbg
(
i
<
num_rows
(
*
vector
)
,
"Index "
,
i
,
" out of range [0,"
,
num_rows
(
*
vector
),
")"
);
return
(
*
vector
)[
i
];
test_exit_dbg
(
i
<
num_rows
(
*
vector
_
)
,
"Index "
,
i
,
" out of range [0,"
,
num_rows
(
*
vector
_
),
")"
);
return
(
*
vector
_
)[
i
];
}
/// Access the entry \p i of the \ref vector with write-access.
template
<
class
Index
>
valu
e_type
&
operator
[](
Index
idx
)
rang
e_type
&
operator
[](
Index
idx
)
{
auto
const
i
=
flatMultiIndex
(
idx
);
test_exit_dbg
(
i
<
num_rows
(
*
vector
)
,
"Index "
,
i
,
" out of range [0,"
,
num_rows
(
*
vector
),
")"
);
return
(
*
vector
)[
i
];
test_exit_dbg
(
i
<
num_rows
(
*
vector
_
)
,
"Index "
,
i
,
" out of range [0,"
,
num_rows
(
*
vector
_
),
")"
);
return
(
*
vector
_
)[
i
];
}
/// \brief interpolate a function \p f to the basis \ref
feSpace
and store the
/// \brief interpolate a function \p f to the basis \ref
basis
and store the
/// coefficients in \ref vector.
template
<
class
F
>
void
interpol
(
F
&&
f
)
{
Dune
::
Functions
::
interpolate
(
feSpace
,
*
this
,
std
::
forward
<
F
>
(
f
));
Dune
::
Functions
::
interpolate
(
*
basis_
,
*
this
,
std
::
forward
<
F
>
(
f
));
}
/// Scale each DOFVector by the factor \p s.
...
...
@@ -134,7 +131,7 @@ namespace AMDiS
std
::
enable_if_t
<
Concepts
::
Arithmetic
<
Scalar
>
,
Self
&>
operator
*=
(
Scalar
s
)
{
(
*
vector
)
*=
s
;
(
*
vector
_
)
*=
s
;
return
*
this
;
}
...
...
@@ -143,37 +140,55 @@ namespace AMDiS
std
::
enable_if_t
<
Concepts
::
Arithmetic
<
Scalar
>
,
Self
&>
operator
=
(
Scalar
s
)
{
(
*
vector
)
=
s
;
(
*
vector
_
)
=
s
;
return
*
this
;
}
/// Calls the copy assignment operator of the BaseVector \ref vector
void
copy
(
Self
const
&
that
)
{
*
vector
=
that
.
getV
ector
()
;
*
vector
_
=
*
that
.
v
ector
_
;
}
private:
/// The finite element space / basis associated with the data vector
Global
Basis
const
&
feSpace
;
Basis
const
*
basis_
;
/// The name of the DOFVector (used in file-writing)
std
::
string
name
;
std
::
string
name
_
;
/// The data-vector (can hold a new BaseVector or a pointer to external data
ClonablePtr
<
BaseVector
>
vector
;
ClonablePtr
<
BaseVector
>
vector
_
;
// friend class declarations
template
<
class
,
class
>
friend
class
SystemVector
;
};
/// Constructor a dofvector from given feSpace and name
template
<
class
Traits
,
class
ValueType
=
double
>
DOFVector
<
Traits
,
ValueType
>
makeDOFVector
(
typename
Traits
::
GlobalBasis
const
&
basis
,
std
::
string
name
)
#if DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
// Deduction rules
template
<
class
GlobalBasis
>
DOFVector
(
GlobalBasis
const
&
basis
,
std
::
string
name
)
->
DOFVector
<
GlobalBasis
,
double
>
;
template
<
class
GlobalBasis
,
class
RangeType
>
DOFVector
(
GlobalBasis
const
&
basis
,
std
::
string
name
,
MTLDenseVector
<
RangeType
>&
coefficients
)
->
DOFVector
<
GlobalBasis
,
RangeType
>
;
#endif
/// Constructor a dofvector from given basis and name
template
<
class
GlobalBasis
,
class
RangeType
=
double
>
DOFVector
<
GlobalBasis
,
RangeType
>
makeDOFVector
(
GlobalBasis
const
&
basis
,
std
::
string
name
)
{
return
{
basis
,
name
};
}
/// Constructor a dofvector from given basis, name, and coefficient vector
template
<
class
GlobalBasis
,
class
RangeType
>
DOFVector
<
GlobalBasis
,
RangeType
>
makeDOFVector
(
GlobalBasis
const
&
basis
,
std
::
string
name
,
MTLDenseVector
<
RangeType
>&
coefficients
)
{
return
{
basis
,
name
,
coefficients
};
}
}
// end namespace AMDiS
src/amdis/linear_algebra/mtl/LinearSolver.hpp
View file @
c4620783
...
...
@@ -70,7 +70,7 @@ namespace AMDiS
msg
(
"fill MTL4 matrix needed "
,
t
.
elapsed
(),
" seconds"
);
}
int
error
=
runner
->
solve
(
A
,
X
.
getV
ector
(),
B
.
getV
ector
(),
solverInfo
);
int
error
=
runner
->
solve
(
A
,
X
.
v
ector
(),
B
.
v
ector
(),
solverInfo
);
solverInfo
.
setError
(
error
);
if
(
!
solverInfo
.
doStoreMatrixData
())
...
...
src/amdis/linear_algebra/mtl/SystemVector.hpp
View file @
c4620783
...
...
@@ -89,8 +89,8 @@ namespace AMDiS
SystemVector
(
FeSpaces
const
&
feSpaces
,
std
::
vector
<
std
::
string
>
const
&
names
)