Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
24a0d15c
Commit
24a0d15c
authored
Apr 11, 2013
by
andy
Browse files
ENH: Updated new mesh-to-mesh class to use updated AMI functionality
parent
72d0ffbc
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.C
View file @
24a0d15c
...
...
@@ -165,17 +165,81 @@ bool Foam::meshToMeshNew::findInitialSeeds
const
pointField
pts
(
srcCells
[
srcI
].
points
(
srcFaces
,
srcPts
).
xfer
());
forAll
(
pts
,
ptI
)
switch
(
method_
)
{
const
point
&
pt
=
pts
[
ptI
];
label
tgtI
=
tgt
.
cellTree
().
findInside
(
pt
);
if
(
tgtI
!=
-
1
&&
intersect
(
src
,
tgt
,
srcI
,
tgtI
))
case
imDirect
:
case
imCellVolumeWeight
:
{
srcSeedI
=
srcI
;
tgtSeedI
=
tgtI
;
forAll
(
pts
,
ptI
)
{
const
point
&
pt
=
pts
[
ptI
];
label
tgtI
=
tgt
.
cellTree
().
findInside
(
pt
);
if
(
tgtI
!=
-
1
&&
intersect
(
src
,
tgt
,
srcI
,
tgtI
))
{
srcSeedI
=
srcI
;
tgtSeedI
=
tgtI
;
return
true
;
}
}
return
true
;
break
;
}
case
imMapNearest
:
{
const
point
&
pt
=
pts
[
0
];
pointIndexHit
hit
=
tgt
.
cellTree
().
findNearest
(
pt
,
GREAT
);
if
(
hit
.
hit
())
{
srcSeedI
=
srcI
;
tgtSeedI
=
hit
.
index
();
return
true
;
}
else
{
FatalErrorIn
(
"bool Foam::meshToMeshNew::findInitialSeeds"
"("
"const polyMesh&, "
"const polyMesh&, "
"const labelList&, "
"const boolList&, "
"const label, "
"label&, "
"label&"
") const"
)
<<
"Unable to find nearest target cell"
<<
" for source cell "
<<
srcI
<<
" with centre "
<<
srcCells
[
srcI
].
centre
(
srcPts
,
srcFaces
)
<<
abort
(
FatalError
);
}
break
;
}
default:
{
FatalErrorIn
(
"bool Foam::meshToMeshNew::findInitialSeeds"
"("
"const polyMesh&, "
"const polyMesh&, "
"const labelList&, "
"const boolList&, "
"const label, "
"label&, "
"label&"
") const"
)
<<
"Unhandled method: "
<<
interpolationMethodNames_
[
method_
]
<<
abort
(
FatalError
);
}
}
}
...
...
@@ -577,6 +641,48 @@ void Foam::meshToMeshNew::calculate()
}
Foam
::
AMIPatchToPatchInterpolation
::
interpolationMethod
Foam
::
meshToMeshNew
::
interpolationMethodAMI
(
const
interpolationMethod
method
)
const
{
switch
(
method_
)
{
case
imDirect
:
{
return
AMIPatchToPatchInterpolation
::
imDirect
;
break
;
}
case
imMapNearest
:
{
return
AMIPatchToPatchInterpolation
::
imMapNearest
;
break
;
}
case
imCellVolumeWeight
:
{
return
AMIPatchToPatchInterpolation
::
imFaceAreaWeight
;
break
;
}
default:
{
FatalErrorIn
(
"Foam::AMIPatchToPatchInterpolation::interpolationMethod"
"Foam::meshToMeshNew::interpolationMethodAMI"
"("
"const interpolationMethod method"
") const"
)
<<
"Unhandled enumeration "
<<
method_
<<
abort
(
FatalError
);
}
}
return
AMIPatchToPatchInterpolation
::
imDirect
;
}
const
Foam
::
PtrList
<
Foam
::
AMIPatchToPatchInterpolation
>&
Foam
::
meshToMeshNew
::
patchAMIs
()
const
{
...
...
@@ -593,7 +699,9 @@ Foam::meshToMeshNew::patchAMIs() const
const
polyPatch
&
tgtPP
=
tgtRegion_
.
boundaryMesh
()[
tgtPatchI
];
Info
<<
"Creating AMI between source patch "
<<
srcPP
.
name
()
<<
" and target patch "
<<
tgtPP
.
name
()
<<
endl
;
<<
" and target patch "
<<
tgtPP
.
name
()
<<
" using "
<<
interpolationMethodAMI
(
method_
)
<<
endl
;
Info
<<
incrIndent
;
...
...
@@ -605,6 +713,7 @@ Foam::meshToMeshNew::patchAMIs() const
srcPP
,
tgtPP
,
faceAreaIntersect
::
tmMesh
,
interpolationMethodAMI
(
method_
),
true
// flip target patch since patch normals are aligned
)
);
...
...
src/sampling/meshToMeshInterpolation/meshToMeshNew/meshToMeshNew.H
View file @
24a0d15c
...
...
@@ -70,7 +70,7 @@ public:
// Public data types
//- Enumeration specifying
required accuracy
//- Enumeration specifying
interpolation method
enum
interpolationMethod
{
imDirect
,
...
...
@@ -302,6 +302,13 @@ private:
//- Calculate - main driver function
void
calculate
();
//- Conversion between mesh and patch interpolation methods
AMIPatchToPatchInterpolation
::
interpolationMethod
interpolationMethodAMI
(
const
interpolationMethod
method
)
const
;
//- Return the list of AMIs between source and target patches
const
PtrList
<
AMIPatchToPatchInterpolation
>&
patchAMIs
()
const
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment