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
24a3d588
Commit
24a3d588
authored
May 05, 2016
by
Praetorius, Simon
Browse files
solver/preconditioner interface rewritten, BlockVector/-Matrix corrected, Does not link correctly
parent
3cd86a43
Changes
25
Hide whitespace changes
Inline
Side-by-side
dune/amdis/Basic.hpp
View file @
24a3d588
...
...
@@ -28,6 +28,10 @@ namespace AMDiS
using
IdxList
=
std
::
map
<
int
,
std
::
list
<
std
::
shared_ptr
<
T
>
>
>
;
template
<
class
T
>
struct
Type
{
using
type
=
T
;
};
template
<
size_t
I
,
class
T
,
class
A
>
...
...
dune/amdis/CMakeLists.txt
View file @
24a3d588
...
...
@@ -30,7 +30,7 @@ if (Boost_FOUND)
add_library
(
boost INTERFACE
)
target_include_directories
(
boost INTERFACE
${
Boost_INCLUDE_DIR
}
)
target_link_libraries
(
boost INTERFACE
${
Boost_LIBRARIES
}
)
target_link_libraries
(
"
duneamdis
"
INTERFACE boost
)
target_link_libraries
(
duneamdis INTERFACE boost
)
if
(
MSVC_SHARED_LIBS
)
link_directories
(
${
Boost_LIBRARY_DIRS
}
)
...
...
@@ -52,7 +52,7 @@ if (MTL_FOUND)
if
(
HAVE_UMFPACK OR ENABLE_SUITESPARSE OR SuiteSparse_FOUND
)
target_compile_definitions
(
"duneamdis"
PUBLIC MTL_HAS_UMFPACK
)
endif
(
HAVE_UMFPACK
)
endif
()
endif
(
MTL_FOUND
)
...
...
dune/amdis/CreatorInterface.hpp
View file @
24a3d588
...
...
@@ -2,6 +2,8 @@
#include <string>
#include <dune/amdis/Basic.hpp>
namespace
AMDiS
{
...
...
@@ -27,39 +29,9 @@ namespace AMDiS
* Must be implemented by sub classes of CreatorInterface.
* Creates a new instance of the sub class of BaseClass.
*/
virtual
BaseClass
*
create
()
=
0
;
/// Can be implemented by sub classes.
virtual
void
free
(
BaseClass
*
)
{}
///
virtual
bool
isNullCreator
()
{
return
false
;
}
virtual
std
::
shared_ptr
<
BaseClass
>
create
()
=
0
;
};
/** \brief
* A Creator which creates no object and returns NULL instead.
* Used together with the key word 'no' in CreatorMap.
*/
template
<
class
BaseClass
>
class
NullCreator
:
public
CreatorInterface
<
BaseClass
>
{
/// Creates no object.
virtual
BaseClass
*
create
()
override
{
return
NULL
;
}
/// Implementation of \ref CreatorInterface::isNullCreator()
virtual
bool
isNullCreator
()
override
{
return
true
;
}
};
/**
* \ingroup Common
*
...
...
@@ -70,14 +42,22 @@ namespace AMDiS
class
CreatorInterfaceName
:
public
CreatorInterface
<
BaseClass
>
{
public:
/// Sets \ref name
void
setName
(
std
::
string
str
)
{
name
=
str
;
}
protected:
std
::
string
name
;
virtual
std
::
shared_ptr
<
BaseClass
>
create
()
override
{
AMDIS_ERROR_EXIT
(
"This create method should not be called. Call create(string) instead!"
);
return
{};
};
/** \brief
* Must be implemented by sub classes of CreatorInterfaceName.
* Creates a new instance of the sub class of BaseClass by passing a
* string to the constructor.
*/
virtual
std
::
shared_ptr
<
BaseClass
>
create
(
std
::
string
)
=
0
;
};
template
<
class
T
>
void
addDefaultCreators
(
Type
<
T
>
);
}
// end namespace AMDiS
dune/amdis/CreatorMap.cpp
deleted
100644 → 0
View file @
3cd86a43
#include "CreatorMap.hpp"
// AMDiS includes
#include "solver/ITL_Preconditioner.hpp"
#include "solver/ITL_Solver.hpp"
#include "solver/KrylovPreconditioner.hpp"
#include "solver/LinearSolverInterface.hpp"
#include "solver/UmfPackSolver.hpp"
namespace
AMDiS
{
template
<
>
void
CreatorMap
<
LinearSolverInterface
>::
addDefaultCreators
()
{
LinearSolverCreator
*
creator
;
// creators for MTL4 krylov solvers
// _________________________________________________________________________
creator
=
new
CGSolver
::
Creator
;
addCreator
(
"mtl_cg"
,
creator
);
creator
=
new
CGSSolver
::
Creator
;
addCreator
(
"mtl_cgs"
,
creator
);
creator
=
new
BiCGSolver
::
Creator
;
addCreator
(
"mtl_bicg"
,
creator
);
creator
=
new
BiCGStabSolver
::
Creator
;
addCreator
(
"mtl_bicgstab"
,
creator
);
creator
=
new
BiCGStab2Solver
::
Creator
;
addCreator
(
"mtl_bicgstab2"
,
creator
);
creator
=
new
BiCGStabEllSolver
::
Creator
;
addCreator
(
"mtl_bicgstab_ell"
,
creator
);
creator
=
new
QMRSolver
::
Creator
;
addCreator
(
"mtl_qmr"
,
creator
);
creator
=
new
TFQMRSolver
::
Creator
;
addCreator
(
"mtl_tfqmr"
,
creator
);
creator
=
new
GMResSolver
::
Creator
;
addCreator
(
"mtl_gmres"
,
creator
);
creator
=
new
GcrSolver
::
Creator
;
addCreator
(
"mtl_gcr"
,
creator
);
creator
=
new
FGMResSolver
::
Creator
;
addCreator
(
"mtl_fgmres"
,
creator
);
creator
=
new
IDRsSolver
::
Creator
;
addCreator
(
"mtl_idr_s"
,
creator
);
creator
=
new
MinResSolver
::
Creator
;
addCreator
(
"mtl_minres"
,
creator
);
creator
=
new
PreOnly
::
Creator
;
addCreator
(
"mtl_preonly"
,
creator
);
addCreator
(
"mtl_richardson"
,
creator
);
#ifdef HAVE_UMFPACK
creator
=
new
UmfPackSolver
::
Creator
;
addCreator
(
"mtl_umfpack"
,
creator
);
addCreator
(
"mtl_direct"
,
creator
);
#endif
}
template
<
>
void
CreatorMap
<
ITL_PreconditionerBase
<
MTLTypes
::
MTLMatrix
,
MTLTypes
::
MTLVector
>>::
addDefaultCreators
()
{
using
PreconditionCreator
=
CreatorInterfaceName
<
ITL_PreconditionerBase
<
MTLTypes
::
MTLMatrix
,
MTLTypes
::
MTLVector
>>
;
PreconditionCreator
*
creator
;
creator
=
new
DiagonalPreconditioner
::
Creator
;
addCreator
(
"diag"
,
creator
);
creator
=
new
MassLumpingPreconditioner
::
Creator
;
addCreator
(
"lumping"
,
creator
);
addCreator
(
"masslumping"
,
creator
);
creator
=
new
ILUPreconditioner
::
Creator
;
addCreator
(
"ilu"
,
creator
);
creator
=
new
ICPreconditioner
::
Creator
;
addCreator
(
"ic"
,
creator
);
creator
=
new
IdentityPreconditioner
::
Creator
;
addCreator
(
"no"
,
creator
);
creator
=
new
KrylovPreconditionerSeq
::
Creator
;
addCreator
(
"krylov"
,
creator
);
addCreator
(
"solver"
,
creator
);
}
}
// end namespace AMDiS
dune/amdis/CreatorMap.hh
deleted
100644 → 0
View file @
3cd86a43
namespace
AMDiS
{
template
<
class
BaseClass
>
void
CreatorMap
<
BaseClass
>::
clear
()
{
for
(
auto
it
=
creatorMap
.
begin
();
it
!=
creatorMap
.
end
();
++
it
)
delete
it
->
second
;
}
}
// end namespace AMDiS
dune/amdis/CreatorMap.hpp
View file @
24a3d588
...
...
@@ -4,10 +4,10 @@
#include <map>
// AMDiS includes
#include
"
CreatorInterface.hpp
"
#include
<dune/amdis/
CreatorInterface.hpp
>
namespace
AMDiS
{
{
/** \ingroup Common
* \brief
* A CreatorMap is used to construct objects, which types depends on key words
...
...
@@ -19,58 +19,42 @@ namespace AMDiS
*/
template
<
class
BaseClass
>
class
CreatorMap
{
{
public:
using
CreatorMapType
=
std
::
map
<
std
::
string
,
CreatorInterface
<
BaseClass
>*>
;
using
CreatorMapType
=
std
::
map
<
std
::
string
,
CreatorInterface
<
BaseClass
>*
>
;
public:
/// Adds a new creator together with the given key to the map.
static
void
addCreator
(
std
::
string
key
,
CreatorInterface
<
BaseClass
>*
creator
)
{
init
();
AMDIS_TEST_EXIT
(
creatorMap
[
key
]
==
NULL
,
AMDIS_TEST_EXIT
(
!
creatorMap
[
key
],
"There is already a creator for key "
<<
key
);
creatorMap
[
key
]
=
creator
;
}
static
void
addCreator
(
std
::
string
backend
,
std
::
string
key
,
CreatorInterface
<
BaseClass
>*
creator
)
{
addCreator
(
backend
+
"_"
+
key
,
creator
);
}
/// Creates a object of the type corresponding to key.
static
CreatorInterface
<
BaseClass
>*
getCreator
(
std
::
string
key
,
std
::
string
initFileStr
)
static
CreatorInterface
<
BaseClass
>*
getCreator
(
std
::
string
key
,
std
::
string
initFileStr
)
{
init
();
CreatorInterface
<
BaseClass
>*
creator
=
creatorMap
[
key
];
auto
it
=
creatorMap
.
find
(
key
);
if
(
it
==
creatorMap
.
end
())
key
=
"default"
;
auto
creator
=
creatorMap
[
key
];
AMDIS_TEST_EXIT
(
creator
,
"No creator for key
\"
"
<<
key
<<
"
\"
defined in init file for parameter
\"
"
<<
initFileStr
<<
"
\"
"
);
return
creator
;
}
static
void
clear
()
{
for
(
auto
entries
:
creatorMap
)
delete
it
->
second
;
}
static
void
addDefaultCreators
();
protected:
/// Constructor is protected because derived maps should be singleton.
static
void
init
()
{
if
(
!
initialized
)
{
if
(
!
initialized
)
{
initialized
=
true
;
NullCreator
<
BaseClass
>*
nullCreator
=
new
NullCreator
<
BaseClass
>
;
addCreator
(
"0"
,
nullCreator
);
addDefaultCreators
();
addDefaultCreators
(
Type
<
BaseClass
>
{});
}
}
...
...
@@ -88,5 +72,3 @@ namespace AMDiS
bool
CreatorMap
<
BaseClass
>::
initialized
=
false
;
}
// end namespace AMDiS
#include "CreatorMap.hh"
dune/amdis/ProblemStat.hpp
View file @
24a3d588
...
...
@@ -11,6 +11,7 @@
#include "AdaptInfo.hpp"
#include "Basic.hpp"
#include "CreatorInterface.hpp"
#include "DirichletBC.hpp"
#include "FileWriter.hpp"
#include "Flag.hpp"
...
...
@@ -227,13 +228,19 @@ namespace AMDiS
}
void
createSolver
()
{
using
Creator
=
SolverCreator
<
typename
SystemMatrixType
::
MultiMatrix
,
typename
SystemVectorType
::
MultiVector
>
;
{
std
::
string
solverName
=
"cg"
;
Parameters
::
get
(
name
+
"->solver->name"
,
solverName
);
linearSolver
=
Creator
::
create
(
solverName
,
name
+
"->solver"
);
auto
baseCreator
=
CreatorMap
<
LinearSolverType
>::
getCreator
(
solverName
,
name
+
"->solver->name"
);
CreatorInterfaceName
<
LinearSolverType
>*
solverCreator
=
dynamic_cast
<
CreatorInterfaceName
<
LinearSolverType
>*>
(
baseCreator
);
AMDIS_TEST_EXIT
(
solverCreator
,
"CreatorInterface could not be cast in CreatorInterfaceName!"
);
linearSolver
=
solverCreator
->
create
(
name
+
"->solver"
);
}
void
createFileWriter
()
...
...
dune/amdis/linear_algebra/LinearAlgebraBase.hpp
View file @
24a3d588
...
...
@@ -7,10 +7,16 @@ namespace AMDiS
// Type-Trait needs to be specialized by linear algebra libraries
template
<
class
Vector
>
struct
BaseVector
{
using
type
=
Vector
;
};
template
<
class
Matrix
>
struct
BaseMatrix
{
using
type
=
Matrix
;
};
}
template
<
class
Vector
>
using
BaseVector
=
typename
Impl
::
BaseVector
<
Vector
>::
type
;
using
BaseVector_t
=
typename
Impl
::
BaseVector
<
Vector
>::
type
;
template
<
class
Matrix
>
using
BaseMatrix_t
=
typename
Impl
::
BaseMatrix
<
Matrix
>::
type
;
namespace
Impl
...
...
dune/amdis/linear_algebra/LinearSolverInterface.hpp
View file @
24a3d588
...
...
@@ -24,8 +24,8 @@ namespace AMDiS
class
LinearSolverInterface
{
protected:
using
RunnerBase
=
RunnerInterface
<
Matrix
,
BaseVector
<
VectorX
>
,
BaseVector
<
VectorB
>>
;
using
RunnerBase
=
RunnerInterface
<
Matrix
,
BaseVector
_t
<
VectorX
>
,
BaseVector
_t
<
VectorB
>>
;
public:
/// Destructor.
...
...
dune/amdis/linear_algebra/PreconditionerInterface.hpp
View file @
24a3d588
...
...
@@ -15,11 +15,11 @@ namespace AMDiS
/// Is called at the end of a solution procedure
virtual
void
exit
()
=
0
;
/// Apply the preconditioner to a vector \p
x
and store the result in \p
y
virtual
void
solve
(
Vector
X
const
&
x
,
VectorX
&
y
)
const
=
0
;
/// Apply the preconditioner to a vector \p
b
and store the result in \p
x
virtual
void
solve
(
Vector
B
const
&
b
,
VectorX
&
x
)
const
=
0
;
/// Apply the transposed preconditioner to a vector \p
x
and store the result in \p
y
virtual
void
adjointSolve
(
Vector
X
const
&
x
,
VectorX
&
y
)
const
/// Apply the transposed preconditioner to a vector \p
b
and store the result in \p
x
virtual
void
adjointSolve
(
Vector
B
const
&
b
,
VectorX
&
x
)
const
{
AMDIS_ERROR_EXIT
(
"Must be implemented by derived class."
);
}
...
...
dune/amdis/linear_algebra/mtl/BITL_Preconditioner.hpp
View file @
24a3d588
#pragma once
#include <dune/amdis/CreatorMap.hpp>
#include <dune/amdis/linear_algebra/mtl/ITL_Preconditioner.hpp>
#include "itl/block_diagonal.hpp"
namespace
AMDiS
{
template
<
class
SubMatrix
,
size_t
N
,
size_t
M
,
class
Vector
>
struct
PreconditionerCreator
<
BlockMTLMatrix
<
SubMatrix
,
N
,
M
>
,
Vector
>
template
<
class
SubMatrix
,
size_t
_
N
,
size_t
_
M
,
class
Vector
>
struct
PreconditionerCreator
<
BlockMTLMatrix
<
SubMatrix
,
_
N
,
_
M
>
,
Vector
>
{
using
Matrix
=
BlockMTLMatrix
<
SubMatrix
,
N
,
M
>
;
using
Matrix
=
BlockMTLMatrix
<
SubMatrix
,
_
N
,
_
M
>
;
using
PreconBase
=
PreconditionerInterface
<
Matrix
,
Vector
>
;
template
<
template
<
class
>
class
ITLPrecon
>
using
Precon
=
Preconditioner
<
Matrix
,
Vector
,
ITLPrecon
<
Matrix
>>
;
static
std
::
unique_ptr
<
PreconBase
>
create
(
std
::
string
name
)
using
Map
=
CreatorMap
<
PreconBase
>
;
static
void
init
()
{
if
(
name
==
"diag"
||
name
==
"jacobi"
)
return
std
::
make_unique
<
Precon
<
DiagonalPreconditioner
>>
();
else
// by default, do nothing
return
std
::
make_unique
<
Precon
<
IdentityPreconditioner
>>
();
auto
pc_diag
=
new
typename
Precon
<
DiagonalPreconditioner
>::
Creator
;
Map
::
addCreator
(
"diag"
,
pc_diag
);
Map
::
addCreator
(
"jacobi"
,
pc_diag
);
auto
pc_id
=
new
typename
Precon
<
IdentityPreconditioner
>::
Creator
;
Map
::
addCreator
(
"identity"
,
pc_id
);
Map
::
addCreator
(
"no"
,
pc_id
);
Map
::
addCreator
(
"default"
,
pc_id
);
}
};
/// Implementation of creatorInterface for preconditioner.
template
<
class
SubMatrix
,
size_t
_N
,
size_t
_M
,
class
Vector
,
class
Matrix
=
BlockMTLMatrix
<
SubMatrix
,
_N
,
_M
>
>
void
addDefaultCreators
(
Type
<
PreconditionerInterface
<
Matrix
,
Vector
>
>
)
{
PreconditionerCreator
<
Matrix
,
Vector
>::
init
();
}
}
// end namespace AMDiS
dune/amdis/linear_algebra/mtl/BITL_Solver.hpp
View file @
24a3d588
#pragma once
#include <dune/amdis/CreatorMap.hpp>
#include <dune/amdis/linear_algebra/mtl/ITL_Solver.hpp>
namespace
AMDiS
...
...
@@ -13,38 +14,56 @@ namespace AMDiS
template
<
class
ITLSolver
>
using
Solver
=
LinearSolver
<
Matrix
,
Vector
,
KrylovRunner
<
ITLSolver
,
Matrix
,
BaseVector
<
Vector
>>>
;
KrylovRunner
<
ITLSolver
,
Matrix
,
BaseVector_t
<
Vector
>>>
;
using
Map
=
CreatorMap
<
SolverBase
>
;
/// Instantiate a new linear solver
static
std
::
unique_ptr
<
SolverBase
>
create
(
std
::
string
name
,
std
::
string
prefix
)
static
void
init
(
)
{
if
(
name
==
"cg"
)
return
std
::
make_unique
<
Solver
<
cg_solver_type
>>
(
prefix
);
else
if
(
name
==
"cgs"
)
return
std
::
make_unique
<
Solver
<
cgs_solver_type
>>
(
prefix
);
else
if
(
name
==
"bicgstab"
||
name
==
"bcgs"
)
return
std
::
make_unique
<
Solver
<
bicgstab_type
>>
(
prefix
);
else
if
(
name
==
"tfqmr"
)
return
std
::
make_unique
<
Solver
<
tfqmr_solver_type
>>
(
prefix
);
else
if
(
name
==
"bicgstab_ell"
||
name
==
"bcgsl"
)
return
std
::
make_unique
<
Solver
<
bicgstab_ell_type
>>
(
prefix
);
else
if
(
name
==
"gmres"
)
return
std
::
make_unique
<
Solver
<
gmres_type
>>
(
prefix
);
else
if
(
name
==
"fgmres"
)
return
std
::
make_unique
<
Solver
<
fgmres_type
>>
(
prefix
);
else
if
(
name
==
"minres"
)
return
std
::
make_unique
<
Solver
<
minres_solver_type
>>
(
prefix
);
else
if
(
name
==
"gcr"
)
return
std
::
make_unique
<
Solver
<
gcr_type
>>
(
prefix
);
// else if (name == "preonly")
// return std::make_unique<Solver<preonly_type>>(prefix);
#ifdef HAVE_UMFPACK
else
if
(
name
==
"umfpack"
||
name
==
"direct"
)
return
std
::
make_unique
<
LinearSolver
<
Matrix
,
Vector
,
UmfpackRunner
<
Matrix
,
BaseVector
<
Vector
>>>
>
(
prefix
);
#endif
else
AMDIS_ERROR_EXIT
(
"Unknown Solver-name!"
);
auto
cg
=
new
typename
Solver
<
cg_solver_type
>::
Creator
;
Map
::
addCreator
(
"cg"
,
cg
);
auto
cgs
=
new
typename
Solver
<
cgs_solver_type
>::
Creator
;
Map
::
addCreator
(
"cgs"
,
cgs
);
auto
bcgs
=
new
typename
Solver
<
bicgstab_type
>::
Creator
;
Map
::
addCreator
(
"bicgstab"
,
bcgs
);
Map
::
addCreator
(
"bcgs"
,
bcgs
);
auto
tfqmr
=
new
typename
Solver
<
tfqmr_solver_type
>::
Creator
;
Map
::
addCreator
(
"tfqmr"
,
tfqmr
);
auto
bcgsl
=
new
typename
Solver
<
bicgstab_ell_type
>::
Creator
;
Map
::
addCreator
(
"bicgstab_ell"
,
bcgsl
);
Map
::
addCreator
(
"bcgsl"
,
bcgsl
);
auto
gmres
=
new
typename
Solver
<
gmres_type
>::
Creator
;
Map
::
addCreator
(
"gmres"
,
gmres
);
auto
fgmres
=
new
typename
Solver
<
fgmres_type
>::
Creator
;
Map
::
addCreator
(
"fgmres"
,
fgmres
);
auto
minres
=
new
typename
Solver
<
minres_solver_type
>::
Creator
;
Map
::
addCreator
(
"minres"
,
minres
);
auto
gcr
=
new
typename
Solver
<
gcr_type
>::
Creator
;
Map
::
addCreator
(
"gcr"
,
gcr
);
auto
umfpack
=
new
typename
LinearSolver
<
Matrix
,
Vector
,
UmfpackRunner
<
Matrix
,
BaseVector_t
<
Vector
>>>::
Creator
;
Map
::
addCreator
(
"umfpack"
,
umfpack
);
Map
::
addCreator
(
"direct"
,
umfpack
);
Map
::
addCreator
(
"default"
,
gmres
);
}
};
/// Implementation of creatorInterface for preconditioner.
template
<
class
SubMatrix
,
size_t
_N
,
size_t
_M
,
class
Vector
,
class
Matrix
=
BlockMTLMatrix
<
SubMatrix
,
_N
,
_M
>
>
void
addDefaultCreators
(
Type
<
LinearSolverInterface
<
Matrix
,
Vector
,
Vector
>
>
)
{
SolverCreator
<
Matrix
,
Vector
>::
init
();
}
}
// end namespace AMDiS
dune/amdis/linear_algebra/mtl/BlockMTLMatrix.hpp
View file @
24a3d588
...
...
@@ -8,6 +8,7 @@
#include <dune/amdis/Basic.hpp>
#include <dune/amdis/Loops.hpp>
#include <dune/amdis/linear_algebra/LinearAlgebraBase.hpp>
namespace
AMDiS
{
...
...
@@ -124,6 +125,17 @@ namespace AMDiS
getColRanges
(
r_cols
);
}
};
namespace
Impl
{
/// Specialization of Impl::MTLMatrix from \file LinearAlgebraBase.hpp
template
<
class
MTLMatrix
,
size_t
_N
,
size_t
_M
>
struct
BaseMatrix
<
BlockMTLMatrix
<
MTLMatrix
,
_N
,
_M
>>
{
using
type
=
MTLMatrix
;
};
}
/// Return the number of overall rows of a BlockMTLMatrix
template
<
class
MTLMatrix
,
size_t
_N
,
size_t
_M
>
...
...
dune/amdis/linear_algebra/mtl/BlockMTLVector.hpp
View file @
24a3d588
...
...
@@ -26,7 +26,7 @@ namespace AMDiS
namespace
Impl
{
/// Specialization of Impl::BaseVector from \file Linear
SolverInterfac
e.hpp
/// Specialization of Impl::BaseVector from \file Linear
AlgebraBas
e.hpp
template
<
class
MTLVector
,
size_t
N
>
struct
BaseVector
<
BlockMTLVector
<
MTLVector
,
N
>>
{
...
...
@@ -74,8 +74,9 @@ namespace AMDiS
/// and copy the value on construction and eventually back on destruction, if
/// required.
template
<
class
BlockVector
,
class
Vector
>
struct
BlockVectorWrapper
class
BlockVectorWrapper
{
public:
BlockVectorWrapper
(
BlockVector
&
blockVector
,
bool
copyBack
=
!
std
::
is_const
<
BlockVector
>::
value
)
:
blockVector
(
blockVector
)
...
...
@@ -108,6 +109,7 @@ namespace AMDiS
mtl
::
irange
range
(
start
,
finish
);
vector
[
range
]
=
blockVector
[
r
];
start
=
finish
;
}
}
...
...
@@ -118,13 +120,14 @@ namespace AMDiS
/// copy from vector to block-vector
template
<
bool
Copy
>
std
::
enable_if_t
<
Copy
>
assignFrom
(
bool_
<
Copy
>
)
{
{
size_t
start
=
0
;
for
(
size_t
r
=
0
;
r
<
blockVector
.
size
();
++
r
)
{
size_t
finish
=
start
+
num_rows
(
blockVector
[
r
]);
mtl
::
irange
range
(
start
,
finish
);
blockVector
[
r
]
=
vector
[
range
];
start
=
finish
;
}
}
...
...
@@ -137,7 +140,7 @@ namespace AMDiS
};
template
<
class
BlockVector
,
class
Vector
=
/**/
MTLDenseVector
<
typename
BlockVector
::
value_type
>
>
template
<
class
BlockVector
,
class
Vector
=
MTLDenseVector
<
typename
BlockVector
::
value_type
>
>
BlockVectorWrapper
<
BlockVector
,
Vector
>