Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
0d48b5ae
Commit
0d48b5ae
authored
12 years ago
by
Nicolas Marsic
Browse files
Options
Downloads
Patches
Plain Diff
Fix Interpolation (Ref vs Phys Space error)
parent
3a9a0be9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
FunctionSpace/FunctionSpaceEdge.cpp
+8
-11
8 additions, 11 deletions
FunctionSpace/FunctionSpaceEdge.cpp
FunctionSpace/FunctionSpaceNode.cpp
+6
-15
6 additions, 15 deletions
FunctionSpace/FunctionSpaceNode.cpp
with
14 additions
and
26 deletions
FunctionSpace/FunctionSpaceEdge.cpp
+
8
−
11
View file @
0d48b5ae
...
...
@@ -27,20 +27,17 @@ interpolate(const MElement& element,
// Get Basis Functions //
const
vector
<
vector
<
Polynomial
>
>&
fun
=
getBasis
(
element
).
getFunctions
();
const
unsigned
int
nFun
=
fun
.
size
();
// Get Reference coordinate //
double
phys
[
3
]
=
{
xyz
(
0
),
xyz
(
1
),
xyz
(
2
)};
double
uvw
[
3
];
eelement
.
xyz2uvw
(
phys
,
uvw
);
// Get Jacobian //
fullMatrix
<
double
>
invJac
(
3
,
3
);
eelement
.
getJacobian
(
xyz
(
0
),
xyz
(
1
),
xyz
(
2
)
,
invJac
);
eelement
.
getJacobian
(
uvw
[
0
],
uvw
[
1
],
uvw
[
2
]
,
invJac
);
invJac
.
invertInPlace
();
// Get First Vertex of Element //
fullVector
<
double
>
origin
(
3
);
origin
(
0
)
=
eelement
.
getVertex
(
0
)
->
x
();
origin
(
1
)
=
eelement
.
getVertex
(
0
)
->
y
();
origin
(
2
)
=
eelement
.
getVertex
(
0
)
->
z
();
// Map XYZ to Reference Plane (UVW) //
fullVector
<
double
>
uvw
=
Mapper
::
invMap
(
xyz
,
origin
,
invJac
);
// Interpolate (in Reference Place) //
fullVector
<
double
>
val
(
3
);
...
...
@@ -50,7 +47,7 @@ interpolate(const MElement& element,
for
(
unsigned
int
i
=
0
;
i
<
nFun
;
i
++
){
fullVector
<
double
>
vi
=
Mapper
::
grad
(
Polynomial
::
at
(
fun
[
i
],
uvw
(
0
)
,
uvw
(
1
)
,
uvw
(
2
)
),
Mapper
::
grad
(
Polynomial
::
at
(
fun
[
i
],
uvw
[
0
]
,
uvw
[
1
]
,
uvw
[
2
]
),
invJac
);
vi
.
scale
(
coef
[
i
]);
...
...
This diff is collapsed.
Click to expand it.
FunctionSpace/FunctionSpaceNode.cpp
+
6
−
15
View file @
0d48b5ae
...
...
@@ -25,30 +25,21 @@ interpolate(const MElement& element,
const_cast
<
MElement
&>
(
element
);
// Get Basis Functions //
const
vector
<
Polynomial
>&
fun
=
getBasis
(
element
).
getFunctions
();
const
vector
<
Polynomial
>&
fun
=
getBasis
(
element
).
getFunctions
();
const
unsigned
int
nFun
=
fun
.
size
();
// Get
Jacobian
//
fullMatrix
<
double
>
invJac
(
3
,
3
);
eelement
.
getJacobian
(
xyz
(
0
),
xyz
(
1
),
xyz
(
2
),
invJac
)
;
// Get
Reference coordinate
//
double
phys
[
3
]
=
{
xyz
(
0
),
xyz
(
1
),
xyz
(
2
)};
double
uvw
[
3
]
;
invJac
.
invertInPlace
();
// Get First Vertex of Element (Physical Space) //
fullVector
<
double
>
origin
(
3
);
origin
(
0
)
=
eelement
.
getVertex
(
0
)
->
x
();
origin
(
1
)
=
eelement
.
getVertex
(
0
)
->
y
();
origin
(
2
)
=
eelement
.
getVertex
(
0
)
->
z
();
// Map XYZ to Reference Plane (UVW) //
fullVector
<
double
>
uvw
=
Mapper
::
invMap
(
xyz
,
origin
,
invJac
);
eelement
.
xyz2uvw
(
phys
,
uvw
);
// Interpolate (in Reference Place) //
double
val
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
nFun
;
i
++
)
val
+=
fun
[
i
].
at
(
uvw
(
0
)
,
uvw
(
1
)
,
uvw
(
2
)
)
*
coef
[
i
];
fun
[
i
].
at
(
uvw
[
0
]
,
uvw
[
1
]
,
uvw
[
2
]
)
*
coef
[
i
];
// Return Interpolated Value //
return
val
;
...
...
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