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
Praetorius, Simon
dune-multimesh
Commits
8554254d
Commit
8554254d
authored
Nov 23, 2018
by
Praetorius, Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added gitlabci tests
parent
fa055d7e
Pipeline
#1463
canceled with stage
in 0 seconds
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
326 additions
and
33 deletions
+326
-33
.gitlab-ci.yml
.gitlab-ci.yml
+48
-0
dune.module
dune.module
+2
-2
dune/multimesh/mmentity.hh
dune/multimesh/mmentity.hh
+24
-10
dune/multimesh/mmentityseed.hh
dune/multimesh/mmentityseed.hh
+11
-15
dune/multimesh/mmgridview.hh
dune/multimesh/mmgridview.hh
+1
-1
dune/multimesh/mmhierarchiciterator.hh
dune/multimesh/mmhierarchiciterator.hh
+15
-3
dune/multimesh/multimesh.hh
dune/multimesh/multimesh.hh
+3
-1
src/CMakeLists.txt
src/CMakeLists.txt
+10
-0
src/benchmark.cc
src/benchmark.cc
+169
-0
src/interpolate.cc
src/interpolate.cc
+1
-1
src/profiling.cc
src/profiling.cc
+42
-0
No files found.
.gitlab-ci.yml
0 → 100644
View file @
8554254d
---
before_script
:
-
. /duneci/bin/duneci-init-job
-
duneci-install-module https://gitlab.dune-project.org/core/dune-common.git
-
duneci-install-module https://gitlab.dune-project.org/core/dune-geometry.git
-
duneci-install-module https://gitlab.dune-project.org/core/dune-grid.git
debian:10 gcc-8-noassert-17
:
image
:
registry.dune-project.org/docker/ci/debian:10
script
:
duneci-standard-test
variables
:
DUNECI_TOOLCHAIN
:
gcc-8-noassert-17
tags
:
[
duneci
]
debian:10 clang-6-libcpp-17
:
image
:
registry.dune-project.org/docker/ci/debian:10
script
:
duneci-standard-test
variables
:
DUNECI_TOOLCHAIN
:
clang-6-libcpp-17
tags
:
[
duneci
]
debian:9 gcc-6-14
:
image
:
registry.dune-project.org/docker/ci/debian:9
script
:
duneci-standard-test
variables
:
DUNECI_TOOLCHAIN
:
gcc-6-14
tags
:
[
duneci
]
debian:9 clang-3.8-14
:
image
:
registry.dune-project.org/docker/ci/debian:9
script
:
duneci-standard-test
variables
:
DUNECI_TOOLCHAIN
:
clang-3.8-14
tags
:
[
duneci
]
ubuntu:16.04 gcc-5-14
:
image
:
registry.dune-project.org/docker/ci/ubuntu:16.04
script
:
duneci-standard-test
variables
:
DUNECI_TOOLCHAIN
:
gcc-5-14
tags
:
[
duneci
]
ubuntu:18.04 clang-6-17
:
image
:
registry.dune-project.org/docker/ci/ubuntu:18.04
script
:
duneci-standard-test
variables
:
DUNECI_TOOLCHAIN
:
clang-6-17
tags
:
[
duneci
]
dune.module
View file @
8554254d
...
...
@@ -7,5 +7,5 @@ Module: dune-multimesh
Version
:
0.1
Maintainer
:
simon
.
praetorius
@
tu
-
dresden
.
de
#depending on
Depends
:
dune
-
common
dune
-
grid
Suggests
:
dune
-
uggrid
dune
-
alugrid
dune
-
foamgrid
dune
-
functions
dune
-
geometry
dune
-
istl
Depends
:
dune
-
grid
Suggests
:
dune
-
alugrid
dune
-
foamgrid
dune
-
functions
dune
-
istl
dune
-
spgrid
dune
-
uggrid
dune/multimesh/mmentity.hh
View file @
8554254d
...
...
@@ -19,20 +19,21 @@ namespace Dune
private:
using
ctype
=
typename
HostGrid
::
ctype
;
/// Entity in the host grid
using
HostGridEntity
=
typename
HostGrid
::
Traits
::
template
Codim
<
0
>
::
Entity
;
public:
enum
{
dimension
=
HostGrid
::
dimension
};
enum
{
codimension
=
0
};
enum
{
dimension
=
HostGridEntity
::
dimension
};
enum
{
mydimension
=
HostGridEntity
::
mydimension
};
/// The type of a local geometry
using
LocalGeometry
=
MultiMeshLocalGeometry
<
dimension
,
dimension
,
HostGrid
>
;
using
EntitySeed
=
MultiMeshEntitySeed
<
0
,
HostGrid
>
;
/// Entity in the host grid
using
HostGridEntity
=
typename
HostGrid
::
Traits
::
template
Codim
<
0
>
::
Entity
;
/// Containertype
using
Super
=
std
::
vector
<
HostGridEntity
>
;
/// Seed representing the vector of entities in the MultiMesh
using
EntitySeed
=
MultiEntitySeed
<
0
,
HostGrid
>
;
public:
/// Constructor from std::vector
using
std
::
vector
<
HostGridEntity
>::
vector
;
...
...
@@ -62,6 +63,13 @@ namespace Dune
return
localGeometry
(
source
,
target
).
global
(
sourceLocal
);
}
/// Return the partitionType of any entity in the multiEntity
// [[ expects: all partitionType are the same ]]
PartitionType
partitionType
()
const
{
return
max
().
partitionType
();
}
/// Return the geometry of the entity with maximal level
typename
HostGridEntity
::
Geometry
geometry
()
const
{
...
...
@@ -95,9 +103,15 @@ namespace Dune
* The MultiMeshEntitySeed contains the HostGridEntitySeed and the index of
* the grid it is extracted from.
**/
EntitySeed
seed
(
std
::
size_t
entity_i
)
const
MultiMeshEntitySeed
<
0
,
HostGrid
>
seed
(
std
::
size_t
idx
)
const
{
return
{(
*
this
)[
idx
],
idx
};
}
/// Return an entity seed to restore the multi-entity.
EntitySeed
seed
()
const
{
return
{
(
*
this
)[
entity_i
],
entity_i
};
return
{
*
this
};
}
/// Return the entity with maximal level
...
...
dune/multimesh/mmentityseed.hh
View file @
8554254d
...
...
@@ -10,16 +10,16 @@ namespace Dune
* \ingroup MultiMesh
*
*/
template
<
int
codim
,
class
Grid
Imp
>
template
<
int
codim
,
class
Host
Grid
>
class
MultiMeshEntitySeed
{
protected:
/// Entity type of the hostgrid
typedef
typename
GridImp
::
HostGrid
::
Traits
::
template
Codim
<
codim
>
::
Entity
HostEntity
;
using
HostEntity
=
typename
HostGrid
::
Traits
::
template
Codim
<
codim
>
::
Entity
;
/// EntitySeed type of the hostgrid
typedef
typename
GridImp
::
HostGrid
::
Traits
::
template
Codim
<
codim
>
::
EntitySeed
HostEntitySeed
;
using
HostEntitySeed
=
typename
HostGrid
::
Traits
::
template
Codim
<
codim
>
::
EntitySeed
;
public:
enum
{
codimension
=
codim
};
...
...
@@ -66,13 +66,11 @@ namespace Dune
class
MultiEntity
;
// An entity seed for a vector of entities
template
<
int
codim
,
class
Grid
Imp
>
template
<
int
codim
,
class
Host
Grid
>
class
MultiEntitySeed
{
protected:
using
HostGrid
=
typename
GridImp
::
HostGrid
;
/// Entity type of the hostgrid
using
HostEntity
=
typename
HostGrid
::
Traits
::
template
Codim
<
codim
>
::
Entity
;
...
...
@@ -87,14 +85,11 @@ namespace Dune
{}
/// \brief Create EntitySeed from hostgrid Entity
/**
* We call hostEntity.seed() directly in the constructor
* of MultiMeshEntitySeed to allow for return value optimization.
*/
MultiEntitySeed
(
const
MultiEntity
<
HostGrid
>&
multiEntity
)
template
<
class
MultiEntity
>
MultiEntitySeed
(
const
MultiEntity
&
multiEntity
)
{
//
for (auto const& e : multiEntity)
//
hostEntitySeeds_.emplace_back(e.seed());
for
(
auto
const
&
e
:
multiEntity
)
hostEntitySeeds_
.
emplace_back
(
e
.
seed
());
}
/// Get stored HostEntitySeed
...
...
@@ -106,8 +101,9 @@ namespace Dune
/// Check whether it is safe to create an Entity from this Seed
bool
isValid
()
const
{
return
std
::
all_of
(
hostEntitySeeds_
.
begin
(),
hostEntitySeeds_
.
end
(),
[](
auto
const
&
seed
)
{
return
seed
.
isValid
();
});
return
hostEntitySeeds_
.
empty
()
?
false
:
std
::
all_of
(
hostEntitySeeds_
.
begin
(),
hostEntitySeeds_
.
end
(),
[](
auto
const
&
seed
)
{
return
seed
.
isValid
();
});
}
private:
...
...
dune/multimesh/mmgridview.hh
View file @
8554254d
...
...
@@ -56,7 +56,7 @@ namespace Dune
using
Grid
=
typename
Traits
::
Grid
;
/// Type of the corresponding GridType hosted by the MultiMesh
using
HostGrid
=
typename
GridImp
::
HostGrid
Type
;
using
HostGrid
=
typename
GridImp
::
HostGrid
;
using
IndexSet
=
typename
Traits
::
IndexSet
;
using
Intersection
=
typename
Traits
::
Intersection
;
...
...
dune/multimesh/mmhierarchiciterator.hh
View file @
8554254d
...
...
@@ -117,11 +117,17 @@ namespace Dune
// 3. go down in tree until leaf entity
auto
child
=
dereference
();
for
(;
!
(
contains_
(
child
)
||
child
.
isLeaf
());
child
=
dereference
())
{
assert
(
child
.
isRegular
()
&&
"No irregular elements allowed in multi-mesh traversal"
);
entityStack_
.
emplace
(
child
);
assert
(
entityStack_
.
size
()
<=
maxLevel_
);
}
// 4. go up in tree again to the first regular entity, since
// irregular element can not be traversed in a multi-mesh sense
while
(
!
child
.
isRegular
()
&&
!
entityStack_
.
empty
())
{
entityStack_
.
pop
();
child
=
dereference
();
}
assert
(
contains_
(
child
)
&&
"No valid child element found in gridView"
);
}
...
...
@@ -150,11 +156,17 @@ namespace Dune
// 1. go down in tree until leaf entity
auto
child
=
dereference
();
for
(;
!
(
contains_
(
child
)
||
child
.
isLeaf
());
child
=
dereference
())
{
assert
(
child
.
isRegular
()
&&
"No irregular elements allowed in multi-mesh traversal"
);
entityStack_
.
emplace
(
child
);
assert
(
entityStack_
.
size
()
<=
maxLevel_
);
}
// 2. go up in tree again to the first regular entity, since
// irregular element can not be traversed in a multi-mesh sense
while
(
!
child
.
isRegular
()
&&
!
entityStack_
.
empty
())
{
entityStack_
.
pop
();
child
=
dereference
();
}
assert
(
contains_
(
child
)
&&
"No valid child element found in gridView"
);
}
...
...
@@ -167,7 +179,7 @@ namespace Dune
};
template
<
class
Entity
,
class
GridView
>
inline
auto
childs
(
const
Entity
&
entity
,
const
GridView
&
gridView
)
inline
auto
childs
(
const
Entity
&
entity
,
const
GridView
&
gridView
)
{
using
Iterator
=
MultiMeshHierarchicIterator
<
typename
GridView
::
Grid
>
;
return
IteratorRange
<
Iterator
>
{
Iterator
{
entity
,
gridView
},
Iterator
{
true
}
};
...
...
dune/multimesh/multimesh.hh
View file @
8554254d
...
...
@@ -111,6 +111,8 @@ namespace Dune
/// The type used to store coordinates, inherited from the HostGrid
using
ctype
=
typename
HostGrid
::
ctype
;
enum
{
dimension
=
HostGrid
::
dimension
};
enum
{
dimensionworld
=
HostGrid
::
dimensionworld
};
/// \brief Constructor, stores n copies of the hostgrid
/**
...
...
@@ -475,7 +477,7 @@ namespace Dune
template
<
class
HostGrid
,
int
codim
>
struct
hasEntityIterator
<
MultiMesh
<
HostGrid
>
,
codim
>
{
static
const
bool
v
=
hasEntityIterator
<
HostGrid
,
codim
>::
v
;
static
const
bool
v
=
(
codim
==
0
)
;
};
/** \brief has conforming level grids when host grid has
...
...
src/CMakeLists.txt
View file @
8554254d
...
...
@@ -25,6 +25,16 @@ if (HAVE_ALBERTA)
add_dune_alberta_flags
(
"taylorhood"
)
endif
()
add_executable
(
"benchmark"
benchmark.cc
)
target_link_dune_default_libraries
(
"benchmark"
)
if
(
HAVE_ALBERTA
)
add_dune_alberta_flags
(
GRIDDIM 2 WORLDDIM 2
"benchmark"
)
endif
()
add_executable
(
"profiling"
profiling.cc
)
target_link_dune_default_libraries
(
"profiling"
)
find_package
(
MTL PATHS /opt/development/mtl4
)
if
(
MTL_FOUND
)
set
(
CXX_ELEVEN_FEATURE_LIST
"MOVE"
"AUTO"
"RANGEDFOR"
"INITLIST"
"STATICASSERT"
"DEFAULTIMPL"
)
...
...
src/benchmark.cc
0 → 100644
View file @
8554254d
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <iostream>
#include <dune/common/parallel/mpihelper.hh> // An initializer of MPI
#include <dune/common/exceptions.hh> // We use exceptions
#include <dune/common/filledarray.hh>
#include <dune/common/timer.hh>
#include <dune/grid/onedgrid.hh>
#include <dune/grid/yaspgrid.hh>
#if HAVE_ALBERTA
#include <dune/grid/albertagrid.hh>
#endif
#if HAVE_UG
#include <dune/grid/uggrid.hh>
#endif
#if HAVE_DUNE_ALUGRID
#include <dune/alugrid/grid.hh>
#endif
#if HAVE_DUNE_FOAMGRID
#include <dune/foamgrid/foamgrid.hh>
#endif
#if HAVE_DUNE_SPGRID
#include <dune/grid/spgrid.hh>
#endif
#include <dune/multimesh/multimesh.hh>
#include <dune/multimesh/mmgridfactory.hh>
#include <dune/multimesh/utility/structuredgridbuilder.hh>
using
namespace
Dune
;
template
<
class
Grid
>
std
::
size_t
traverse
(
Grid
const
&
grid
)
{
std
::
size_t
num
=
0
;
for
(
auto
const
&
entities
:
elements
(
grid
.
leafGridView
()))
{
++
num
;
}
return
num
;
}
template
<
class
HostGrid
>
void
simplex_grid
(
std
::
string
name
,
int
refCount
)
{
const
int
dow
=
HostGrid
::
dimensionworld
;
using
Factory
=
StructuredGridBuilder
<
MultiMesh
<
HostGrid
>
>
;
GridFactory
<
MultiMesh
<
HostGrid
>
>
gridFactory
(
2
);
FieldVector
<
double
,
dow
>
lower
;
lower
=
-
1.5
;
FieldVector
<
double
,
dow
>
upper
;
upper
=
1.5
;
auto
num_elements
=
filledArray
<
dow
,
unsigned
int
>
(
2
);
Factory
::
createSimplexGrid
(
gridFactory
,
lower
,
upper
,
num_elements
);
auto
gridPtr
=
gridFactory
.
createGrid
();
auto
&
grids
=
*
gridPtr
;
grids
.
globalRefine
(
refCount
);
std
::
cout
<<
name
<<
"
\n
"
;
Timer
t
;
std
::
size_t
num_multimesh
=
traverse
(
grids
);
double
time_multimesh
=
t
.
elapsed
();
t
.
reset
();
std
::
size_t
num_singlemesh
=
traverse
(
grids
[
0
]);
double
time_singlemesh
=
t
.
elapsed
();
std
::
cout
<<
" [size(multimesh), size(singlemesh)]: ["
<<
num_multimesh
<<
", "
<<
num_singlemesh
<<
"]
\n
"
;
std
::
cout
<<
" multimesh: "
<<
time_multimesh
<<
"sec
\n
"
;
std
::
cout
<<
" singlemesh: "
<<
time_singlemesh
<<
"sec
\n
"
;
std
::
cout
<<
" ratio: "
<<
(
time_multimesh
/
time_singlemesh
)
<<
"
\n
"
;
}
template
<
class
HostGrid
>
void
cubes_grid
(
std
::
string
name
,
int
refCount
)
{
const
int
dow
=
HostGrid
::
dimensionworld
;
using
Factory
=
StructuredGridBuilder
<
MultiMesh
<
HostGrid
>
>
;
GridFactory
<
MultiMesh
<
HostGrid
>
>
gridFactory
(
2
);
FieldVector
<
double
,
dow
>
lower
;
lower
=
-
1.5
;
FieldVector
<
double
,
dow
>
upper
;
upper
=
1.5
;
auto
num_elements
=
filledArray
<
dow
,
unsigned
int
>
(
2
);
Factory
::
createCubeGrid
(
gridFactory
,
lower
,
upper
,
num_elements
);
auto
gridPtr
=
gridFactory
.
createGrid
();
auto
&
grids
=
*
gridPtr
;
grids
.
globalRefine
(
refCount
);
std
::
cout
<<
name
<<
"
\n
"
;
Timer
t
;
std
::
size_t
num_multimesh
=
traverse
(
grids
);
double
time_multimesh
=
t
.
elapsed
();
t
.
reset
();
std
::
size_t
num_singlemesh
=
traverse
(
grids
[
0
]);
double
time_singlemesh
=
t
.
elapsed
();
std
::
cout
<<
" [size(multimesh), size(singlemesh)]: ["
<<
num_multimesh
<<
", "
<<
num_singlemesh
<<
"]
\n
"
;
std
::
cout
<<
" multimesh: "
<<
time_multimesh
<<
"sec
\n
"
;
std
::
cout
<<
" singlemesh: "
<<
time_singlemesh
<<
"sec
\n
"
;
std
::
cout
<<
" ratio: "
<<
(
time_multimesh
/
time_singlemesh
)
<<
"
\n
"
;
}
template
<
class
HostGrid
,
class
...
Args
>
void
structured_grid
(
std
::
string
name
,
int
refCount
,
Args
&&
...
args
)
{
MultiMesh
<
HostGrid
>
grids
(
2
,
std
::
forward
<
Args
>
(
args
)...);
grids
.
globalRefine
(
refCount
);
std
::
cout
<<
name
<<
"
\n
"
;
Timer
t
;
std
::
size_t
num_multimesh
=
traverse
(
grids
);
double
time_multimesh
=
t
.
elapsed
();
t
.
reset
();
std
::
size_t
num_singlemesh
=
traverse
(
grids
[
0
]);
double
time_singlemesh
=
t
.
elapsed
();
std
::
cout
<<
" [size(multimesh), size(singlemesh)]: ["
<<
num_multimesh
<<
", "
<<
num_singlemesh
<<
"]
\n
"
;
std
::
cout
<<
" multimesh: "
<<
time_multimesh
<<
"sec
\n
"
;
std
::
cout
<<
" singlemesh: "
<<
time_singlemesh
<<
"sec
\n
"
;
std
::
cout
<<
" ratio: "
<<
(
time_multimesh
/
time_singlemesh
)
<<
"
\n
"
;
}
int
main
(
int
argc
,
char
**
argv
)
{
MPIHelper
::
instance
(
argc
,
argv
);
FieldVector
<
double
,
1
>
lower1
{
-
1.5
};
FieldVector
<
double
,
2
>
lower2
{
-
1.5
,
-
1.5
};
FieldVector
<
double
,
3
>
lower3
{
-
1.5
,
-
1.5
,
-
1.5
};
FieldVector
<
double
,
1
>
upper1
{
1.5
};
FieldVector
<
double
,
2
>
upper2
{
1.5
,
1.5
};
FieldVector
<
double
,
3
>
upper3
{
1.5
,
1.5
,
1.5
};
structured_grid
<
OneDGrid
>
(
"OneDGrid"
,
16
,
2
,
lower1
[
0
],
upper1
[
0
]);
structured_grid
<
YaspGrid
<
1
,
EquidistantOffsetCoordinates
<
double
,
1
>>>
(
"YaspGrid<1>"
,
16
,
lower1
,
upper1
,
std
::
array
<
int
,
1
>
{
2
});
structured_grid
<
YaspGrid
<
2
,
EquidistantOffsetCoordinates
<
double
,
2
>>>
(
"YaspGrid<2>"
,
8
,
lower2
,
upper2
,
std
::
array
<
int
,
2
>
{
2
,
2
});
structured_grid
<
YaspGrid
<
3
,
EquidistantOffsetCoordinates
<
double
,
3
>>>
(
"YaspGrid<3>"
,
6
,
lower3
,
upper3
,
std
::
array
<
int
,
3
>
{
2
,
2
,
2
});
#if HAVE_ALBERTA
// simplex_grid<AlbertaGrid<1,1>>("AlbertaGrid<1>", 8);
// simplex_grid<AlbertaGrid<2,2>>("AlbertaGrid<2>", 6);
simplex_grid
<
AlbertaGrid
<
ALBERTA_DIM
,
ALBERTA_DIM
>>
(
"AlbertaGrid<"
+
std
::
to_string
(
ALBERTA_DIM
)
+
">"
,
4
);
#endif
#if HAVE_UG
// simplex_grid<UGGrid<1>>("UGGrid<1>", 8);
simplex_grid
<
UGGrid
<
2
>>
(
"UGGrid<2>"
,
8
);
simplex_grid
<
UGGrid
<
3
>>
(
"UGGrid<3>"
,
4
);
cubes_grid
<
UGGrid
<
2
>>
(
"UGGrid<2,cube>"
,
8
);
cubes_grid
<
UGGrid
<
3
>>
(
"UGGrid<3,cube>"
,
4
);
#endif
#if HAVE_DUNE_ALUGRID
simplex_grid
<
Dune
::
ALUGrid
<
2
,
2
,
simplex
,
conforming
>
>
(
"ALUGrid<2,conforming>"
,
8
);
// simplex_grid<Dune::ALUGrid<3, 3, simplex, conforming> >("ALUGrid<3,conforming>", 4);
simplex_grid
<
Dune
::
ALUGrid
<
2
,
2
,
simplex
,
nonconforming
>
>
(
"ALUGrid<2,nonconforming>"
,
6
);
simplex_grid
<
Dune
::
ALUGrid
<
3
,
3
,
simplex
,
nonconforming
>
>
(
"ALUGrid<3,nonconforming>"
,
4
);
cubes_grid
<
Dune
::
ALUGrid
<
2
,
2
,
cube
,
nonconforming
>
>
(
"ALUGrid<2,cube,nonconforming>"
,
6
);
cubes_grid
<
Dune
::
ALUGrid
<
3
,
3
,
cube
,
nonconforming
>
>
(
"ALUGrid<3,cube,nonconforming>"
,
4
);
#endif
#if HAVE_DUNE_SPGRID
structured_grid
<
SPGrid
<
double
,
1
>>
(
"SPGrid<1>"
,
16
,
lower1
,
upper1
,
std
::
array
<
int
,
1
>
{
2
});
structured_grid
<
SPGrid
<
double
,
2
>>
(
"SPGrid<2>"
,
8
,
lower2
,
upper2
,
std
::
array
<
int
,
2
>
{
2
,
2
});
structured_grid
<
SPGrid
<
double
,
3
>>
(
"SPGrid<3>"
,
6
,
lower3
,
upper3
,
std
::
array
<
int
,
3
>
{
2
,
2
,
2
});
#endif
}
src/interpolate.cc
View file @
8554254d
...
...
@@ -126,7 +126,7 @@ int main(int argc, char** argv)
double
timeInterpolate
=
0
;
double
timeWriteFile
=
0
;
Interpolation
<
Grid
,
VectorType
>
interpolation
(
grids
);
Interpolation
<
Grid
>
interpolation
(
grids
);
// assemble a sequence of systems for finer and finer grids
for
(
int
i
=
1
;
i
<
20
;
++
i
)
{
...
...
src/profiling.cc
0 → 100644
View file @
8554254d
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <iostream>
#include <dune/common/parallel/mpihelper.hh> // An initializer of MPI
#include <dune/common/timer.hh>
#include <dune/grid/onedgrid.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/multimesh/multimesh.hh>
using
namespace
Dune
;
template
<
class
Grid
>
void
traverse
(
Grid
const
&
grid
)
{
double
area
=
0
;
int
num_boundary_elements
=
0
;
for
(
auto
const
&
entities
:
elements
(
grid
.
leafGridView
()))
{
area
+=
entities
.
geometry
().
volume
();
num_boundary_elements
+=
entities
.
hasBoundaryIntersections
()
?
1
:
0
;
}
std
::
cout
<<
" boundaryIntersections: "
<<
num_boundary_elements
<<
"
\n
"
;
std
::
cout
<<
" area: "
<<
area
<<
"
\n
"
;
}
int
main
(
int
argc
,
char
**
argv
)
{
MPIHelper
::
instance
(
argc
,
argv
);
using
HostGrid
=
YaspGrid
<
2
,
EquidistantOffsetCoordinates
<
double
,
2
>>
;
FieldVector
<
double
,
2
>
lower2
{
-
1.5
,
-
1.5
};
FieldVector
<
double
,
2
>
upper2
{
1.5
,
1.5
};
MultiMesh
<
HostGrid
>
grids
(
2
,
lower2
,
upper2
,
std
::
array
<
int
,
2
>
{
32
,
32
});
std
::
cout
<<
"YaspGrid<2>
\n
"
;
Timer
t
;
traverse
(
grids
);
std
::
cout
<<
" time:"
<<
t
.
elapsed
()
<<
"sec
\n
"
;
}
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