Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
amdis
amdis-core
Commits
d64976bf
Commit
d64976bf
authored
Aug 06, 2020
by
Müller, Felix
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove makeGlobalBasis
parent
ccde07a0
Pipeline
#4558
passed with stage
in 42 minutes and 59 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
44 deletions
+41
-44
amdis/ProblemStatTraits.hpp
amdis/ProblemStatTraits.hpp
+2
-2
amdis/functions/ParallelGlobalBasis.hpp
amdis/functions/ParallelGlobalBasis.hpp
+28
-29
docs/reference/DOFVector.md
docs/reference/DOFVector.md
+6
-7
docs/tutorials/grids-and-discretefunctions.md
docs/tutorials/grids-and-discretefunctions.md
+2
-3
test/DOFVectorTest.cpp
test/DOFVectorTest.cpp
+1
-1
test/ProblemStatTest.cpp
test/ProblemStatTest.cpp
+2
-2
No files found.
amdis/ProblemStatTraits.hpp
View file @
d64976bf
...
...
@@ -91,12 +91,12 @@ namespace AMDiS
static
auto
create
(
std
::
string
const
&
name
,
GridView
const
&
gridView
)
{
return
make
GlobalBasis
(
name
,
gridView
,
PreBasisCreator
::
create
());
return
Parallel
GlobalBasis
(
name
,
gridView
,
PreBasisCreator
::
create
());
}
static
auto
create
(
GridView
const
&
gridView
)
{
return
make
GlobalBasis
(
gridView
,
PreBasisCreator
::
create
());
return
Parallel
GlobalBasis
(
gridView
,
PreBasisCreator
::
create
());
}
using
GlobalBasis
=
decltype
(
create
(
std
::
declval
<
GridView
>
()));
...
...
amdis/functions/ParallelGlobalBasis.hpp
View file @
d64976bf
...
...
@@ -37,6 +37,13 @@
namespace
AMDiS
{
template
<
class
PreBasisFactory
>
using
MultiIndex
=
std
::
conditional_t
<
(
remove_cvref_t
<
PreBasisFactory
>::
requiredMultiIndexSize
==
1
),
Dune
::
Functions
::
FlatMultiIndex
<
std
::
size_t
>
,
Dune
::
ReservedVector
<
std
::
size_t
,
remove_cvref_t
<
PreBasisFactory
>::
requiredMultiIndexSize
>>
;
/**
* \brief Parallel global basis defined on a (sequential) pre-basis
*
...
...
@@ -92,11 +99,11 @@ namespace AMDiS
,
comm_
(
CommunicationCreator
<
Comm
>::
create
(
static_cast
<
Super
const
&>
(
*
this
),
name
+
"->solver"
))
{}
/// Construct this global basis with
empty name
template
<
class
...
Args
,
Dune
::
Functions
::
enableIfConstructible
<
PreBasis
,
Args
...>
=
0
>
ParallelGlobalBasis
(
Grid
const
&
grid
,
Args
&&
...
args
)
:
ParallelGlobalBasis
(
std
::
string
(
""
),
grid
,
FWD
(
args
)...
)
/// Construct this global basis with
a preBasisFactory
template
<
class
PBF
>
ParallelGlobalBasis
(
std
::
string
const
&
name
,
GridView
const
&
gridView
,
PBF
&&
preBasisFactory
)
:
ParallelGlobalBasis
(
name
,
gridView
.
grid
(),
preBasisFactory
.
template
makePreBasis
<
MultiIndex
<
PBF
>
>
(
gridView
)
)
{}
/// Converting constructor from dune-functions style basis.
...
...
@@ -105,10 +112,16 @@ namespace AMDiS
* argument and a new communication object is built.
*/
template
<
class
GB_
,
Dune
::
disableCopyMove
<
Self
,
GB_
>
=
0
,
REQUIRES
(
Concepts
::
GlobalBasis
<
GB_
,
GridView
>)
>
ParallelGlobalBasis
(
GB_
&&
from
)
:
ParallelGlobalBasis
(
std
::
string
(
""
),
from
.
gridView
().
grid
(),
from
.
preBasis
())
ParallelGlobalBasis
(
std
::
string
const
&
name
,
GB_
&&
from
)
:
ParallelGlobalBasis
(
name
,
from
.
gridView
().
grid
(),
from
.
preBasis
())
{}
/// Construct this global basis with empty name
template
<
class
Arg
,
class
...
Args
,
REQUIRES
(
!
std
::
is_same_v
<
std
::
string
,
remove_cvref_t
<
Arg
>
>
)
>
ParallelGlobalBasis
(
Arg
&&
arg
,
Args
&&
...
args
)
:
ParallelGlobalBasis
(
std
::
string
(
""
),
FWD
(
arg
),
FWD
(
args
)...)
{}
/// Copy constructor
...
...
@@ -175,29 +188,15 @@ namespace AMDiS
};
template
<
class
MultiIndex
,
class
GV
,
class
PBF
>
auto
makeGlobalBasis
(
std
::
string
const
&
name
,
GV
const
&
gridView
,
PBF
&&
preBasisFactory
)
{
auto
preBasis
=
preBasisFactory
.
template
makePreBasis
<
MultiIndex
>(
gridView
);
return
ParallelGlobalBasis
<
TYPEOF
(
preBasis
)
>
(
name
,
gridView
.
grid
(),
std
::
move
(
preBasis
));
}
// Deduction guides
template
<
class
GV
,
class
PBF
>
auto
makeGlobalBasis
(
std
::
string
const
&
name
,
GV
const
&
gridView
,
PBF
&&
preBasisFactory
)
{
using
RawPreBasisFactory
=
remove_cvref_t
<
PBF
>
;
using
MultiIndex
=
std
::
conditional_t
<
(
RawPreBasisFactory
::
requiredMultiIndexSize
==
1
),
Dune
::
Functions
::
FlatMultiIndex
<
std
::
size_t
>
,
Dune
::
ReservedVector
<
std
::
size_t
,
RawPreBasisFactory
::
requiredMultiIndexSize
>>
;
return
makeGlobalBasis
<
MultiIndex
,
GV
,
PBF
>
(
name
,
gridView
,
FWD
(
preBasisFactory
));
}
ParallelGlobalBasis
(
std
::
string
const
&
name
,
GV
const
&
gridView
,
PBF
&&
preBasisFactory
)
->
ParallelGlobalBasis
<
decltype
(
preBasisFactory
.
template
makePreBasis
<
MultiIndex
<
PBF
>
>
(
gridView
))
>
;
template
<
class
GV
,
class
PBF
>
auto
makeGlobalBasis
(
GV
const
&
gridView
,
PBF
&&
preBasisFactory
)
{
return
makeGlobalBasis
(
std
::
string
(
""
),
gridView
,
FWD
(
preBasisFactory
));
}
ParallelGlobalBasis
(
GV
const
&
gridView
,
PBF
&&
preBasisFactory
)
->
ParallelGlobalBasis
<
decltype
(
preBasisFactory
.
template
makePreBasis
<
MultiIndex
<
PBF
>
>
(
gridView
))
>
;
}
// end namespace AMDiS
docs/reference/DOFVector.md
View file @
d64976bf
...
...
@@ -109,12 +109,12 @@ using Grid = Dune::YaspGrid<2>;
Grid
grid
({
1.0
,
1.0
},
{
2
,
2
});
using
namespace
Dune
::
Functions
::
BasisFactory
;
auto
basis1
=
make
GlobalBasis
(
grid
.
leafGridView
(),
lagrange
<
2
>
());
Parallel
GlobalBasis
basis1
(
grid
.
leafGridView
(),
lagrange
<
2
>
());
DOFVector
<
decltype
(
basis1
)
>
vec0
(
basis1
);
DOFVector
vec1
(
basis1
);
// C++17 only
auto
basis2
=
makeUniquePtr
(
make
GlobalBasis
(
grid
.
leafGridView
(),
lagrange
<
2
>
()));
auto
basis2
=
makeUniquePtr
(
Parallel
GlobalBasis
(
grid
.
leafGridView
(),
lagrange
<
2
>
()));
DOFVector
<
Underlying_t
<
decltype
(
basis2
)
>>
vec2
(
std
::
move
(
basis2
));
```
...
...
@@ -251,7 +251,7 @@ underlying type is either the `remove_cvref_t` for references, or the pointed-to
using
namespace
Dune
::
Functions
::
BasisFactory
;
// pass a reference to the basis
auto
basis1
=
make
GlobalBasis
(
gridView
,
lagrange
<
2
>
());
Parallel
GlobalBasis
basis1
(
gridView
,
lagrange
<
2
>
());
auto
vec1
=
makeDOFVector
<
double
>
(
basis1
);
// pass a smart pointer
...
...
@@ -391,7 +391,7 @@ Returns the const (1) or mutable (2) sub-range view of the stored DOFVector.
#### Example
```
c++
auto
basis
=
make
GlobalBasis
(
gridView
,
power
<
3
>
(
lagrange
<
1
>
()));
Parallel
GlobalBasis
basis
(
gridView
,
power
<
3
>
(
lagrange
<
1
>
()));
auto
vec
=
makeDOFVector
(
basis
);
auto
df
=
makeDiscreteFunction
(
vec
);
...
...
@@ -452,7 +452,7 @@ Note, the range type of the expression must be compatible with the `Range` type
#### Example
```
c++
auto
basis
=
make
GlobalBasis
(
gridView
,
power
<
3
>
(
lagrange
<
1
>
()));
Parallel
GlobalBasis
basis
(
gridView
,
power
<
3
>
(
lagrange
<
1
>
()));
auto
vec
=
makeDOFVector
(
basis
);
auto
df1
=
vec
.
child
();
...
...
@@ -504,7 +504,7 @@ thereby given by the type of `makeTreePath(preTreePath)`.
using
namespace
Dune
::
Functions
::
BasisFactory
;
// pass a reference to the basis
auto
basis
=
make
GlobalBasis
(
gridView
,
power
<
2
>
(
lagrange
<
2
>
()));
Parallel
GlobalBasis
basis
(
gridView
,
power
<
2
>
(
lagrange
<
2
>
()));
auto
vec
=
makeDOFVector
<
double
>
(
basis1
);
auto
df1
=
makeDiscreteFunction
(
vec
);
...
...
@@ -512,4 +512,3 @@ auto df2 = makeDiscreteFunction(vec, 1);
auto
df3
=
makeDiscreteFunction
(
vec
,
_1
);
auto
df4
=
makeDiscreteFunction
(
vec
,
Dune
::
TypeTree
::
hybridTreePath
(
0
));
```
docs/tutorials/grids-and-discretefunctions.md
View file @
d64976bf
...
...
@@ -119,7 +119,7 @@ using namespace Dune::Functions::BasisFactory;
// create a power basis of 3 lagrange bases with local polynomial degree 2
// on the leaf elements of the grid
auto
basis1
=
make
GlobalBasis
(
grid2
->
leafGridView
(),
power
<
3
>
(
lagrange
<
2
>
()));
Parallel
GlobalBasis
basis1
(
grid2
->
leafGridView
(),
power
<
3
>
(
lagrange
<
2
>
()));
```
or by using some predefined wrappers:
...
...
@@ -139,8 +139,7 @@ auto basis2 = BasisCreator::create(grid2->leafGridView());
grid refinement or by repartitioning. Additionally, it stores a communication object
to construct global DOFMappings for distributed data structured.
This `ParallelGlobalBasis` is automatically constructed with `makeGlobalBasis` and
can be converted from a `DefaultGlobalBasis` of dune-functions.
This `ParallelGlobalBasis` can be converted from a `DefaultGlobalBasis` of dune-functions.
A
[
`DOFVector`
](
../reference/DOFVector.md
)
takes a global basis and provides the coefficient vector as data member.
...
...
test/DOFVectorTest.cpp
View file @
d64976bf
...
...
@@ -72,7 +72,7 @@ int main(int argc, char** argv)
auto
preBasis
=
composite
(
power
<
2
>
(
lagrange
<
2
>
(),
flatInterleaved
()),
lagrange
<
1
>
(),
flatLexicographic
());
auto
basis
=
make
GlobalBasis
(
gridView
,
preBasis
);
Parallel
GlobalBasis
basis
(
gridView
,
preBasis
);
using
Basis
=
decltype
(
basis
);
...
...
test/ProblemStatTest.cpp
View file @
d64976bf
...
...
@@ -22,9 +22,9 @@ void test()
// use T as range type for basis
using
namespace
Dune
::
Functions
::
BasisFactory
;
#if DUNE_VERSION_LT(DUNE_FUNCTIONS,2,7)
auto
basis
=
make
GlobalBasis
(
grid
.
leafGridView
(),
power
<
1
>
(
lagrange
<
1
>
(),
flatLexicographic
()));
Parallel
GlobalBasis
basis
(
grid
.
leafGridView
(),
power
<
1
>
(
lagrange
<
1
>
(),
flatLexicographic
()));
#else
auto
basis
=
make
GlobalBasis
(
grid
.
leafGridView
(),
power
<
1
>
(
lagrange
<
1
,
T
>
(),
flatLexicographic
()));
Parallel
GlobalBasis
basis
(
grid
.
leafGridView
(),
power
<
1
>
(
lagrange
<
1
,
T
>
(),
flatLexicographic
()));
#endif
using
Basis
=
decltype
(
basis
);
...
...
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