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
iwr
dune-curvedgrid
Commits
3d7f4341
Commit
3d7f4341
authored
Feb 10, 2020
by
Praetorius, Simon
Committed by
Stenger, Florian
Mar 03, 2020
Browse files
initial version of curvedsurfacegrid based on curvedgeometry
parent
3123de92
Changes
5
Show whitespace changes
Inline
Side-by-side
dune.module
View file @
3d7f4341
...
...
@@ -7,5 +7,5 @@ Module: dune-curvedsurfacegrid
Version
:
0.1.0
Maintainer
:
florian
.
stenger
@
tu
-
dresden
.
de
#depending on
Depends
:
dune
-
common
dune
-
geometry
dune
-
grid
dune
-
localfunctions
dune
-
curv
ilinear
geometry
Depends
:
dune
-
common
dune
-
geometry
dune
-
grid
dune
-
localfunctions
dune
-
curv
ed
geometry
Suggests
:
dune
-
alugrid
dune
-
foamgrid
dune/curvedsurfacegrid/coordprovider.hh
View file @
3d7f4341
...
...
@@ -5,6 +5,9 @@
#include
<array>
#include
<dune/localfunctions/lagrange/equidistantpoints.hh>
#include
<dune/localfunctions/lagrange/lagrangelfecache.hh>
namespace
Dune
{
...
...
@@ -220,26 +223,37 @@ namespace Dune
typedef
typename
HostGrid
::
template
Codim
<
codimension
>
::
Entity
HostEntity
;
using
LocalFECache
=
LagrangeLocalFiniteElementCache
<
ctype
,
ctype
,
mydimension
,
Grid
::
order
>
;
using
LocalFiniteElement
=
typename
LocalFECache
::
FiniteElementType
;
public:
CoordProvider
(
const
HostEntity
&
hostEntity
,
const
CoordFunction
&
coordFunction
)
:
coordFunction_
(
coordFunction
),
hostEntity_
(
hostEntity
)
hostEntity_
(
hostEntity
),
localFECache_
(),
localFE_
(
localFECache_
.
get
(
hostEntity
.
type
()))
{}
void
calculate
(
std
::
vector
<
Coordinate
>
&
vertices
)
const
{
const
std
::
size_t
numCorners
=
hostEntity_
.
geometry
().
corners
();
std
::
array
<
Coordinate
,
(
1
<<
mydim
)
>
corners
;
for
(
std
::
size_t
i
=
0
;
i
<
numCorners
;
++
i
)
corners
[
i
]
=
hostEntity_
.
geometry
().
corner
(
i
);
InterpolatoryVerticesGenerator
<
Coordinate
,
mydim
,
Grid
::
order
>::
generate
(
corners
,
vertices
);
for
(
auto
&
v
:
vertices
)
coordFunction_
.
evaluate
(
v
,
v
);
vertices
.
resize
(
localFE_
.
size
());
auto
f
=
[
this
,
geo
=
hostEntity_
.
geometry
()](
auto
const
&
local
)
->
Coordinate
{
Coordinate
res
;
this
->
coordFunction_
.
evaluate
(
geo
.
global
(
local
),
res
);
return
res
;
};
localFE_
.
localInterpolation
().
interpolate
(
f
,
vertices
);
}
private:
const
CoordFunction
&
coordFunction_
;
const
HostEntity
&
hostEntity_
;
LocalFECache
localFECache_
;
LocalFiniteElement
const
&
localFE_
;
};
//CoordProvider (fake)
...
...
@@ -273,6 +287,7 @@ namespace Dune
void
calculate
(
std
::
vector
<
Coordinate
>
&
vertices
)
const
{
throw
"not implemented"
;
const
GeometryType
type
=
hostElement_
.
geometry
().
type
();
auto
refElement
=
referenceElement
<
ctype
,
dimension
>
(
type
);
const
std
::
size_t
numCorners
=
refElement
.
size
(
subEntity_
,
codimension
,
dimension
);
...
...
@@ -328,6 +343,7 @@ namespace Dune
void
calculate
(
std
::
vector
<
Coordinate
>
&
vertices
)
const
{
throw
"not implemented"
;
const
std
::
size_t
numCorners
=
hostLocalGeometry_
.
corners
();
std
::
array
<
Coordinate
,
(
1
<<
mydimension
)
>
corners
;
// $flo: coordFunction is applied here which is in contrast to GeomentryGrid's behaviour!
...
...
dune/curvedsurfacegrid/geometry.hh
View file @
3d7f4341
...
...
@@ -7,7 +7,7 @@
#include
<dune/common/typetraits.hh>
#include
<dune/curv
ilinear
geometry/curv
ilinear
geometry.hh>
#include
<dune/curv
ed
geometry/curv
ed
geometry.hh>
#include
<dune/geometry/referenceelements.hh>
#include
<dune/geometry/type.hh>
...
...
@@ -92,7 +92,7 @@ namespace Dune
static
const
int
codimension
=
dimension
-
mydimension
;
protected:
typedef
C
achedCurvilinear
Geometry
<
ctype
,
mydimension
,
coorddimension
>
BasicMapping
;
typedef
C
urved
Geometry
<
mydimension
,
coorddimension
,
Grid
>
BasicMapping
;
struct
Mapping
:
public
BasicMapping
...
...
@@ -101,7 +101,7 @@ namespace Dune
template
<
class
CoordVector
>
Mapping
(
const
GeometryType
&
type
,
const
CoordVector
&
coords
)
:
BasicMapping
(
type
,
coords
,
Grid
::
order
),
:
BasicMapping
(
type
,
coords
),
refCount_
(
0
)
{}
...
...
@@ -181,24 +181,21 @@ namespace Dune
bool
affine
()
const
{
return
mapping_
->
affine
();
}
GeometryType
type
()
const
{
return
mapping_
->
type
();
}
std
::
vector
<
GlobalCoordinate
>
interpolatoryVertices
()
const
{
return
mapping_
->
vert
exSet
();
}
int
corners
()
const
{
return
mapping_
->
nC
orner
();
}
std
::
vector
<
GlobalCoordinate
>
interpolatoryVertices
()
const
{
return
mapping_
->
vert
ices
();
}
int
corners
()
const
{
return
mapping_
->
c
orner
s
();
}
GlobalCoordinate
corner
(
const
int
i
)
const
{
return
mapping_
->
corner
(
i
);
}
GlobalCoordinate
center
()
const
{
return
mapping_
->
center
();
}
GlobalCoordinate
global
(
const
LocalCoordinate
&
local
)
const
{
return
mapping_
->
global
(
local
);
}
LocalCoordinate
local
(
const
GlobalCoordinate
&
global
)
const
{
LocalCoordinate
l
;
DUNE_UNUSED
bool
b
=
mapping_
->
local
(
global
,
l
);
assert
(
b
);
return
l
;
return
mapping_
->
local
(
global
);
}
GlobalCoordinate
normal
(
const
LocalCoordinate
&
local
)
const
{
return
mapping_
->
normal
(
local
);
}
ctype
integrationElement
(
const
LocalCoordinate
&
local
)
const
{
return
mapping_
->
integrationElement
(
local
);
}
ctype
volume
()
const
{
return
mapping_
->
volume
(
std
::
numeric_limits
<
ctype
>::
epsilon
()
);
}
ctype
volume
()
const
{
return
mapping_
->
volume
();
}
JacobianTransposed
jacobianTransposed
(
const
LocalCoordinate
&
local
)
const
{
return
mapping_
->
jacobianTransposed
(
local
);
}
JacobianInverseTransposed
jacobianInverseTransposed
(
const
LocalCoordinate
&
local
)
const
{
return
mapping_
->
jacobianInverseTransposed
(
local
);
}
...
...
dune/curvedsurfacegrid/test/test_curvedsurfacegrid.cc
View file @
3d7f4341
...
...
@@ -16,7 +16,7 @@
#define STR(s) STR_HELPER(s)
#define STR_HELPER(s) #s
const
int
order
=
3
;
const
int
order
=
2
;
const
int
quad_order
=
order
+
5
;
const
int
num_levels
=
5
;
...
...
example/example.cc
View file @
3d7f4341
...
...
@@ -37,10 +37,10 @@ int main(int argc, char** argv)
//load host-grid (ALUGrid)
using
HostGridType
=
Dune
::
ALUGrid
<
2
,
3
,
simplex
,
conforming
>
;
GridFactory
<
HostGridType
>
gridFactory
;
GmshReader
<
HostGridType
>::
read
(
gridFactory
,
"
dune-curvedsurfacegrid/
example/sphere_coarse.msh"
);
GmshReader
<
HostGridType
>::
read
(
gridFactory
,
"example/sphere_coarse.msh"
);
std
::
shared_ptr
<
HostGridType
>
hostGrid
(
gridFactory
.
createGrid
());
const
int
ip_order
=
5
;
//interpolatory order for curved elements
const
int
ip_order
=
3
;
//interpolatory order for curved elements
//case1: projection to actual sphere
{
...
...
Write
Preview
Supports
Markdown
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