Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
wenqing
ogs
Commits
dfb2e304
Commit
dfb2e304
authored
6 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[NL] added method interpolating all element node coordinates
parent
a3f02051
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NumLib/Fem/FiniteElement/TemplateIsoparametric.h
+38
-28
38 additions, 28 deletions
NumLib/Fem/FiniteElement/TemplateIsoparametric.h
with
38 additions
and
28 deletions
NumLib/Fem/FiniteElement/TemplateIsoparametric.h
+
38
−
28
View file @
dfb2e304
...
...
@@ -12,25 +12,21 @@
#pragma once
#include
<cassert>
#include
<boost/math/constants/constants.hpp>
#include
<cassert>
#include
"NumLib/Fem/CoordinatesMapping/ShapeMatrices.h"
#include
"NumLib/Fem/CoordinatesMapping/NaturalCoordinatesMapping.h"
#include
"NumLib/Fem/CoordinatesMapping/ShapeMatrices.h"
namespace
NumLib
{
/**
* \brief Template class for isoparametric elements
*
* \tparam ShapeFunctionType_ The shape function type.
* \tparam ShapeMatrixTypes_ An aggregate of shape matrix types.
*/
template
<
class
ShapeFunctionType_
,
class
ShapeMatrixTypes_
>
template
<
class
ShapeFunctionType_
,
class
ShapeMatrixTypes_
>
class
TemplateIsoparametric
{
public:
...
...
@@ -44,36 +40,29 @@ public:
/// Natural coordinates mapping tools specialization for specific
/// MeshElement and ShapeFunction types.
using
NaturalCoordsMappingType
=
NaturalCoordinatesMapping
<
MeshElementType
,
ShapeFunctionType
,
ShapeMatrices
>
;
using
NaturalCoordsMappingType
=
NaturalCoordinatesMapping
<
MeshElementType
,
ShapeFunctionType
,
ShapeMatrices
>
;
/**
* Constructor without specifying a mesh element. setMeshElement() must be called afterwards.
* Constructor without specifying a mesh element. setMeshElement() must be
* called afterwards.
*/
TemplateIsoparametric
()
:
_ele
(
nullptr
)
{
}
TemplateIsoparametric
()
:
_ele
(
nullptr
)
{}
/**
* Construct this object for the given mesh element.
*
* @param e Mesh element object
*/
TemplateIsoparametric
(
const
MeshElementType
&
e
)
:
_ele
(
&
e
)
{
}
TemplateIsoparametric
(
const
MeshElementType
&
e
)
:
_ele
(
&
e
)
{}
~
TemplateIsoparametric
()
=
default
;
/// return current mesh element
const
MeshElementType
*
getMeshElement
()
const
{
return
_ele
;}
const
MeshElementType
*
getMeshElement
()
const
{
return
_ele
;
}
/// Sets the mesh element
void
setMeshElement
(
const
MeshElementType
&
e
)
{
this
->
_ele
=
&
e
;
}
void
setMeshElement
(
const
MeshElementType
&
e
)
{
this
->
_ele
=
&
e
;
}
/**
* compute shape functions
*
...
...
@@ -112,23 +101,45 @@ public:
computeIntegralMeasure
(
is_axially_symmetric
,
shape
);
}
/// Interpolates the x coordinate of the element with the given shape
/// matrix.
double
interpolateZerothCoordinate
(
typename
ShapeMatrices
::
ShapeType
const
&
N
)
const
{
auto
*
nodes
=
_ele
->
getNodes
();
typename
ShapeMatrices
::
ShapeType
rs
(
N
.
size
());
for
(
int
i
=
0
;
i
<
rs
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
rs
.
size
();
++
i
)
{
rs
[
i
]
=
(
*
nodes
[
i
])[
0
];
}
auto
const
r
=
N
.
dot
(
rs
);
return
r
;
}
/// Interpolates the coordinates of the element with the given shape matrix.
std
::
array
<
double
,
3
>
interpolateCoordinates
(
typename
ShapeMatrices
::
ShapeType
const
&
N
)
const
{
auto
*
nodes
=
_ele
->
getNodes
();
typename
ShapeMatrices
::
ShapeType
rs
(
N
.
size
());
std
::
array
<
double
,
3
>
interpolated_coords
;
for
(
int
d
=
0
;
d
<
3
;
++
d
)
{
for
(
int
i
=
0
;
i
<
rs
.
size
();
++
i
)
{
rs
[
i
]
=
(
*
nodes
[
i
])[
d
];
}
interpolated_coords
[
d
]
=
N
.
dot
(
rs
);
}
return
interpolated_coords
;
}
private
:
void
computeIntegralMeasure
(
bool
is_axially_symmetric
,
ShapeMatrices
&
shape
)
const
{
if
(
!
is_axially_symmetric
)
{
if
(
!
is_axially_symmetric
)
{
shape
.
integralMeasure
=
1.0
;
return
;
}
...
...
@@ -140,11 +151,10 @@ private:
// located at edge of the unit triangle, it is possible that
// r becomes zero.
auto
const
r
=
interpolateZerothCoordinate
(
shape
.
N
);
shape
.
integralMeasure
=
boost
::
math
::
constants
::
two_pi
<
double
>
()
*
r
;
shape
.
integralMeasure
=
boost
::
math
::
constants
::
two_pi
<
double
>
()
*
r
;
}
const
MeshElementType
*
_ele
;
};
}
// NumLib
}
//
namespace
NumLib
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