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
12fed658
Commit
12fed658
authored
Apr 11, 2013
by
andy
Browse files
ENH: Updated AMIInterpolation to use new AMIMethods
parent
9817cb31
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
View file @
12fed658
This diff is collapsed.
Click to expand it.
src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H
View file @
12fed658
...
...
@@ -50,14 +50,11 @@ SourceFiles
#define AMIInterpolation_H
#include
"className.H"
#include
"DynamicList.H"
#include
"searchableSurface.H"
#include
"treeBoundBoxList.H"
#include
"boolList.H"
#include
"primitivePatch.H"
#include
"faceAreaIntersect.H"
#include
"indexedOctree.H"
#include
"treeDataPrimitivePatch.H"
#include
"treeBoundBoxList.H"
#include
"globalIndex.H"
#include
"ops.H"
...
...
@@ -82,12 +79,26 @@ class AMIInterpolation
:
public
AMIInterpolationName
{
//- local typedef to octree tree-type
typedef
treeDataPrimitivePatch
<
TargetPatch
>
treeType
;
public:
// Public data types
//- Enumeration specifying interpolation method
enum
interpolationMethod
{
imDirect
,
imMapNearest
,
imFaceAreaWeight
};
private:
// Private data
//- Interpolation method
interpolationMethod
method_
;
//- Flag to indicate that the two patches are co-directional and
// that the orientation of the target patch should be reversed
const
bool
reverseTarget_
;
...
...
@@ -96,6 +107,7 @@ class AMIInterpolation
// cases
label
singlePatchProc_
;
// Source patch
//- Source face areas
...
...
@@ -110,10 +122,6 @@ class AMIInterpolation
//- Sum of weights of target faces per source face
scalarField
srcWeightsSum_
;
//- Labels of faces that are not overlapped by any target faces
// (should be empty for correct functioning)
labelList
srcNonOverlap_
;
// Target patch
...
...
@@ -130,9 +138,6 @@ class AMIInterpolation
scalarField
tgtWeightsSum_
;
//- Octree used to find face seeds
autoPtr
<
indexedOctree
<
treeType
>
>
treePtr_
;
//- Face triangulation mode
const
faceAreaIntersect
::
triangulationMode
triMode_
;
...
...
@@ -152,30 +157,6 @@ class AMIInterpolation
void
operator
=
(
const
AMIInterpolation
&
);
// Helper functions
//- Write triangle intersection to OBJ file
void
writeIntersectionOBJ
(
const
scalar
area
,
const
face
&
f1
,
const
face
&
f2
,
const
pointField
&
f1Points
,
const
pointField
&
f2Points
)
const
;
//- Check that patches are valid
void
checkPatches
(
const
SourcePatch
&
srcPatch
,
const
TargetPatch
&
tgtPatch
)
const
;
//- Reset the octree for the traget patch face search
void
resetTree
(
const
TargetPatch
&
tgtPatch
);
// Parallel functionality
//- Calculate if patches are on multiple processors
...
...
@@ -229,83 +210,8 @@ class AMIInterpolation
)
const
;
// Marching front
//- Find face on target patch that overlaps source face
label
findTargetFace
(
const
label
srcFaceI
,
const
SourcePatch
&
srcPatch
)
const
;
//- Add faces neighbouring faceI to the ID list
void
appendNbrFaces
(
const
label
faceI
,
const
TargetPatch
&
patch
,
const
DynamicList
<
label
>&
visitedFaces
,
DynamicList
<
label
>&
faceIDs
)
const
;
bool
processSourceFace
(
const
SourcePatch
&
srcPatch
,
const
TargetPatch
&
tgtPatch
,
const
label
srcFaceI
,
const
label
tgtStartFaceI
,
DynamicList
<
label
>&
nbrFaces
,
DynamicList
<
label
>&
visitedFaces
,
List
<
DynamicList
<
label
>
>&
srcAddr
,
List
<
DynamicList
<
scalar
>
>&
srcWght
,
List
<
DynamicList
<
label
>
>&
tgtAddr
,
List
<
DynamicList
<
scalar
>
>&
tgtWght
);
void
restartUncoveredSourceFace
(
const
SourcePatch
&
srcPatch
,
const
TargetPatch
&
tgtPatch
,
List
<
DynamicList
<
label
>
>&
srcAddr
,
List
<
DynamicList
<
scalar
>
>&
srcWght
,
List
<
DynamicList
<
label
>
>&
tgtAddr
,
List
<
DynamicList
<
scalar
>
>&
tgtWght
);
//- Set the source and target seed faces
void
setNextFaces
(
label
&
startSeedI
,
label
&
srcFaceI
,
label
&
tgtFaceI
,
const
SourcePatch
&
srcPatch0
,
const
TargetPatch
&
tgtPatch0
,
const
boolList
&
mapFlag
,
labelList
&
seedFaces
,
const
DynamicList
<
label
>&
visitedFaces
)
const
;
// Evaluation
//- Area of intersection between source and target faces
scalar
interArea
(
const
label
srcFaceI
,
const
label
tgtFaceI
,
const
SourcePatch
&
srcPatch
,
const
TargetPatch
&
tgtPatch
)
const
;
//- Calculate addressing
void
calcAddressing
(
const
SourcePatch
&
srcPatch
,
const
TargetPatch
&
tgtPatch
,
label
srcFaceI
=
-
1
,
label
tgtFaceI
=
-
1
);
//- Normalise the (area) weights - suppresses numerical error in
// weights calculation
// NOTE: if area weights are incorrect by 'a significant amount'
...
...
@@ -352,6 +258,7 @@ public:
const
SourcePatch
&
srcPatch
,
const
TargetPatch
&
tgtPatch
,
const
faceAreaIntersect
::
triangulationMode
&
triMode
,
const
interpolationMethod
&
method
=
imFaceAreaWeight
,
const
bool
reverseTarget
=
false
);
...
...
@@ -362,6 +269,7 @@ public:
const
TargetPatch
&
tgtPatch
,
const
autoPtr
<
searchableSurface
>&
surf
,
const
faceAreaIntersect
::
triangulationMode
&
triMode
,
const
interpolationMethod
&
method
=
imFaceAreaWeight
,
const
bool
reverseTarget
=
false
);
...
...
@@ -378,6 +286,12 @@ public:
//- Destructor
~
AMIInterpolation
();
// Typedef to SourcePatch type this AMIInterplation is instantiated on
typedef
SourcePatch
sourcePatchType
;
// Typedef to TargetPatch type this AMIInterplation is instantiated on
typedef
TargetPatch
targetPatchType
;
// Member Functions
...
...
@@ -387,6 +301,12 @@ public:
// the AMI
label
singlePatchProc
()
const
;
//- Convert interpolationMethod to word representation
word
interpolationMethodToWord
(
const
interpolationMethod
&
method
)
const
;
// Source patch
...
...
@@ -403,10 +323,6 @@ public:
// patch weights (i.e. the sum before normalisation)
inline
const
scalarField
&
srcWeightsSum
()
const
;
//- Labels of faces that are not overlapped by any target faces
// (should be empty for correct functioning)
inline
const
labelList
&
srcNonOverlap
()
const
;
//- Source map pointer - valid only if singlePatchProc = -1
// This gets source data into a form to be consumed by
// tgtAddress, tgtWeights
...
...
src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H
View file @
12fed658
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
2
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
3
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -55,14 +55,6 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcWeights() const
}
template
<
class
SourcePatch
,
class
TargetPatch
>
inline
const
Foam
::
labelList
&
Foam
::
AMIInterpolation
<
SourcePatch
,
TargetPatch
>::
srcNonOverlap
()
const
{
return
srcNonOverlap_
;
}
template
<
class
SourcePatch
,
class
TargetPatch
>
inline
const
Foam
::
scalarField
&
Foam
::
AMIInterpolation
<
SourcePatch
,
TargetPatch
>::
srcWeightsSum
()
const
...
...
src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethodNew.C
View file @
12fed658
...
...
@@ -36,7 +36,10 @@ Foam::AMIMethod<SourcePatch, TargetPatch>::New
const
bool
reverseTarget
)
{
Info
<<
"Selecting AMIMethod "
<<
methodName
<<
endl
;
if
(
debug
)
{
Info
<<
"Selecting AMIMethod "
<<
methodName
<<
endl
;
}
typename
componentsConstructorTable
::
iterator
cstrIter
=
componentsConstructorTablePtr_
->
find
(
methodName
);
...
...
src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C
View file @
12fed658
...
...
@@ -72,13 +72,13 @@ void Foam::directAMI<SourcePatch, TargetPatch>::appendToDirectSeeds
break
;
}
}
if
(
!
found
)
{
// no match available for source face srcI
mapFlag
[
srcI
]
=
false
;
nonOverlapFaces
.
append
(
srcI
);
}
if
(
!
found
)
{
// no match available for source face srcI
mapFlag
[
srcI
]
=
false
;
nonOverlapFaces
.
append
(
srcI
);
}
}
}
...
...
@@ -198,7 +198,7 @@ void Foam::directAMI<SourcePatch, TargetPatch>::calculate
if
(
nonOverlapFaces
.
size
()
!=
0
)
{
Pout
<<
"AMI: "
<<
nonOverlapFaces
.
size
()
Pout
<<
"
AMI: "
<<
nonOverlapFaces
.
size
()
<<
" non-overlap faces identified"
<<
endl
;
...
...
@@ -210,13 +210,13 @@ void Foam::directAMI<SourcePatch, TargetPatch>::calculate
{
scalar
magSf
=
this
->
srcMagSf_
[
i
];
srcAddress
[
i
].
transfer
(
srcAddr
[
i
]);
srcWeights
[
i
]
=
scalarList
(
srcAddr
[
i
].
size
()
,
magSf
);
srcWeights
[
i
]
=
scalarList
(
1
,
magSf
);
}
forAll
(
tgtAddr
,
i
)
{
scalar
magSf
=
this
->
tgtMagSf_
[
i
];
tgtAddress
[
i
].
transfer
(
tgtAddr
[
i
]);
tgtWeights
[
i
]
=
scalarList
(
tgtAddr
[
i
].
size
()
,
magSf
);
tgtWeights
[
i
]
=
scalarList
(
1
,
magSf
);
}
}
...
...
src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C
View file @
12fed658
...
...
@@ -515,7 +515,7 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
if
(
nonOverlapFaces
.
size
()
!=
0
)
{
Pout
<<
"AMI: "
<<
nonOverlapFaces
.
size
()
Pout
<<
"
AMI: "
<<
nonOverlapFaces
.
size
()
<<
" non-overlap faces identified"
<<
endl
;
...
...
src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H
View file @
12fed658
...
...
@@ -111,7 +111,7 @@ private:
public:
//- Runtime type information
TypeName
(
"faceAreaWeight"
);
TypeName
(
"faceAreaWeight
AMI
"
);
// Constructors
...
...
src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C
View file @
12fed658
...
...
@@ -329,13 +329,13 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::calculate
{
scalar
magSf
=
this
->
srcMagSf_
[
i
];
srcAddress
[
i
].
transfer
(
srcAddr
[
i
]);
srcWeights
[
i
]
=
scalarList
(
srcAddr
[
i
].
size
()
,
magSf
);
srcWeights
[
i
]
=
scalarList
(
1
,
magSf
);
}
forAll
(
tgtAddr
,
i
)
{
scalar
magSf
=
this
->
tgtMagSf_
[
i
];
tgtAddress
[
i
].
transfer
(
tgtAddr
[
i
]);
tgtWeights
[
i
]
=
scalarList
(
tgtAddr
[
i
].
size
()
,
magSf
);
tgtWeights
[
i
]
=
scalarList
(
1
,
magSf
);
}
}
...
...
src/meshTools/AMIInterpolation/AMIInterpolation/AMIPatchToPatchInterpolation.C
0 → 100644
View file @
12fed658
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include
"AMIPatchToPatchInterpolation.H"
#include
"AMIMethod.H"
#include
"directAMI.H"
#include
"mapNearestAMI.H"
#include
"faceAreaWeightAMI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
makeAMIMethod
(
AMIPatchToPatchInterpolation
);
makeAMIMethodType
(
AMIPatchToPatchInterpolation
,
directAMI
);
makeAMIMethodType
(
AMIPatchToPatchInterpolation
,
mapNearestAMI
);
makeAMIMethodType
(
AMIPatchToPatchInterpolation
,
faceAreaWeightAMI
);
}
// ************************************************************************* //
src/meshTools/Make/files
View file @
12fed658
...
...
@@ -170,6 +170,7 @@ twoDPointCorrector/twoDPointCorrector.C
AMI=AMIInterpolation
$(AMI)/AMIInterpolation/AMIInterpolationName.C
$(AMI)/AMIInterpolation/AMIPatchToPatchInterpolation.C
$(AMI)/faceAreaIntersect/faceAreaIntersect.C
$(AMI)/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C
$(AMI)/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C
...
...
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