Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-fem-dg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
dune-fem
dune-fem-dg
Commits
bc0a9b44
Commit
bc0a9b44
authored
9 years ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
implemeneted method evaluate on context class.
parent
5c049aa2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/fem-dg/pass/dgmodelcaller.hh
+54
-38
54 additions, 38 deletions
dune/fem-dg/pass/dgmodelcaller.hh
dune/fem-dg/test/advdiff/models.hh
+9
-12
9 additions, 12 deletions
dune/fem-dg/test/advdiff/models.hh
with
63 additions
and
50 deletions
dune/fem-dg/pass/dgmodelcaller.hh
+
54
−
38
View file @
bc0a9b44
...
...
@@ -26,28 +26,28 @@ namespace Dune
const
double
volume_
;
const
int
qp_
;
public:
typedef
Entity
EntityType
;
typedef
Quadrature
QuadratureType
;
typedef
RangeTuple
RangeTupleType
;
typedef
JacobianTuple
JacobianTupleType
;
typedef
typename
QuadratureType
::
QuadraturePointWrapperType
QuadraturePointWrapperType
;
typedef
typename
QuadratureType
::
CoordinateType
CoordinateType
;
typedef
typename
QuadratureType
::
LocalCoordinateType
LocalCoordinateType
;
ElementQuadraturePointContext
(
const
Entity
&
entity
,
const
Quadrature
&
quadrature
,
const
RangeTuple
&
values
,
const
JacobianTuple
&
jacobians
,
const
int
qp
,
const
double
time
,
const
double
volume
)
:
entity_
(
entity
),
quad_
(
quadrature
),
values_
(
values
),
jacobians_
(
jacobians
),
time_
(
time
),
volume_
(
volume
),
qp_
(
qp
)
typedef
Entity
EntityType
;
typedef
Quadrature
QuadratureType
;
typedef
RangeTuple
RangeTupleType
;
typedef
JacobianTuple
JacobianTupleType
;
typedef
typename
QuadratureType
::
QuadraturePointWrapperType
QuadraturePointWrapperType
;
typedef
typename
QuadratureType
::
CoordinateType
CoordinateType
;
typedef
typename
QuadratureType
::
LocalCoordinateType
LocalCoordinateType
;
ElementQuadraturePointContext
(
const
Entity
&
entity
,
const
Quadrature
&
quadrature
,
const
RangeTuple
&
values
,
const
JacobianTuple
&
jacobians
,
const
int
qp
,
const
double
time
,
const
double
volume
)
:
entity_
(
entity
),
quad_
(
quadrature
),
values_
(
values
),
jacobians_
(
jacobians
),
time_
(
time
),
volume_
(
volume
),
qp_
(
qp
)
{}
const
Entity
&
entity
()
const
{
return
entity_
;
}
...
...
@@ -61,28 +61,44 @@ namespace Dune
const
LocalCoordinateType
&
localPoint
()
const
{
return
quadrature
().
localPoint
(
index
()
);
}
const
int
index
()
const
{
return
qp_
;
}
/*
// if ReturnType exists in RangeTuple
template <class ReturnType, class Functor, typename... Args>
const ReturnType& doEvaluate( const ReturnType& ret, const Functor& functor, Args... args ) const
template
<
class
Functor
,
bool
containedInTuple
>
struct
Evaluate
;
template
<
class
Functor
>
struct
Evaluate
<
Functor
,
true
>
{
return ret;
}
typedef
typename
Functor
::
VarId
VarId
;
typedef
typename
RangeTuple
::
template
Value
<
VarId
>
::
Type
ReturnType
;
template
<
class
...
Args
>
static
const
ReturnType
&
eval
(
const
RangeTuple
&
tuple
,
const
Functor
&
functor
,
const
Args
&
...
args
)
{
return
tuple
.
template
at
<
VarId
>
();
}
// if ReturnType does not exists in RangeTuple
template <class Functor, typename... Args>
decltype(Functor::operator()) doEvaluate( const RangeTuple&, const Functor& functor, Args... args ) const
};
template
<
class
Functor
>
struct
Evaluate
<
Functor
,
false
>
{
return functor( args );
}
typedef
typename
Functor
::
ReturnType
ReturnType
;
template
<
class
...
Args
>
//static auto
static
ReturnType
eval
(
const
RangeTuple
&
tuple
,
const
Functor
&
functor
,
const
Args
&
...
args
)
// -> decltype(functor( args ... ))
{
return
functor
(
args
...
);
}
};
template <class
VarId, class
Functor,
typename
... Args>
decltype(doEvaluate(values()[ VarId::value ], const Functor& functor, Args... args ))
evaluate( const Functor& functor, Args... args ) const
template
<
class
Functor
,
class
...
Args
>
typename
Evaluate
<
Functor
,
RangeTuple
::
template
Contains
<
typename
Functor
::
VarId
>
::
value
>::
ReturnType
evaluate
(
const
Functor
&
functor
,
const
Args
&
...
args
)
const
{
return
do
Evaluate
( values()[
VarId::value
]
, functor, args );
return
Evaluate
<
Functor
,
RangeTuple
::
template
Contains
<
typename
Functor
::
VarId
>
::
value
>::
eval
(
values
()
,
functor
,
args
...
);
}
*/
};
template
<
class
Intersection
,
...
...
This diff is collapsed.
Click to expand it.
dune/fem-dg/test/advdiff/models.hh
+
9
−
12
View file @
bc0a9b44
...
...
@@ -184,6 +184,9 @@ public:
struct
ComputeVelocity
{
typedef
std
::
integral_constant
<
int
,
velo
>
VarId
;
typedef
DomainType
ReturnType
;
template
<
class
LocalEvaluation
>
DomainType
operator
()
(
const
LocalEvaluation
&
local
,
const
ProblemType
&
problem
)
const
{
...
...
@@ -207,9 +210,7 @@ public:
const
RangeType
&
u
,
FluxRangeType
&
f
)
const
{
// evaluate velocity V
// const DomainType v ( 0 )
;
//= local.evaluate< velocityVar >( ComputeVelocity(), local, problem_ );
const
DomainType
&
v
=
ComputeVelocity
()(
local
,
problem_
);
const
DomainType
&
v
=
velocity
(
local
);
// f = uV;
for
(
int
r
=
0
;
r
<
dimRange
;
++
r
)
...
...
@@ -221,11 +222,9 @@ public:
* @brief velocity calculation, is called by advection()
*/
template
<
class
LocalEvaluation
>
inline
void
velocity
(
const
LocalEvaluation
&
local
,
DomainType
&
v
)
const
inline
DomainType
velocity
(
const
LocalEvaluation
&
local
)
const
{
// v = local.evaluate< velocityVar >( ComputeVelocity(), local, problem_ )
;
v
=
ComputeVelocity
()(
local
,
problem_
);
return
local
.
evaluate
(
ComputeVelocity
(),
local
,
problem_
);
}
...
...
@@ -366,8 +365,7 @@ public:
double
&
advspeed
,
double
&
totalspeed
)
const
{
DomainType
v
;
velocity
(
local
,
v
);
const
DomainType
&
v
=
velocity
(
local
);
advspeed
=
std
::
abs
(
v
*
normal
);
totalspeed
=
advspeed
;
}
...
...
@@ -436,9 +434,8 @@ public:
const
DomainType
normal
=
left
.
intersection
().
integrationOuterNormal
(
x
);
// get velocity
DomainType
velocity
;
model_
.
velocity
(
left
,
velocity
);
const
double
upwind
=
normal
*
velocity
;
const
DomainType
v
=
model_
.
velocity
(
left
);
const
double
upwind
=
normal
*
v
;
if
(
upwind
>
0
)
gLeft
=
uLeft
;
...
...
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