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
D
dune-multimesh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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
Praetorius, Simon
dune-multimesh
Commits
8ed1b0f8
Commit
8ed1b0f8
authored
Jun 28, 2018
by
Praetorius, Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MultiIndexSet cleaned up
parent
a1edbfb1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
45 deletions
+123
-45
dune/multimesh/multigridview.hh
dune/multimesh/multigridview.hh
+7
-40
dune/multimesh/multiindexset.hh
dune/multimesh/multiindexset.hh
+113
-0
dune/multimesh/utility/structuredgridbuilder.hh
dune/multimesh/utility/structuredgridbuilder.hh
+3
-5
No files found.
dune/multimesh/multigridview.hh
View file @
8ed1b0f8
...
@@ -17,46 +17,10 @@
...
@@ -17,46 +17,10 @@
#include <dune/grid/common/gridview.hh>
#include <dune/grid/common/gridview.hh>
#include "mmiterator.hh"
#include "mmiterator.hh"
#include "multiindexset.hh"
namespace
Dune
namespace
Dune
{
{
template
<
class
HostGrid
>
class
MultiIndexSet
{
public:
using
LeafIndexSet
=
typename
HostGrid
::
Traits
::
LeafIndexSet
;
using
LevelIndexSet
=
typename
HostGrid
::
Traits
::
LevelIndexSet
;
using
IndexType
=
std
::
common_type_t
<
typename
LeafIndexSet
::
IndexType
,
typename
LevelIndexSet
::
IndexType
>
;
using
IndexSetTypes
=
std
::
variant
<
LeafIndexSet
const
*
,
LevelIndexSet
const
*>
;
template
<
class
IndexSet
>
MultiIndexSet
(
IndexSet
const
*
indexSet
)
:
indexSets_
(
indexSet
)
{}
MultiIndexSet
(
IndexSetTypes
const
&
indexSet
)
:
indexSets_
(
indexSet
)
{}
template
<
class
Entity
>
IndexType
index
(
const
Entity
&
e
)
const
{
return
std
::
visit
([
&
e
](
auto
const
*
is
)
->
IndexType
{
return
is
->
index
(
e
);
},
indexSets_
);
}
template
<
class
Entity
>
IndexType
subIndex
(
const
Entity
&
e
,
int
i
,
unsigned
int
codim
)
const
{
return
std
::
visit
([
&
e
,
i
,
codim
](
auto
const
*
is
)
->
IndexType
{
return
is
->
subIndex
(
e
,
i
,
codim
);
},
indexSets_
);
}
private:
IndexSetTypes
indexSets_
;
};
// forward declaration
// forward declaration
template
<
class
HostGrid
>
template
<
class
HostGrid
>
class
MultiGridView
;
class
MultiGridView
;
...
@@ -104,8 +68,9 @@ namespace Dune
...
@@ -104,8 +68,9 @@ namespace Dune
using
Grid
=
typename
Traits
::
Grid
;
using
Grid
=
typename
Traits
::
Grid
;
using
GridViewTypes
=
std
::
variant
<
typename
HostGrid
::
LeafGridView
,
typename
HostGrid
::
LevelGridView
>
;
using
GridViewTypes
=
std
::
variant
<
typename
HostGrid
::
LeafGridView
,
typename
HostGrid
::
LevelGridView
>
;
using
IndexSet
=
typename
Traits
::
IndexSet
;
using
IndexSet
=
typename
Traits
::
IndexSet
;
using
IndexSetTypes
=
std
::
variant
<
const
typename
HostGrid
::
LeafIndexSet
*
,
const
typename
HostGrid
::
LevelIndexSet
*>
;
using
IndexSetTypes
=
typename
IndexSet
::
IndexSetTypes
;
using
IntersectionIterator
=
typename
Traits
::
IntersectionIterator
;
using
IntersectionIterator
=
typename
Traits
::
IntersectionIterator
;
using
CollectiveCommunication
=
typename
Traits
::
CollectiveCommunication
;
using
CollectiveCommunication
=
typename
Traits
::
CollectiveCommunication
;
...
@@ -194,14 +159,16 @@ namespace Dune
...
@@ -194,14 +159,16 @@ namespace Dune
// NOTE: IntersectionIterator is one of {LeafIntersectionIterator, LevelIntersectionIterator}
// NOTE: IntersectionIterator is one of {LeafIntersectionIterator, LevelIntersectionIterator}
IntersectionIterator
ibegin
(
std
::
size_t
idx
,
const
typename
Codim
<
0
>::
Entity
&
entity
)
const
IntersectionIterator
ibegin
(
std
::
size_t
idx
,
const
typename
Codim
<
0
>::
Entity
&
entity
)
const
{
{
return
std
::
visit
([
&
entity
](
auto
const
&
gv
)
{
return
gv
.
ibegin
(
entity
);
},
gridViews_
[
idx
]);
using
II
=
IntersectionIterator
;
return
std
::
visit
([
&
entity
](
auto
const
&
gv
)
->
II
{
return
gv
.
ibegin
(
entity
);
},
gridViews_
[
idx
]);
}
}
/// Obtain end intersection iterator with respect to this view
/// Obtain end intersection iterator with respect to this view
// NOTE: IntersectionIterator is one of {LeafIntersectionIterator, LevelIntersectionIterator}
// NOTE: IntersectionIterator is one of {LeafIntersectionIterator, LevelIntersectionIterator}
IntersectionIterator
iend
(
std
::
size_t
idx
,
const
typename
Codim
<
0
>::
Entity
&
entity
)
const
IntersectionIterator
iend
(
std
::
size_t
idx
,
const
typename
Codim
<
0
>::
Entity
&
entity
)
const
{
{
return
std
::
visit
([
&
entity
](
auto
const
&
gv
)
{
return
gv
.
iend
(
entity
);
},
gridViews_
[
idx
]);
using
II
=
IntersectionIterator
;
return
std
::
visit
([
&
entity
](
auto
const
&
gv
)
->
II
{
return
gv
.
iend
(
entity
);
},
gridViews_
[
idx
]);
}
}
/// Obtain collective communication object
/// Obtain collective communication object
...
...
dune/multimesh/multiindexset.hh
0 → 100644
View file @
8ed1b0f8
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_MULTI_INDEXSET_HH
#define DUNE_MULTI_INDEXSET_HH
#if ! DUNE_HAVE_CXX_VARIANT
#error "Require C++17 variant!"
#endif
#include <type_traits>
#include <variant>
#include <dune/common/typetraits.hh>
#include <dune/common/exceptions.hh>
#include <dune/common/std/type_traits.hh>
#include <dune/grid/common/indexidset.hh>
namespace
Dune
{
// forward declaration
template
<
class
HostGrid
>
class
MultiGridView
;
template
<
class
HostGrid
>
class
MultiIndexSet
{
private:
using
LeafIndexSet
=
typename
HostGrid
::
Traits
::
LeafIndexSet
;
using
LevelIndexSet
=
typename
HostGrid
::
Traits
::
LevelIndexSet
;
using
IndexSetTypes
=
std
::
variant
<
LeafIndexSet
const
*
,
LevelIndexSet
const
*>
;
friend
class
MultiGridView
<
HostGrid
>
;
public:
using
IndexType
=
typename
LeafIndexSet
::
IndexType
;
using
Types
=
typename
LeafIndexSet
::
Types
;
static
const
int
dimension
=
LeafIndexSet
::
dimension
;
public:
template
<
class
IndexSet
>
MultiIndexSet
(
IndexSet
const
*
indexSet
)
:
indexSets_
(
indexSet
)
{}
MultiIndexSet
(
IndexSetTypes
const
&
indexSet
)
:
indexSets_
(
indexSet
)
{}
/// Map entity to index.
template
<
class
Entity
>
IndexType
index
(
const
Entity
&
e
)
const
{
return
std
::
visit
([
&
e
](
auto
const
*
is
)
{
return
is
->
index
(
e
);
},
indexSets_
);
}
/// Map entity to index.
template
<
int
cc
>
IndexType
index
(
const
typename
LeafIndexSet
::
Traits
::
template
Codim
<
cc
>
::
Entity
&
e
)
const
{
return
std
::
visit
([
&
e
](
auto
const
*
is
)
{
return
is
->
template
index
<
cc
>(
e
);
},
indexSets_
);
}
/// Map a subentity to an index.
template
<
class
Entity
>
IndexType
subIndex
(
const
Entity
&
e
,
int
i
,
unsigned
int
codim
)
const
{
return
std
::
visit
([
&
e
,
i
,
codim
](
auto
const
*
is
)
{
return
is
->
subIndex
(
e
,
i
,
codim
);
},
indexSets_
);
}
/// Map a subentity to an index.
template
<
int
cc
>
IndexType
subIndex
(
const
typename
LeafIndexSet
::
Traits
::
template
Codim
<
cc
>
::
Entity
&
e
,
int
i
,
unsigned
int
codim
)
const
{
return
std
::
visit
([
&
e
,
i
,
codim
](
auto
const
*
is
)
{
return
is
->
template
subIndex
<
cc
>(
e
,
i
,
codim
);
},
indexSets_
);
}
/// Obtain all geometry types of entities in domain
Types
types
(
int
codim
)
const
{
return
std
::
visit
([
codim
](
auto
const
*
is
)
{
return
is
->
types
(
codim
);
},
indexSets_
);
}
/// Return total number of entities of given geometry type in entity set \f$E\f$.
IndexType
size
(
GeometryType
type
)
const
{
return
std
::
visit
([
&
type
](
auto
const
*
is
)
{
return
is
->
size
(
type
);
},
indexSets_
);
}
/// Return total number of entities of given codim in the entity set \f$E\f$. This
/// is simply a sum over all geometry types.
IndexType
size
(
int
codim
)
const
{
return
std
::
visit
([
codim
](
auto
const
*
is
)
{
return
is
->
size
(
codim
);
},
indexSets_
);
}
/// Return true if the given entity is contained in \f$E\f$.
template
<
class
Entity
>
bool
contains
(
const
Entity
&
e
)
const
{
return
std
::
visit
([
&
e
](
auto
const
*
is
)
{
return
is
->
contains
(
e
);
},
indexSets_
);
}
private:
IndexSetTypes
indexSets_
;
};
}
// end namespace Dune
#endif // DUNE_MULTI_INDEXSET_HH
dune/multimesh/utility/structuredgridbuilder.hh
View file @
8ed1b0f8
...
@@ -37,7 +37,7 @@ namespace Dune
...
@@ -37,7 +37,7 @@ namespace Dune
* \param upperRight Upper right corner of the grid
* \param upperRight Upper right corner of the grid
* \param elements Number of elements in each coordinate direction
* \param elements Number of elements in each coordinate direction
**/
**/
static
std
::
unique_ptr
<
GridType
>
createCubeGrid
(
static
void
createCubeGrid
(
GridFactory
<
GridType
>&
factory
,
GridFactory
<
GridType
>&
factory
,
const
FieldVector
<
ctype
,
dimworld
>&
lowerLeft
,
const
FieldVector
<
ctype
,
dimworld
>&
lowerLeft
,
const
FieldVector
<
ctype
,
dimworld
>&
upperRight
,
const
FieldVector
<
ctype
,
dimworld
>&
upperRight
,
...
@@ -88,9 +88,6 @@ namespace Dune
...
@@ -88,9 +88,6 @@ namespace Dune
factory
.
insertElement
(
GeometryTypes
::
cube
(
dim
),
corners
);
factory
.
insertElement
(
GeometryTypes
::
cube
(
dim
),
corners
);
}
}
}
}
// Create the grid and hand it to the calling method
return
std
::
unique_ptr
<
GridType
>
(
factory
.
createGrid
());
}
}
static
std
::
unique_ptr
<
GridType
>
createCubeGrid
(
static
std
::
unique_ptr
<
GridType
>
createCubeGrid
(
...
@@ -99,7 +96,8 @@ namespace Dune
...
@@ -99,7 +96,8 @@ namespace Dune
const
std
::
array
<
unsigned
int
,
dim
>&
elements
)
const
std
::
array
<
unsigned
int
,
dim
>&
elements
)
{
{
GridFactory
<
GridType
>
factory
;
GridFactory
<
GridType
>
factory
;
return
createCubeGrid
(
factory
,
lowerLeft
,
upperRight
,
elements
);
createCubeGrid
(
factory
,
lowerLeft
,
upperRight
,
elements
);
return
std
::
unique_ptr
<
GridType
>
(
factory
.
createGrid
());
}
}
/// \brief Create a structured simplex grid
/// \brief Create a structured simplex grid
...
...
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