mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: orientFaceZone: new app for orienting faceZones
This commit is contained in:
@ -0,0 +1,4 @@
|
||||
patchFaceOrientation.C
|
||||
orientFaceZone.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/orientFaceZone
|
||||
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-ltriSurface
|
||||
22
applications/utilities/mesh/manipulation/orientFaceZone/cavity/Allrun
Executable file
22
applications/utilities/mesh/manipulation/orientFaceZone/cavity/Allrun
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
# Get application name
|
||||
application=`getApplication`
|
||||
|
||||
runApplication blockMesh
|
||||
# Make random cell numbering to get faceZone orientation random
|
||||
runApplication renumberMesh -dict system/renumberMeshDict
|
||||
|
||||
# Construct faceZone
|
||||
runApplication topoSet
|
||||
|
||||
runApplication decomposePar -force -cellDist
|
||||
runParallel orientFaceZone 2 f0 '(10 0 0)'
|
||||
runApplication reconstructParMesh -latestTime -mergeTol 1e-6
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
@ -0,0 +1 @@
|
||||
2013-09-16 To test orientFaceZone. Make random orientation. Orient afterwards.
|
||||
@ -0,0 +1,75 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
convertToMeters 0.1;
|
||||
|
||||
vertices
|
||||
(
|
||||
(0 0 0)
|
||||
(1 0 0)
|
||||
(1 1 0)
|
||||
(0 1 0)
|
||||
(0 0 0.1)
|
||||
(1 0 0.1)
|
||||
(1 1 0.1)
|
||||
(0 1 0.1)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
movingWall
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(3 7 6 2)
|
||||
);
|
||||
}
|
||||
fixedWalls
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(0 4 7 3)
|
||||
(2 6 5 1)
|
||||
(1 5 4 0)
|
||||
);
|
||||
}
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
faces
|
||||
(
|
||||
(0 3 2 1)
|
||||
(4 5 6 7)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
mergePatchPairs
|
||||
(
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,41 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 2.2.x |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class polyBoundaryMesh;
|
||||
location "constant/polyMesh";
|
||||
object boundary;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
3
|
||||
(
|
||||
movingWall
|
||||
{
|
||||
type wall;
|
||||
nFaces 20;
|
||||
startFace 760;
|
||||
}
|
||||
fixedWalls
|
||||
{
|
||||
type wall;
|
||||
nFaces 60;
|
||||
startFace 780;
|
||||
}
|
||||
frontAndBack
|
||||
{
|
||||
type empty;
|
||||
inGroups 1(empty);
|
||||
nFaces 800;
|
||||
startFace 840;
|
||||
}
|
||||
)
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object transportProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
nu nu [ 0 2 -1 0 0 0 0 ] 0.01;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,49 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application icoFoam;
|
||||
|
||||
startFrom latestTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 0.5;
|
||||
|
||||
deltaT 0.005;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 20;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,135 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
note "mesh decomposition control dictionary";
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 2;
|
||||
|
||||
//- Keep owner and neighbour on same processor for faces in zones:
|
||||
// preserveFaceZones (heater solid1 solid3);
|
||||
|
||||
//- Keep owner and neighbour on same processor for faces in patches:
|
||||
// (makes sense only for cyclic patches)
|
||||
//preservePatches (cyclic_half0 cyclic_half1);
|
||||
|
||||
//- Keep all of faceSet on a single processor. This puts all cells
|
||||
// connected with a point, edge or face on the same processor.
|
||||
// (just having face connected cells might not guarantee a balanced
|
||||
// decomposition)
|
||||
// The processor can be -1 (the decompositionMethod chooses the processor
|
||||
// for a good load balance) or explicitly provided (upsets balance).
|
||||
//singleProcessorFaceSets ((f0 -1));
|
||||
|
||||
|
||||
//- Use the volScalarField named here as a weight for each cell in the
|
||||
// decomposition. For example, use a particle population field to decompose
|
||||
// for a balanced number of particles in a lagrangian simulation.
|
||||
// weightField dsmcRhoNMean;
|
||||
|
||||
//method scotch;
|
||||
method hierarchical;
|
||||
// method simple;
|
||||
// method metis;
|
||||
// method manual;
|
||||
// method multiLevel;
|
||||
// method structured; // does 2D decomposition of structured mesh
|
||||
|
||||
multiLevelCoeffs
|
||||
{
|
||||
// Decomposition methods to apply in turn. This is like hierarchical but
|
||||
// fully general - every method can be used at every level.
|
||||
|
||||
level0
|
||||
{
|
||||
numberOfSubdomains 64;
|
||||
//method simple;
|
||||
//simpleCoeffs
|
||||
//{
|
||||
// n (2 1 1);
|
||||
// delta 0.001;
|
||||
//}
|
||||
method scotch;
|
||||
}
|
||||
level1
|
||||
{
|
||||
numberOfSubdomains 4;
|
||||
method scotch;
|
||||
}
|
||||
}
|
||||
|
||||
// Desired output
|
||||
|
||||
simpleCoeffs
|
||||
{
|
||||
n (2 1 1);
|
||||
delta 0.001;
|
||||
}
|
||||
|
||||
hierarchicalCoeffs
|
||||
{
|
||||
n (2 1 1);
|
||||
delta 0.001;
|
||||
order xyz;
|
||||
}
|
||||
|
||||
metisCoeffs
|
||||
{
|
||||
/*
|
||||
processorWeights
|
||||
(
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
||||
scotchCoeffs
|
||||
{
|
||||
//processorWeights
|
||||
//(
|
||||
// 1
|
||||
// 1
|
||||
// 1
|
||||
// 1
|
||||
//);
|
||||
//writeGraph true;
|
||||
//strategy "b";
|
||||
}
|
||||
|
||||
manualCoeffs
|
||||
{
|
||||
dataFile "decompositionData";
|
||||
}
|
||||
|
||||
structuredCoeffs
|
||||
{
|
||||
// Patches to do 2D decomposition on. Structured mesh only; cells have
|
||||
// to be in 'columns' on top of patches.
|
||||
patches (bottomPatch);
|
||||
}
|
||||
|
||||
//// Is the case distributed? Note: command-line argument -roots takes
|
||||
//// precedence
|
||||
//distributed yes;
|
||||
//// Per slave (so nProcs-1 entries) the directory above the case.
|
||||
//roots
|
||||
//(
|
||||
// "/tmp"
|
||||
// "/tmp"
|
||||
//);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,60 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
grad(p) Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default none;
|
||||
laplacian(nu,U) Gauss linear orthogonal;
|
||||
laplacian((1|A(U)),p) Gauss linear orthogonal;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
interpolate(HbyA) linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default orthogonal;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
p ;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,46 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
p
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-06;
|
||||
relTol 0;
|
||||
}
|
||||
|
||||
U
|
||||
{
|
||||
solver PBiCG;
|
||||
preconditioner DILU;
|
||||
tolerance 1e-05;
|
||||
relTol 0;
|
||||
}
|
||||
}
|
||||
|
||||
PISO
|
||||
{
|
||||
nCorrectors 2;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
pRefCell 0;
|
||||
pRefValue 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,110 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
note "mesh renumbering dictionary";
|
||||
object renumberMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Write maps from renumbered back to original mesh
|
||||
writeMaps true;
|
||||
|
||||
// Optional entry: sort cells on coupled boundaries to last for use with
|
||||
// e.g. nonBlockingGaussSeidel.
|
||||
sortCoupledFaceCells false;
|
||||
|
||||
// Optional entry: renumber on a block-by-block basis. It uses a
|
||||
// blockCoeffs dictionary to construct a decompositionMethod to do
|
||||
// a block subdivision) and then applies the renumberMethod to each
|
||||
// block in turn. This can be used in large cases to keep the blocks
|
||||
// fitting in cache with all the the cache misses bunched at the end.
|
||||
// This number is the approximate size of the blocks - this gets converted
|
||||
// to a number of blocks that is the input to the decomposition method.
|
||||
//blockSize 1000;
|
||||
|
||||
// Optional entry: sort points into internal and boundary points
|
||||
//orderPoints false;
|
||||
|
||||
|
||||
|
||||
//method CuthillMcKee;
|
||||
//method Sloan;
|
||||
//method manual;
|
||||
method random;
|
||||
//method structured;
|
||||
//method spring;
|
||||
//method zoltan; // only if compiled with zoltan support
|
||||
|
||||
//CuthillMcKeeCoeffs
|
||||
//{
|
||||
// // Reverse CuthillMcKee (RCM) or plain
|
||||
// reverse true;
|
||||
//}
|
||||
|
||||
manualCoeffs
|
||||
{
|
||||
// In system directory: new-to-original (i.e. order) labelIOList
|
||||
dataFile "cellMap";
|
||||
}
|
||||
|
||||
|
||||
// For extruded (i.e. structured in one direction) meshes
|
||||
structuredCoeffs
|
||||
{
|
||||
// Patches that mesh was extruded from. These determine the starting
|
||||
// layer of cells
|
||||
patches (movingWall);
|
||||
// Method to renumber the starting layer of cells
|
||||
method random;
|
||||
|
||||
// Renumber in columns (depthFirst) or in layers
|
||||
depthFirst true;
|
||||
|
||||
// Optional: reverse ordering
|
||||
//reverse false;
|
||||
}
|
||||
|
||||
|
||||
springCoeffs
|
||||
{
|
||||
// Maximum jump of cell indices. Is fraction of number of cells
|
||||
maxCo 0.01;
|
||||
|
||||
// Limit the amount of movement; the fraction maxCo gets decreased
|
||||
// with every iteration
|
||||
freezeFraction 0.999;
|
||||
|
||||
// Maximum number of iterations
|
||||
maxIter 1000;
|
||||
}
|
||||
|
||||
|
||||
blockCoeffs
|
||||
{
|
||||
method scotch;
|
||||
//method hierarchical;
|
||||
//hierarchicalCoeffs
|
||||
//{
|
||||
// n (1 2 1);
|
||||
// delta 0.001;
|
||||
// order xyz;
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
zoltanCoeffs
|
||||
{
|
||||
ORDER_METHOD LOCAL_HSFC;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,64 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 2.2.1 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
actions
|
||||
(
|
||||
// Get 'T' of faces
|
||||
{
|
||||
name f0;
|
||||
type faceSet;
|
||||
action new;
|
||||
source boxToFace;
|
||||
sourceInfo
|
||||
{
|
||||
boxes
|
||||
(
|
||||
(0.0499 -100 -100)(0.0501 100 100)
|
||||
(0.03 0.0499 -100)(0.05 0.0501 100)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// // Pick up some cells
|
||||
// {
|
||||
// name c0;
|
||||
// type cellSet;
|
||||
// action new;
|
||||
// source boxToCell;
|
||||
// sourceInfo
|
||||
// {
|
||||
// boxes
|
||||
// (
|
||||
// (-100 -100 -100)(0.05 0.05 100)
|
||||
// (0.05 0.05 -100)(100 100 100)
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// Convert faceSet to faceZone
|
||||
{
|
||||
name f0;
|
||||
type faceZoneSet;
|
||||
action new;
|
||||
source setToFaceZone;
|
||||
sourceInfo
|
||||
{
|
||||
faceSet f0;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,390 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
Application
|
||||
orientFaceZone
|
||||
|
||||
Description
|
||||
Corrects orientation of faceZone.
|
||||
|
||||
- correct in parallel - excludes coupled faceZones from walk
|
||||
- correct for non-manifold faceZones - restarts walk
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "syncTools.H"
|
||||
#include "patchFaceOrientation.H"
|
||||
#include "PatchEdgeFaceWave.H"
|
||||
#include "orientedSurface.H"
|
||||
#include "globalIndex.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::validArgs.append("faceZone");
|
||||
argList::validArgs.append("outsidePoint");
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createPolyMesh.H"
|
||||
|
||||
const word zoneName = args[1];
|
||||
const point outsidePoint = args.argRead<point>(2);
|
||||
|
||||
Info<< "Orienting faceZone " << zoneName
|
||||
<< " such that " << outsidePoint << " is outside"
|
||||
<< nl << endl;
|
||||
|
||||
|
||||
const faceZone& fZone = mesh.faceZones()[zoneName];
|
||||
|
||||
if (fZone.checkParallelSync())
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Face zone " << fZone.name()
|
||||
<< " is not parallel synchronised."
|
||||
<< " Any coupled face also needs its coupled version to be included"
|
||||
<< " and with opposite flipMap."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const labelList& faceLabels = fZone;
|
||||
|
||||
const indirectPrimitivePatch patch
|
||||
(
|
||||
IndirectList<face>(mesh.faces(), faceLabels),
|
||||
mesh.points()
|
||||
);
|
||||
|
||||
|
||||
|
||||
const PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh));
|
||||
|
||||
|
||||
// Data on all edges and faces
|
||||
List<patchFaceOrientation> allEdgeInfo(patch.nEdges());
|
||||
List<patchFaceOrientation> allFaceInfo(patch.size());
|
||||
|
||||
// Make sure we don't walk through
|
||||
// - slaves of coupled faces
|
||||
// - non-manifold edges
|
||||
{
|
||||
const polyBoundaryMesh& bm = mesh.boundaryMesh();
|
||||
|
||||
label nProtected = 0;
|
||||
|
||||
forAll(faceLabels, faceI)
|
||||
{
|
||||
const label meshFaceI = faceLabels[faceI];
|
||||
const label patchI = bm.whichPatch(meshFaceI);
|
||||
|
||||
if
|
||||
(
|
||||
patchI != -1
|
||||
&& bm[patchI].coupled()
|
||||
&& !isMasterFace[meshFaceI]
|
||||
)
|
||||
{
|
||||
// Slave side. Mark so doesn't get visited.
|
||||
allFaceInfo[faceI] = orientedSurface::NOFLIP;
|
||||
nProtected++;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Protected from visiting "
|
||||
<< returnReduce(nProtected, sumOp<label>())
|
||||
<< " slaves of coupled faces" << nl << endl;
|
||||
}
|
||||
{
|
||||
// Number of (master)faces per edge
|
||||
labelList nMasterFaces(patch.nEdges(), 0);
|
||||
|
||||
forAll(faceLabels, faceI)
|
||||
{
|
||||
const label meshFaceI = faceLabels[faceI];
|
||||
|
||||
if (isMasterFace[meshFaceI])
|
||||
{
|
||||
const labelList& fEdges = patch.faceEdges()[faceI];
|
||||
forAll(fEdges, fEdgeI)
|
||||
{
|
||||
nMasterFaces[fEdges[fEdgeI]]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
syncTools::syncEdgeList
|
||||
(
|
||||
mesh,
|
||||
patch.meshEdges(mesh.edges(), mesh.pointEdges()),
|
||||
nMasterFaces,
|
||||
plusEqOp<label>(),
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
label nProtected = 0;
|
||||
|
||||
forAll(nMasterFaces, edgeI)
|
||||
{
|
||||
if (nMasterFaces[edgeI] > 2)
|
||||
{
|
||||
allEdgeInfo[edgeI] = orientedSurface::NOFLIP;
|
||||
nProtected++;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Protected from visiting "
|
||||
<< returnReduce(nProtected, sumOp<label>())
|
||||
<< " non-manifold edges" << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DynamicList<label> changedEdges;
|
||||
DynamicList<patchFaceOrientation> changedInfo;
|
||||
|
||||
const scalar tol = PatchEdgeFaceWave
|
||||
<
|
||||
indirectPrimitivePatch,
|
||||
patchFaceOrientation
|
||||
>::propagationTol();
|
||||
|
||||
int dummyTrackData;
|
||||
|
||||
globalIndex globalFaces(patch.size());
|
||||
|
||||
while (true)
|
||||
{
|
||||
// Pick an unset face
|
||||
label unsetFaceI = labelMax;
|
||||
forAll(allFaceInfo, faceI)
|
||||
{
|
||||
if (allFaceInfo[faceI] == orientedSurface::UNVISITED)
|
||||
{
|
||||
unsetFaceI = globalFaces.toGlobal(faceI);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(unsetFaceI, minOp<label>());
|
||||
|
||||
if (unsetFaceI == labelMax)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
label procI = globalFaces.whichProcID(unsetFaceI);
|
||||
label seedFaceI = globalFaces.toLocal(procI, unsetFaceI);
|
||||
Info<< "Seeding from processor " << procI << " face " << seedFaceI
|
||||
<< endl;
|
||||
|
||||
if (procI == Pstream::myProcNo())
|
||||
{
|
||||
// Determine orientation of seedFace
|
||||
|
||||
vector d = outsidePoint-patch.faceCentres()[seedFaceI];
|
||||
const vector& fn = patch.faceNormals()[seedFaceI];
|
||||
|
||||
// Set information to correct orientation
|
||||
patchFaceOrientation& faceInfo = allFaceInfo[seedFaceI];
|
||||
faceInfo = orientedSurface::NOFLIP;
|
||||
|
||||
if ((fn&d) < 0)
|
||||
{
|
||||
faceInfo.flip();
|
||||
|
||||
Pout<< "Face " << seedFaceI << " at "
|
||||
<< patch.faceCentres()[seedFaceI]
|
||||
<< " with normal " << fn
|
||||
<< " needs to be flipped." << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pout<< "Face " << seedFaceI << " at "
|
||||
<< patch.faceCentres()[seedFaceI]
|
||||
<< " with normal " << fn
|
||||
<< " points in positive direction (cos = " << (fn&d)/mag(d)
|
||||
<< ")" << endl;
|
||||
}
|
||||
|
||||
|
||||
const labelList& fEdges = patch.faceEdges()[seedFaceI];
|
||||
forAll(fEdges, fEdgeI)
|
||||
{
|
||||
label edgeI = fEdges[fEdgeI];
|
||||
|
||||
patchFaceOrientation& edgeInfo = allEdgeInfo[edgeI];
|
||||
|
||||
if
|
||||
(
|
||||
edgeInfo.updateEdge<int>
|
||||
(
|
||||
mesh,
|
||||
patch,
|
||||
edgeI,
|
||||
seedFaceI,
|
||||
faceInfo,
|
||||
tol,
|
||||
dummyTrackData
|
||||
)
|
||||
)
|
||||
{
|
||||
changedEdges.append(edgeI);
|
||||
changedInfo.append(edgeInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (returnReduce(changedEdges.size(), sumOp<label>()) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Walk
|
||||
PatchEdgeFaceWave
|
||||
<
|
||||
indirectPrimitivePatch,
|
||||
patchFaceOrientation
|
||||
> calc
|
||||
(
|
||||
mesh,
|
||||
patch,
|
||||
changedEdges,
|
||||
changedInfo,
|
||||
allEdgeInfo,
|
||||
allFaceInfo,
|
||||
returnReduce(patch.nEdges(), sumOp<label>())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Push master zone info over to slave (since slave faces never visited)
|
||||
{
|
||||
const polyBoundaryMesh& bm = mesh.boundaryMesh();
|
||||
|
||||
labelList neiStatus
|
||||
(
|
||||
mesh.nFaces()-mesh.nInternalFaces(),
|
||||
orientedSurface::UNVISITED
|
||||
);
|
||||
|
||||
forAll(faceLabels, i)
|
||||
{
|
||||
const label meshFaceI = faceLabels[i];
|
||||
if (!mesh.isInternalFace(meshFaceI))
|
||||
{
|
||||
neiStatus[meshFaceI-mesh.nInternalFaces()] =
|
||||
allFaceInfo[i].flipStatus();
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh, neiStatus);
|
||||
|
||||
forAll(faceLabels, i)
|
||||
{
|
||||
const label meshFaceI = faceLabels[i];
|
||||
const label patchI = bm.whichPatch(meshFaceI);
|
||||
|
||||
if
|
||||
(
|
||||
patchI != -1
|
||||
&& bm[patchI].coupled()
|
||||
&& !isMasterFace[meshFaceI]
|
||||
)
|
||||
{
|
||||
// Slave side. Take flipped from neighbour
|
||||
label bFaceI = meshFaceI-mesh.nInternalFaces();
|
||||
|
||||
if (neiStatus[bFaceI] == orientedSurface::NOFLIP)
|
||||
{
|
||||
allFaceInfo[i] = orientedSurface::FLIP;
|
||||
}
|
||||
else if (neiStatus[bFaceI] == orientedSurface::FLIP)
|
||||
{
|
||||
allFaceInfo[i] = orientedSurface::NOFLIP;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Incorrect status for face " << meshFaceI
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Convert to flipmap and adapt faceZones
|
||||
|
||||
boolList newFlipMap(allFaceInfo.size(), false);
|
||||
label nChanged = 0;
|
||||
forAll(allFaceInfo, faceI)
|
||||
{
|
||||
if (allFaceInfo[faceI] == orientedSurface::NOFLIP)
|
||||
{
|
||||
newFlipMap[faceI] = false;
|
||||
}
|
||||
else if (allFaceInfo[faceI] == orientedSurface::FLIP)
|
||||
{
|
||||
newFlipMap[faceI] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Problem : unvisited face " << faceI
|
||||
<< " centre:" << mesh.faceCentres()[faceLabels[faceI]]
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (fZone.flipMap()[faceI] != newFlipMap[faceI])
|
||||
{
|
||||
nChanged++;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(nChanged, sumOp<label>());
|
||||
if (nChanged > 0)
|
||||
{
|
||||
Info<< "Flipping " << nChanged << " out of "
|
||||
<< globalFaces.size() << " faces." << nl << endl;
|
||||
|
||||
mesh.faceZones()[zoneName].resetAddressing(faceLabels, newFlipMap);
|
||||
if (!mesh.faceZones().write())
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Failed writing faceZones" << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "End." << endl;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "patchFaceOrientation.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Foam::Ostream& os,
|
||||
const Foam::patchFaceOrientation& wDist
|
||||
)
|
||||
{
|
||||
return os << wDist.flipStatus_;
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Foam::Istream& is,
|
||||
Foam::patchFaceOrientation& wDist
|
||||
)
|
||||
{
|
||||
return is >> wDist.flipStatus_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,176 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
Class
|
||||
Foam::patchFaceOrientation
|
||||
|
||||
Description
|
||||
Transport of orientation for use in PatchEdgeFaceWave.
|
||||
|
||||
SourceFiles
|
||||
patchFaceOrientationI.H
|
||||
patchFaceOrientation.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef patchFaceOrientation_H
|
||||
#define patchFaceOrientation_H
|
||||
|
||||
#include "tensor.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class polyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class patchFaceOrientation Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class patchFaceOrientation
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- flip status
|
||||
label flipStatus_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline patchFaceOrientation();
|
||||
|
||||
//- Construct from components
|
||||
inline patchFaceOrientation(const label);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Orientation
|
||||
inline label flipStatus() const;
|
||||
|
||||
//- Reverse orientation
|
||||
inline void flip();
|
||||
|
||||
|
||||
// Needed by meshWave
|
||||
|
||||
//- Check whether origin has been changed at all or
|
||||
// still contains original (invalid) value.
|
||||
template<class TrackingData>
|
||||
inline bool valid(TrackingData& td) const;
|
||||
|
||||
//- Apply rotation matrix
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const indirectPrimitivePatch& patch,
|
||||
const tensor& rotTensor,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of face on edge
|
||||
template<class TrackingData>
|
||||
inline bool updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const indirectPrimitivePatch& patch,
|
||||
const label edgeI,
|
||||
const label faceI,
|
||||
const patchFaceOrientation& faceInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- New information for edge (from e.g. coupled edge)
|
||||
template<class TrackingData>
|
||||
inline bool updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const indirectPrimitivePatch& patch,
|
||||
const patchFaceOrientation& edgeInfo,
|
||||
const bool sameOrientation,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of edge on face.
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const indirectPrimitivePatch& patch,
|
||||
const label faceI,
|
||||
const label edgeI,
|
||||
const patchFaceOrientation& edgeInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Same (like operator==)
|
||||
template<class TrackingData>
|
||||
inline bool equal(const patchFaceOrientation&, TrackingData&) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
// Needed for List IO
|
||||
inline bool operator==(const patchFaceOrientation&) const;
|
||||
inline bool operator!=(const patchFaceOrientation&) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const patchFaceOrientation&);
|
||||
friend Istream& operator>>(Istream&, patchFaceOrientation&);
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with patchFaceOrientation type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<patchFaceOrientation>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "patchFaceOrientationI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,227 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "polyMesh.H"
|
||||
#include "transform.H"
|
||||
#include "orientedSurface.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
inline Foam::patchFaceOrientation::patchFaceOrientation()
|
||||
:
|
||||
flipStatus_(orientedSurface::UNVISITED)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::patchFaceOrientation::patchFaceOrientation
|
||||
(
|
||||
const label flipStatus
|
||||
)
|
||||
:
|
||||
flipStatus_(flipStatus)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::label Foam::patchFaceOrientation::flipStatus() const
|
||||
{
|
||||
return flipStatus_;
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::patchFaceOrientation::flip()
|
||||
{
|
||||
if (flipStatus_ == orientedSurface::NOFLIP)
|
||||
{
|
||||
flipStatus_ = orientedSurface::FLIP;
|
||||
}
|
||||
else if (flipStatus_ == orientedSurface::FLIP)
|
||||
{
|
||||
flipStatus_ = orientedSurface::NOFLIP;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class TrackingData>
|
||||
inline bool Foam::patchFaceOrientation::valid(TrackingData& td) const
|
||||
{
|
||||
return flipStatus_ != orientedSurface::UNVISITED;
|
||||
}
|
||||
|
||||
|
||||
template<class TrackingData>
|
||||
inline void Foam::patchFaceOrientation::transform
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const indirectPrimitivePatch& patch,
|
||||
const tensor& rotTensor,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
template<class TrackingData>
|
||||
inline bool Foam::patchFaceOrientation::updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const indirectPrimitivePatch& patch,
|
||||
const label edgeI,
|
||||
const label faceI,
|
||||
const patchFaceOrientation& faceInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
if (valid(td))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const face& f = patch.localFaces()[faceI];
|
||||
const edge& e = patch.edges()[edgeI];
|
||||
|
||||
//Pout<< "Updating edge:" << edgeI << " verts:" << e << nl
|
||||
// << " start:" << patch.localPoints()[e[0]] << nl
|
||||
// << " end:" << patch.localPoints()[e[1]] << endl;
|
||||
|
||||
patchFaceOrientation consistentInfo(faceInfo);
|
||||
|
||||
// Check how edge relates to face
|
||||
if (f.edgeDirection(e) < 0)
|
||||
{
|
||||
// Create flipped version of faceInfo
|
||||
consistentInfo.flip();
|
||||
}
|
||||
|
||||
operator=(consistentInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class TrackingData>
|
||||
inline bool Foam::patchFaceOrientation::updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const indirectPrimitivePatch& patch,
|
||||
const patchFaceOrientation& edgeInfo,
|
||||
const bool sameOrientation,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
if (valid(td))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create (flipped/unflipped) version of edgeInfo
|
||||
patchFaceOrientation consistentInfo(edgeInfo);
|
||||
|
||||
if (!sameOrientation)
|
||||
{
|
||||
consistentInfo.flip();
|
||||
}
|
||||
|
||||
operator=(consistentInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class TrackingData>
|
||||
inline bool Foam::patchFaceOrientation::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const indirectPrimitivePatch& patch,
|
||||
const label faceI,
|
||||
const label edgeI,
|
||||
const patchFaceOrientation& edgeInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
if (valid(td))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Transfer flip to face
|
||||
const face& f = patch.localFaces()[faceI];
|
||||
const edge& e = patch.edges()[edgeI];
|
||||
|
||||
|
||||
//Pout<< "Updating face:" << faceI << nl
|
||||
// << " verts:" << f << nl
|
||||
// << " with edge:" << edgeI << nl
|
||||
// << " start:" << patch.localPoints()[e[0]] << nl
|
||||
// << " end:" << patch.localPoints()[e[1]] << endl;
|
||||
|
||||
|
||||
// Create (flipped/unflipped) version of edgeInfo
|
||||
patchFaceOrientation consistentInfo(edgeInfo);
|
||||
|
||||
if (f.edgeDirection(e) > 0)
|
||||
{
|
||||
consistentInfo.flip();
|
||||
}
|
||||
|
||||
operator=(consistentInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class TrackingData>
|
||||
inline bool Foam::patchFaceOrientation::equal
|
||||
(
|
||||
const patchFaceOrientation& rhs,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
return operator==(rhs);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::patchFaceOrientation::operator==
|
||||
(
|
||||
const Foam::patchFaceOrientation& rhs
|
||||
) const
|
||||
{
|
||||
return flipStatus() == rhs.flipStatus();
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::patchFaceOrientation::operator!=
|
||||
(
|
||||
const Foam::patchFaceOrientation& rhs
|
||||
) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user