Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
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
Package 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
Core Modules
dune-common
Commits
53afc1ab
Commit
53afc1ab
authored
19 years ago
by
Peter Bastian
Browse files
Options
Downloads
Patches
Plain Diff
changed to dynamically allocated representation type,
necessary for adaptivity. [[Imported from SVN: r2991]]
parent
995a13ca
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
disc/functions/p1function.hh
+22
-9
22 additions, 9 deletions
disc/functions/p1function.hh
with
22 additions
and
9 deletions
disc/functions/p1function.hh
+
22
−
9
View file @
53afc1ab
...
...
@@ -5,6 +5,7 @@
#ifndef __DUNE_P1FUNCTION_HH__
#define __DUNE_P1FUNCTION_HH__
#include
<new>
#include
<iostream>
#include
<vector>
#include
"common/fvector.hh"
...
...
@@ -73,13 +74,25 @@ namespace Dune
public
:
typedef
BlockVector
<
FieldVector
<
RT
,
1
>
>
RepresentationType
;
//
mak
e a vector
for
the
grid
//
! allocat
e a vector
with
the
data
P1FEFunction
(
const
G
&
g
,
const
IS
&
indexset
)
:
grid
(
g
),
is
(
indexset
),
mapper
(
g
,
indexset
)
{
coeff
.
resize
(
mapper
.
size
());
try
{
coeff
=
new
RepresentationType
(
mapper
.
size
());
}
catch
(
std
::
bad_alloc
)
{
std
::
cerr
<<
"not enough memory in P1FEFunction"
<<
std
::
endl
;
throw
;
// rethrow exception
}
std
::
cout
<<
"making FE function with "
<<
mapper
.
size
()
<<
" components"
<<
std
::
endl
;
}
//! deallocate the vector
~
P1FEFunction
()
{
delete
coeff
;
}
//! evaluate single component comp at global point x
/*! Evaluate a single component of the vector-valued
function.
...
...
@@ -136,7 +149,7 @@ namespace Dune
RT
value
=
0
;
Dune
::
GeometryType
gt
=
e
.
geometry
().
type
();
// extract type of element
for
(
int
i
=
0
;
i
<
Dune
::
LagrangeShapeFunctions
<
DT
,
RT
,
n
>::
general
(
gt
,
1
).
size
();
++
i
)
value
+=
Dune
::
LagrangeShapeFunctions
<
DT
,
RT
,
n
>::
general
(
gt
,
1
)[
i
].
evaluateFunction
(
0
,
xi
)
*
coeff
[
mapper
.
template
map
<
n
>(
e
,
i
)];
value
+=
Dune
::
LagrangeShapeFunctions
<
DT
,
RT
,
n
>::
general
(
gt
,
1
)[
i
].
evaluateFunction
(
0
,
xi
)
*
(
*
coeff
)
[
mapper
.
template
map
<
n
>(
e
,
i
)];
return
value
;
}
...
...
@@ -177,7 +190,7 @@ namespace Dune
Dune
::
GeometryType
gt
=
e
.
geometry
().
type
();
// extract type of element
for
(
int
i
=
0
;
i
<
Dune
::
LagrangeShapeFunctions
<
DT
,
RT
,
n
>::
general
(
gt
,
1
).
size
();
++
i
)
value
+=
Dune
::
LagrangeShapeFunctions
<
DT
,
RT
,
n
>::
general
(
gt
,
1
)[
i
].
evaluateDerivative
(
0
,
dir
,
xi
)
*
coeff
[
mapper
.
template
map
<
n
>(
e
,
i
)];
*
(
*
coeff
)
[
mapper
.
template
map
<
n
>(
e
,
i
)];
return
value
;
}
...
...
@@ -202,11 +215,11 @@ namespace Dune
for
(
int
i
=
0
;
i
<
Dune
::
LagrangeShapeFunctions
<
DT
,
RT
,
n
>::
general
(
gt
,
1
).
size
();
++
i
)
if
(
!
visited
[
mapper
.
template
map
<
n
>(
*
it
,
i
)])
{
coeff
[
mapper
.
template
map
<
n
>(
*
it
,
i
)][
0
]
=
(
*
coeff
)
[
mapper
.
template
map
<
n
>(
*
it
,
i
)][
0
]
=
u
.
evallocal
(
0
,
*
it
,
Dune
::
LagrangeShapeFunctions
<
DT
,
RT
,
n
>::
general
(
gt
,
1
)[
i
].
position
());
visited
[
mapper
.
template
map
<
n
>(
*
it
,
i
)]
=
true
;
// std::cout << "evaluated " << it->geometry().global(Dune::LagrangeShapeFunctions<DT,RT,n>::general(gt,1)[i].position())
// << " value " << coeff[mapper.template map<n>(*it,i)][0]
// << " value " <<
(*
coeff
)
[mapper.template map<n>(*it,i)][0]
// << std::endl;
}
}
...
...
@@ -219,7 +232,7 @@ namespace Dune
*/
const
RepresentationType
&
operator
*
()
const
{
return
coeff
;
return
(
*
coeff
)
;
}
//! return reference to coefficient vector
...
...
@@ -229,7 +242,7 @@ namespace Dune
*/
RepresentationType
&
operator
*
()
{
return
coeff
;
return
(
*
coeff
)
;
}
private
:
...
...
@@ -243,7 +256,7 @@ namespace Dune
MultipleCodimMultipleGeomTypeMapper
<
G
,
IS
,
P1Layout
>
mapper
;
// and a vector
RepresentationType
coeff
;
// the coefficient vector
RepresentationType
*
coeff
;
//
pointer to
the coefficient vector
, dynamically allocated!
};
...
...
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