Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
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
Model registry
Operate
Environments
Monitor
Incidents
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
Sander, Oliver
dune-gfe
Commits
c5f1ada7
Commit
c5f1ada7
authored
13 years ago
by
Oliver Sander
Committed by
sander@FU-BERLIN.DE
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
shorter and much more general implementation using AlienElementLocalBasisFunction
[[Imported from SVN: r8220]]
parent
4a513821
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/gfe/pktop1mgtransfer.hh
+33
-63
33 additions, 63 deletions
dune/gfe/pktop1mgtransfer.hh
with
33 additions
and
63 deletions
dune/gfe/pktop1mgtransfer.hh
+
33
−
63
View file @
c5f1ada7
...
@@ -85,47 +85,32 @@ public:
...
@@ -85,47 +85,32 @@ public:
for
(;
it
!=
endIt
;
++
it
)
{
for
(;
it
!=
endIt
;
++
it
)
{
typedef
typename
GridView
::
template
Codim
<
0
>
::
Entity
EntityType
;
typedef
typename
P1NodalBasis
<
GridView
,
double
>::
LocalFiniteElement
LP1FE
;
const
LP1FE
&
coarseBaseSet
=
p1Basis
.
getLocalFiniteElement
(
*
it
);
// Get local finite element
typedef
typename
Dune
::
LocalFiniteElementFunctionBase
<
LP1FE
>::
type
FunctionBaseClass
;
const
typename
P1NodalBasis
<
GridView
,
double
>::
LocalFiniteElement
&
coarseBaseSet
=
p1Basis
.
getLocalFiniteElement
(
*
it
);
const
int
numCoarseBaseFct
=
coarseBaseSet
.
localBasis
().
size
();
typedef
typename
GridView
::
template
Codim
<
0
>
::
Entity
Element
;
AlienElementLocalBasisFunction
<
Element
,
LP1FE
,
FunctionBaseClass
>
f
(
*
it
,
*
it
,
coarseBaseSet
.
localBasis
());
// preallocate vector for function evaluations
for
(
int
i
=
0
;
i
<
coarseBaseSet
.
localBasis
().
size
();
i
++
)
{
std
::
vector
<
Dune
::
FieldVector
<
field_type
,
1
>
>
values
(
numCoarseBaseFct
);
const
Dune
::
GenericReferenceElement
<
ctype
,
dim
>&
fineRefElement
f
.
setIndex
(
i
);
=
Dune
::
GenericReferenceElements
<
ctype
,
dim
>::
general
(
it
->
type
());
std
::
vector
<
double
>
values
;
fineBasis
.
getLocalFiniteElement
(
*
it
).
localInterpolation
().
interpolate
(
f
,
values
);
// Get local finite element
const
typename
Basis
::
LocalFiniteElement
&
fineBaseSet
=
fineBasis
.
getLocalFiniteElement
(
*
it
);
const
int
numFineBaseFct
=
fineBaseSet
.
localBasis
().
size
();
for
(
int
j
=
0
;
j
<
numFineBaseFct
;
j
++
)
{
const
Dune
::
LocalKey
&
jLocalKey
=
fineBaseSet
.
localCoefficients
().
localKey
(
j
);
int
globalFine
=
fineBasis
.
index
(
*
it
,
j
);
Dune
::
FieldVector
<
ctype
,
dim
>
fineBasePosition
=
fineRefElement
.
position
(
jLocalKey
.
subEntity
(),
jLocalKey
.
codim
());
Dune
::
FieldVector
<
ctype
,
dim
>
local
=
fineBasePosition
;
#warning Position computation is wrong!
// Evaluate coarse grid base functions
for
(
size_t
j
=
0
;
j
<
values
.
size
();
j
++
)
{
coarseBaseSet
.
localBasis
().
evaluateFunction
(
local
,
values
);
for
(
int
i
=
0
;
i
<
numCoarseBaseFct
;
i
++
)
{
if
(
values
[
i
]
>
0.001
)
if
(
values
[
i
]
>
0.001
)
{
{
const
Dune
::
LocalKey
&
iLocalKey
=
coarseBaseSet
.
localCoefficients
().
localKey
(
i
);
size_t
globalFine
=
fineBasis
.
index
(
*
it
,
j
);
int
globalCoarse
=
p1Basis
.
index
(
*
it
,
i
);
size_t
globalCoarse
=
p1Basis
.
index
(
*
it
,
i
);
indices
.
add
(
globalFine
,
globalCoarse
);
indices
.
add
(
globalFine
,
globalCoarse
);
}
}
}
}
}
}
}
}
...
@@ -135,52 +120,37 @@ public:
...
@@ -135,52 +120,37 @@ public:
// /////////////////////////////////////////////
// /////////////////////////////////////////////
// Compute the matrix
// Compute the matrix
// /////////////////////////////////////////////
// /////////////////////////////////////////////
it
=
gridView
.
template
begin
<
0
>();
for
(;
it
!=
endIt
;
++
it
)
{
// Get local finite element
const
typename
P1NodalBasis
<
GridView
,
double
>::
LocalFiniteElement
&
coarseBaseSet
=
p1Basis
.
getLocalFiniteElement
(
*
it
);
const
int
numCoarseBaseFct
=
coarseBaseSet
.
localBasis
().
size
();
typedef
typename
GridView
::
template
Codim
<
0
>
::
Entity
EntityType
;
// preallocate vector for function evaluations
std
::
vector
<
Dune
::
FieldVector
<
field_type
,
1
>
>
values
(
numCoarseBaseFct
);
const
Dune
::
GenericReferenceElement
<
ctype
,
dim
>&
fineRefElement
for
(
it
=
gridView
.
template
begin
<
0
>();
it
!=
endIt
;
++
it
)
{
=
Dune
::
GenericReferenceElements
<
ctype
,
dim
>::
general
(
it
->
type
());
// Get l
ocal
f
inite
e
lement
typedef
typename
P1NodalBasis
<
GridView
,
double
>::
L
ocal
F
inite
E
lement
LP1FE
;
const
typename
Basis
::
LocalFiniteElement
&
fin
eBaseSet
=
fine
Basis
.
getLocalFiniteElement
(
*
it
);
const
LP1FE
&
coars
eBaseSet
=
p1
Basis
.
getLocalFiniteElement
(
*
it
);
const
int
numFineBaseFct
=
fineBaseSet
.
localBasis
().
size
()
;
typedef
typename
Dune
::
LocalFiniteElementFunctionBase
<
LP1FE
>::
type
FunctionBaseClass
;
for
(
int
j
=
0
;
j
<
numFineBaseFct
;
j
++
)
typedef
typename
GridView
::
template
Codim
<
0
>
::
Entity
Element
;
{
AlienElementLocalBasisFunction
<
Element
,
LP1FE
,
FunctionBaseClass
>
f
(
*
it
,
*
it
,
coarseBaseSet
.
localBasis
());
const
Dune
::
LocalKey
&
jLocalKey
=
fineBaseSet
.
localCoefficients
().
localKey
(
j
);
int
globalFine
=
fineBasis
.
index
(
*
it
,
j
);
for
(
int
i
=
0
;
i
<
coarseBaseSet
.
localBasis
().
size
();
i
++
)
{
Dune
::
FieldVector
<
ctype
,
dim
>
fineBasePosition
=
fineRefElement
.
position
(
jLocalKey
.
subEntity
(),
jLocalKey
.
codim
());
f
.
setIndex
(
i
);
Dune
::
FieldVector
<
ctype
,
dim
>
local
=
fineBasePosition
;
std
::
vector
<
double
>
values
;
#warning Position computation is wrong!
fineBasis
.
getLocalFiniteElement
(
*
it
).
localInterpolation
().
interpolate
(
f
,
values
);
// Evaluate coarse grid base functions
for
(
size_t
j
=
0
;
j
<
values
.
size
();
j
++
)
{
coarseBaseSet
.
localBasis
().
evaluateFunction
(
local
,
values
);
for
(
int
i
=
0
;
i
<
numCoarseBaseFct
;
i
++
)
{
if
(
values
[
i
]
>
0.001
)
if
(
values
[
i
]
>
0.001
)
{
{
const
Dune
::
LocalKey
&
iLocalKey
=
coarseBaseSet
.
localCoefficients
().
localKey
(
i
);
size_t
globalFine
=
fineBasis
.
index
(
*
it
,
j
);
in
t
globalCoarse
=
p1Basis
.
index
(
*
it
,
i
);
size_
t
globalCoarse
=
p1Basis
.
index
(
*
it
,
i
);
TransferMatrixBlock
matValue
=
identity
;
TransferMatrixBlock
matValue
=
identity
;
matValue
*=
values
[
i
];
matValue
*=
values
[
i
];
(
*
this
->
matrix_
)[
globalFine
][
globalCoarse
]
=
matValue
;
(
*
this
->
matrix_
)[
globalFine
][
globalCoarse
]
=
matValue
;
}
}
}
}
}
}
}
}
...
...
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