Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-curvedgeometry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
extensions
dune-curvedgeometry
Commits
315ab02a
Commit
315ab02a
authored
5 years ago
by
Simon Praetorius
Browse files
Options
Downloads
Patches
Plain Diff
added example and restructured geometry implementation
parent
4e260c21
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune.module
+1
-1
1 addition, 1 deletion
dune.module
dune/curvedgeometry/curvedgeometry.hh
+4
-6
4 additions, 6 deletions
dune/curvedgeometry/curvedgeometry.hh
src/dune-curvedgeometry.cc
+46
-18
46 additions, 18 deletions
src/dune-curvedgeometry.cc
with
51 additions
and
25 deletions
dune.module
+
1
−
1
View file @
315ab02a
...
...
@@ -9,4 +9,4 @@ Maintainer: simon.praetorius@tu-dresden.de
# Required build dependencies
Depends
:
dune
-
geometry
dune
-
localfunctions
# Optional build dependencies
#
Suggests:
Suggests
:
dune
-
grid
This diff is collapsed.
Click to expand it.
dune/curvedgeometry/curvedgeometry.hh
+
4
−
6
View file @
315ab02a
...
...
@@ -131,19 +131,17 @@ namespace Dune
* \tparam ct coordinate type
* \tparam mydim geometry dimension
* \tparam cdim coordinate dimension
* \tparam Traits traits allowing to tweak some implementation details
* (optional)
* \tparam polynomial_order
*
* The requirements on the traits are documented along with their default,
* CurvedGeometryTraits.
*/
template
<
int
mydim
,
int
cdim
,
class
GridImpl
>
template
<
class
ct
,
int
mydim
,
int
cdim
,
int
polynomial_order
>
class
CurvedGeometry
:
public
GeometryDefaultImplementation
<
mydim
,
cdim
,
GridImpl
,
CurvedGeometry
>
{
public:
/// coordinate type
using
ctype
=
t
ypename
GridImpl
::
ctype
;
using
ctype
=
c
t
;
using
Traits
=
CurvedGeometryTraits
<
ctype
>
;
...
...
@@ -153,7 +151,7 @@ namespace Dune
static
const
int
coorddimension
=
cdim
;
/// Polynomial order of geometry
static
const
int
order
=
GridImpl
::
order
;
static
const
int
order
=
polynomial_
order
;
/// type of local coordinates
using
LocalCoordinate
=
FieldVector
<
ctype
,
mydimension
>
;
...
...
This diff is collapsed.
Click to expand it.
src/dune-curvedgeometry.cc
+
46
−
18
View file @
315ab02a
...
...
@@ -4,27 +4,55 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include
<cmath>
#include
<iostream>
#include
<dune/common/parallel/mpihelper.hh>
// An initializer of MPI
#include
<dune/common/exceptions.hh>
// We use exceptions
#include
<dune/common/parallel/mpihelper.hh>
#include
<dune/curvedgeometry/curvedgeometry.hh>
#include
<dune/geometry/quadraturerules.hh>
#include
<dune/grid/yaspgrid.hh>
#include
<dune/localfunctions/lagrange/lagrangelfecache.hh>
const
int
order
=
3
;
int
main
(
int
argc
,
char
**
argv
)
{
try
{
// Maybe initialize MPI
Dune
::
MPIHelper
&
helper
=
Dune
::
MPIHelper
::
instance
(
argc
,
argv
);
std
::
cout
<<
"Hello World! This is dune-curvedgeometry."
<<
std
::
endl
;
if
(
Dune
::
MPIHelper
::
isFake
)
std
::
cout
<<
"This is a sequential program."
<<
std
::
endl
;
else
std
::
cout
<<
"I am rank "
<<
helper
.
rank
()
<<
" of "
<<
helper
.
size
()
<<
" processes!"
<<
std
::
endl
;
return
0
;
}
catch
(
Dune
::
Exception
&
e
){
std
::
cerr
<<
"Dune reported error: "
<<
e
<<
std
::
endl
;
}
catch
(...){
std
::
cerr
<<
"Unknown exception thrown!"
<<
std
::
endl
;
using
namespace
Dune
;
MPIHelper
&
helper
=
MPIHelper
::
instance
(
argc
,
argv
);
YaspGrid
<
2
>
grid
({
1.0
,
1.0
},
{
4
,
4
});
using
LocalCoordinate
=
FieldVector
<
double
,
2
>
;
using
GlobalCoordinate
=
FieldVector
<
double
,
2
>
;
using
WorldCoordinate
=
FieldVector
<
double
,
3
>
;
using
LocalFECache
=
LagrangeLocalFiniteElementCache
<
double
,
double
,
2
,
order
>
;
LocalFECache
localFeCache
;
// coordinate projection
auto
project
=
[](
GlobalCoordinate
const
&
global
)
->
WorldCoordinate
{
return
{
global
[
0
],
global
[
1
],
std
::
sin
(
global
[
0
])
*
std
::
cos
(
global
[
1
])
};
};
for
(
auto
const
&
e
:
elements
(
grid
.
leafGridView
()))
{
// projection from local coordinates
auto
X
=
[
project
,
geo
=
e
.
geometry
()](
LocalCoordinate
const
&
local
)
->
WorldCoordinate
{
return
project
(
geo
.
global
(
local
));
};
// construct lagrange vertices
std
::
vector
<
WorldCoordinate
>
vertices
;
localFeCache
.
get
(
e
.
type
()).
localInterpolation
().
interpolate
(
X
,
vertices
);
// create a curved geometry
CurvedGeometry
<
double
,
2
,
3
,
order
>
geometry
(
e
.
type
(),
vertices
);
auto
const
&
quadRule
=
QuadratureRules
<
double
,
2
>::
rule
(
e
.
type
(),
4
);
for
(
auto
const
&
qp
:
quadRule
)
{
auto
Jt
=
geometry
.
jacobianTransposed
(
qp
.
position
());
auto
Jtinv
=
geometry
.
jacobianInverseTransposed
(
qp
.
position
());
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment