STYLE: Remove trailing whitespace systematically

This commit is contained in:
Henrik Rusche 2015-08-11 11:19:57 +02:00 committed by Hrvoje Jasak
parent a9ef31fa39
commit 8ac5840737
104 changed files with 1036 additions and 1036 deletions

View file

@ -4,7 +4,7 @@ body {
margin: 0px; margin: 0px;
font-family: verdana, arial, helvetica, sans-serif; font-family: verdana, arial, helvetica, sans-serif;
text-decoration: none; text-decoration: none;
font-size: 12px; font-size: 12px;
} }
a:link { text-decoration: none; color: #0000ff ; } a:link { text-decoration: none; color: #0000ff ; }
a:link:hover { text-decoration: none; color: #0000ff ; } a:link:hover { text-decoration: none; color: #0000ff ; }
@ -21,7 +21,7 @@ td.leftmenu {
text-align: left; text-align: left;
font-size: 14px; font-size: 14px;
height: 20px; height: 20px;
width: 200px; width: 200px;
} }
a.menuTopoff { color: #000000; font-size: 14px; } a.menuTopoff { color: #000000; font-size: 14px; }
@ -33,7 +33,7 @@ td.topmenu {
text-align: center; text-align: center;
font-size: 16px; font-size: 16px;
width: 150px; width: 150px;
font-weight: bold; font-weight: bold;
} }
h1 { font-size: 18px; } h1 { font-size: 18px; }
h2 { font-size: 16px; } h2 { font-size: 16px; }

View file

@ -39,7 +39,7 @@ export PROGRAMS_HOME=/c/Programs
# {{{ DEFINE USER EDITABLE FUNCTIONS # {{{ DEFINE USER EDITABLE FUNCTIONS
set_system_paths() { set_system_paths() {
echo "Setting environment variables for user-defined installed system tools and utilities ..." echo "Setting environment variables for user-defined installed system tools and utilities ..."
export CMAKE_HOME=$PROGRAMS_HOME/cmake-3.2.3-win32-x86 export CMAKE_HOME=$PROGRAMS_HOME/cmake-3.2.3-win32-x86
export GIT_HOME=$PROGRAMS_HOME/Git export GIT_HOME=$PROGRAMS_HOME/Git
export MINGW_HOME=$PROGRAMS_HOME/mingw64 export MINGW_HOME=$PROGRAMS_HOME/mingw64
@ -55,7 +55,7 @@ set_system_paths() {
add_to_path() { add_to_path() {
echo echo
echo "Adding user-defined installed system tools to PATH ..." echo "Adding user-defined installed system tools to PATH ..."
export PATH=$ZIP_HOME:$PATH export PATH=$ZIP_HOME:$PATH
export PATH=$WGET_HOME/bin:$PATH export PATH=$WGET_HOME/bin:$PATH
export PATH=$PYTHON_HOME:$PATH export PATH=$PYTHON_HOME:$PATH

View file

@ -756,14 +756,14 @@ fi
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARAVIEW_DIR is initialized to: $PARAVIEW_DIR" [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARAVIEW_DIR is initialized to: $PARAVIEW_DIR"
# Load llvm # Load llvm
# ~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~
[ -z "$LLVM_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_LLVM_360 ] && [ -e $WM_THIRD_PARTY_DIR/packages/llvm-3.6.0/platforms/$WM_OPTIONS ] && { [ -z "$LLVM_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_LLVM_360 ] && [ -e $WM_THIRD_PARTY_DIR/packages/llvm-3.6.0/platforms/$WM_OPTIONS ] && {
_foamSource $WM_THIRD_PARTY_DIR/packages/llvm-3.6.0/platforms/$WM_OPTIONS/etc/llvm-3.6.0.sh _foamSource $WM_THIRD_PARTY_DIR/packages/llvm-3.6.0/platforms/$WM_OPTIONS/etc/llvm-3.6.0.sh
} }
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo " LLVM_DIR is initialized to: $LLVM_DIR" [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " LLVM_DIR is initialized to: $LLVM_DIR"
# Load mesa # Load mesa
# ~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~
[ -z "$MESA_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_MESA_GIT ] && [ -e $WM_THIRD_PARTY_DIR/packages/mesa-git/platforms/$WM_OPTIONS ] && { [ -z "$MESA_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_MESA_GIT ] && [ -e $WM_THIRD_PARTY_DIR/packages/mesa-git/platforms/$WM_OPTIONS ] && {
_foamSource $WM_THIRD_PARTY_DIR/packages/mesa-git/platforms/$WM_OPTIONS/etc/mesa-git.sh _foamSource $WM_THIRD_PARTY_DIR/packages/mesa-git/platforms/$WM_OPTIONS/etc/mesa-git.sh

View file

@ -239,7 +239,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const
// If the dot-product is negative, cell is marked for use with the // If the dot-product is negative, cell is marked for use with the
// Gauss gradient, which is unconditionally positive // Gauss gradient, which is unconditionally positive
// HJ, 21/Apr/2015 // HJ, 21/Apr/2015
// First loop: detect cells with bad least squares vectors // First loop: detect cells with bad least squares vectors
// Use Gauss Gradient field: set to 1 if Gauss is needed // Use Gauss Gradient field: set to 1 if Gauss is needed

View file

@ -76,24 +76,24 @@ void cartesianMeshExtractor::decomposeSplitHexes()
void cartesianMeshExtractor::createMesh() void cartesianMeshExtractor::createMesh()
{ {
Info << "Extracting polyMesh" << endl; Info << "Extracting polyMesh" << endl;
//- create points and pointLeaves addressing //- create points and pointLeaves addressing
createPointsAndAddressing(); createPointsAndAddressing();
//- create the mesh //- create the mesh
createPolyMesh(); createPolyMesh();
//- decompose split-hex cells into tetrahedra and pyramids //- decompose split-hex cells into tetrahedra and pyramids
decomposeSplitHexesIntoTetsAndPyramids(); decomposeSplitHexesIntoTetsAndPyramids();
//- remove unused vertices //- remove unused vertices
polyMeshGenModifier(mesh_).removeUnusedVertices(); polyMeshGenModifier(mesh_).removeUnusedVertices();
Info << "Mesh has :" << nl Info << "Mesh has :" << nl
<< mesh_.points().size() << " vertices " << nl << mesh_.points().size() << " vertices " << nl
<< mesh_.faces().size() << " faces" << nl << mesh_.faces().size() << " faces" << nl
<< mesh_.cells().size() << " cells" << endl; << mesh_.cells().size() << " cells" << endl;
if( Pstream::parRun() ) if( Pstream::parRun() )
{ {
label nCells = mesh_.cells().size(); label nCells = mesh_.cells().size();
@ -112,7 +112,7 @@ void cartesianMeshExtractor::createMesh()
<< " This can be reolved by reducing the maxCellSize by a fraction." << " This can be reolved by reducing the maxCellSize by a fraction."
<< "i.e. 2.49999 instead of 2.5." << exit(FatalError); << "i.e. 2.49999 instead of 2.5." << exit(FatalError);
} }
Info << "Finished extracting polyMesh" << endl; Info << "Finished extracting polyMesh" << endl;
} }

View file

@ -42,7 +42,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
class IOdictionary; class IOdictionary;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -54,13 +54,13 @@ class cartesianMeshExtractor
// Private data // Private data
//- reference to the octree addressing //- reference to the octree addressing
meshOctreeAddressing octreeCheck_; meshOctreeAddressing octreeCheck_;
//- reference to the mesh //- reference to the mesh
polyMeshGen& mesh_; polyMeshGen& mesh_;
//- decompose split hex cells //- decompose split hex cells
bool decomposeSplitHexes_; bool decomposeSplitHexes_;
//- cell label for a given leaf //- cell label for a given leaf
labelList* leafCellLabelPtr_; labelList* leafCellLabelPtr_;
@ -73,7 +73,7 @@ class cartesianMeshExtractor
//- create mesh data //- create mesh data
void createPolyMesh(); void createPolyMesh();
//- decompose split hexes into pyramids and tets //- decompose split hexes into pyramids and tets
void decomposeSplitHexesIntoTetsAndPyramids(); void decomposeSplitHexesIntoTetsAndPyramids();
@ -105,7 +105,7 @@ public:
//- decompose split hexes into standard cells //- decompose split hexes into standard cells
void decomposeSplitHexes(); void decomposeSplitHexes();
//- create the mesh with the above options //- create the mesh with the above options
void createMesh(); void createMesh();
}; };

View file

@ -45,39 +45,39 @@ void cartesianMeshExtractor::decomposeSplitHexesIntoTetsAndPyramids()
if( !decomposeSplitHexes_ ) return; if( !decomposeSplitHexes_ ) return;
Info << "Decomposing split-hex cells" << endl; Info << "Decomposing split-hex cells" << endl;
const faceListPMG& faces = mesh_.faces(); const faceListPMG& faces = mesh_.faces();
//- decompose faces which have more than 4 vertices //- decompose faces which have more than 4 vertices
boolList decompose(faces.size(), false); boolList decompose(faces.size(), false);
label nDecomposed(0); label nDecomposed(0);
forAll(faces, faceI) forAll(faces, faceI)
{ {
if( faces[faceI].size() > 4 ) if( faces[faceI].size() > 4 )
{ {
++nDecomposed; ++nDecomposed;
decompose[faceI] = true; decompose[faceI] = true;
} }
} }
reduce(nDecomposed, sumOp<label>()); reduce(nDecomposed, sumOp<label>());
Info << "Decomposing " << nDecomposed Info << "Decomposing " << nDecomposed
<< " faces with more than 4 vertices" << endl; << " faces with more than 4 vertices" << endl;
if( nDecomposed != 0 ) if( nDecomposed != 0 )
{ {
//- decompose marked faces into triangles //- decompose marked faces into triangles
decomposeFaces(mesh_).decomposeMeshFaces(decompose); decomposeFaces(mesh_).decomposeMeshFaces(decompose);
} }
//- decompose cells with 24 faces //- decompose cells with 24 faces
const cellListPMG& cells = mesh_.cells(); const cellListPMG& cells = mesh_.cells();
decompose.setSize(cells.size()); decompose.setSize(cells.size());
decompose = false; decompose = false;
hexMatcher hex; hexMatcher hex;
forAll(cells, cellI) forAll(cells, cellI)
{ {
@ -87,19 +87,19 @@ void cartesianMeshExtractor::decomposeSplitHexesIntoTetsAndPyramids()
decompose[cellI] = true; decompose[cellI] = true;
} }
} }
reduce(nDecomposed, sumOp<label>()); reduce(nDecomposed, sumOp<label>());
Info << "Decomposing " << nDecomposed Info << "Decomposing " << nDecomposed
<< " cells into tetrahedra and pyramids" << endl; << " cells into tetrahedra and pyramids" << endl;
if( nDecomposed ) if( nDecomposed )
{ {
//- decompose marked cells into tets and pyramids //- decompose marked cells into tets and pyramids
decomposeCells dc(mesh_); decomposeCells dc(mesh_);
dc.decomposeMesh(decompose); dc.decomposeMesh(decompose);
} }
Info << "Finished decomposing split-hex cells" << endl; Info << "Finished decomposing split-hex cells" << endl;
} }

View file

@ -33,21 +33,21 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void boundaryLayers::addWrapperLayer() void boundaryLayers::addWrapperLayer()
{ {
createOTopologyLayers(); createOTopologyLayers();
if( treatedPatch_[0] ) return; if( treatedPatch_[0] ) return;
const meshSurfaceEngine& mse = surfaceEngine(); const meshSurfaceEngine& mse = surfaceEngine();
const labelList& bPoints = mse.boundaryPoints(); const labelList& bPoints = mse.boundaryPoints();
boolList treatPatches(mesh_.boundaries().size(), true); boolList treatPatches(mesh_.boundaries().size(), true);
labelLongList newLabelForVertex(nPoints_, -1); labelLongList newLabelForVertex(nPoints_, -1);
pointFieldPMG& points = mesh_.points(); pointFieldPMG& points = mesh_.points();
@ -57,13 +57,13 @@ void boundaryLayers::addWrapperLayer()
points[nPoints_] = points[bPoints[bpI]]; points[nPoints_] = points[bPoints[bpI]];
newLabelForVertex[bPoints[bpI]] = nPoints_++; newLabelForVertex[bPoints[bpI]] = nPoints_++;
} }
createNewFacesAndCells(treatPatches); createNewFacesAndCells(treatPatches);
forAll(treatPatches, patchI) forAll(treatPatches, patchI)
if( treatPatches[patchI] ) if( treatPatches[patchI] )
treatedPatch_[patchI] = true; treatedPatch_[patchI] = true;
//- delete surface engine //- delete surface engine
clearOut(); clearOut();
} }

View file

@ -54,51 +54,51 @@ namespace Foam
class extrudeLayer class extrudeLayer
{ {
// Private data // Private data
//- Reference to the mesh //- Reference to the mesh
polyMeshGen& mesh_; polyMeshGen& mesh_;
//- thickness //- thickness
const scalar thickness_; const scalar thickness_;
//- number of points in the original mesh //- number of points in the original mesh
const label nOrigPoints_; const label nOrigPoints_;
//- number of faces in the original mesh //- number of faces in the original mesh
const label nOrigFaces_; const label nOrigFaces_;
//- number of cells in the original mesh //- number of cells in the original mesh
const label nOrigCells_; const label nOrigCells_;
//- pairs of faces making the extruded front //- pairs of faces making the extruded front
LongList<labelPair> extrudedFaces_; LongList<labelPair> extrudedFaces_;
//- store the orientation of the extruded front //- store the orientation of the extruded front
//- true if the pair has the same orientation and false otherwise //- true if the pair has the same orientation and false otherwise
LongList<bool> pairOrientation_; LongList<bool> pairOrientation_;
//- original point label //- original point label
labelLongList origPointLabel_; labelLongList origPointLabel_;
// Private member functions // Private member functions
//- duplicate faces which will be extruded //- duplicate faces which will be extruded
void createDuplicateFrontFaces(const LongList<labelPair>&); void createDuplicateFrontFaces(const LongList<labelPair>&);
//- create new vertices and open the mesh //- create new vertices and open the mesh
void createNewVertices(); void createNewVertices();
//- move points to make space for the new cells //- move points to make space for the new cells
void movePoints(); void movePoints();
//- create layer cells //- create layer cells
void createLayerCells(); void createLayerCells();
//- create new faces at parallel boundaries //- create new faces at parallel boundaries
void createNewFacesParallel(); void createNewFacesParallel();
//- update boundary patches //- update boundary patches
void updateBoundary(); void updateBoundary();
// Nested classes // Nested classes
//- this class provides addressing data needed for generating //- this class provides addressing data needed for generating
//- cells emerging as a consequence of self-intersecting layers //- cells emerging as a consequence of self-intersecting layers
@ -107,18 +107,18 @@ class extrudeLayer
// Private data // Private data
//- const reference to mesh faces //- const reference to mesh faces
const faceListPMG& faces_; const faceListPMG& faces_;
//- const reference to extruded face pairs //- const reference to extruded face pairs
const LongList<labelPair>& extrudedFaces_; const LongList<labelPair>& extrudedFaces_;
//- const reference telling the orientation of each face pair //- const reference telling the orientation of each face pair
LongList<bool> pairOrientation_; LongList<bool> pairOrientation_;
//- const reference to the extruded faces at points //- const reference to the extruded faces at points
const VRWGraph& pointExtruded_; const VRWGraph& pointExtruded_;
public: public:
// Construct from faces, extruded face pairs and // Construct from faces, extruded face pairs and
// point-extrudedfaces addressing // point-extrudedfaces addressing
addressingCalculator addressingCalculator
@ -128,41 +128,41 @@ class extrudeLayer
const LongList<bool>& pairOrientation, const LongList<bool>& pairOrientation,
const VRWGraph& pointFaces const VRWGraph& pointFaces
); );
// Destructor // Destructor
~addressingCalculator(); ~addressingCalculator();
// Member functions // Member functions
//- return label of the original face for the given face //- return label of the original face for the given face
inline label origFaceLabel(const label extrudedI) const; inline label origFaceLabel(const label extrudedI) const;
//- return position of point in extruded face //- return position of point in extruded face
inline label positionInFace inline label positionInFace
( (
const label extrudedI, const label extrudedI,
const label pointI const label pointI
) const; ) const;
//- return point label in the original face //- return point label in the original face
inline label origPointLabel inline label origPointLabel
( (
const label extrudedI, const label extrudedI,
const label pos const label pos
) const; ) const;
inline label origPoint inline label origPoint
( (
const label extrudedI, const label extrudedI,
const label pointI const label pointI
) const; ) const;
//- find face sharing an edge with the given face //- find face sharing an edge with the given face
inline label faceSharingEdge inline label faceSharingEdge
( (
const label extrudedI, const label extrudedI,
const label eI const label eI
) const; ) const;
//- find faces attached to both points //- find faces attached to both points
inline void facesSharingEdge inline void facesSharingEdge
( (
@ -171,7 +171,7 @@ class extrudeLayer
DynList<label>& DynList<label>&
) const; ) const;
}; };
// Enumerators // Enumerators
enum extrudeLayerTypes_ enum extrudeLayerTypes_
{ {
@ -179,17 +179,17 @@ class extrudeLayer
FRONTVERTEX = 1, FRONTVERTEX = 1,
FRONTVERTEXPROCBND = 2 FRONTVERTEXPROCBND = 2
}; };
//- Disallow bitwise copy construct //- Disallow bitwise copy construct
extrudeLayer(const extrudeLayer&); extrudeLayer(const extrudeLayer&);
//- Disallow bitwise assignment //- Disallow bitwise assignment
void operator=(const extrudeLayer&); void operator=(const extrudeLayer&);
public: public:
// Constructors // Constructors
//- Construct from mesh, extrusion faces, thickness and number of layers //- Construct from mesh, extrusion faces, thickness and number of layers
extrudeLayer extrudeLayer
( (
@ -197,10 +197,10 @@ class extrudeLayer
const LongList<labelPair>& extrusionFront, const LongList<labelPair>& extrusionFront,
const scalar thickness = -1.0 const scalar thickness = -1.0
); );
// Destructor // Destructor
~extrudeLayer(); ~extrudeLayer();
// Public member functions // Public member functions
}; };

View file

@ -49,10 +49,10 @@ inline label extrudeLayer::addressingCalculator::positionInFace
) const ) const
{ {
const face& f = faces_[extrudedFaces_[extrudedI].first()]; const face& f = faces_[extrudedFaces_[extrudedI].first()];
return f.which(pointI); return f.which(pointI);
} }
inline label extrudeLayer::addressingCalculator::origPointLabel inline label extrudeLayer::addressingCalculator::origPointLabel
( (
const label extrudedI, const label extrudedI,
@ -60,7 +60,7 @@ inline label extrudeLayer::addressingCalculator::origPointLabel
) const ) const
{ {
const face& of = faces_[extrudedFaces_[extrudedI].second()]; const face& of = faces_[extrudedFaces_[extrudedI].second()];
if( pairOrientation_[extrudedI] ) if( pairOrientation_[extrudedI] )
{ {
return of[pos]; return of[pos];
@ -69,13 +69,13 @@ inline label extrudeLayer::addressingCalculator::origPointLabel
{ {
return of[(of.size()-pos)%of.size()]; return of[(of.size()-pos)%of.size()];
} }
FatalErrorIn FatalErrorIn
( (
"label extrudeLayer::addressingCalculator::origPointLabel" "label extrudeLayer::addressingCalculator::origPointLabel"
"(const label, const label) const" "(const label, const label) const"
) << "Cannot find point for the given position" << abort(FatalError); ) << "Cannot find point for the given position" << abort(FatalError);
return -1; return -1;
} }
@ -88,7 +88,7 @@ inline label extrudeLayer::addressingCalculator::origPoint
const face& f = faces_[extrudedFaces_[extrudedI].first()]; const face& f = faces_[extrudedFaces_[extrudedI].first()];
const face& of = faces_[extrudedFaces_[extrudedI].second()]; const face& of = faces_[extrudedFaces_[extrudedI].second()];
const label pos = f.which(pointI); const label pos = f.which(pointI);
if( pairOrientation_[extrudedI] ) if( pairOrientation_[extrudedI] )
{ {
return of[pos]; return of[pos];
@ -97,13 +97,13 @@ inline label extrudeLayer::addressingCalculator::origPoint
{ {
return of[(of.size()-pos)%of.size()]; return of[(of.size()-pos)%of.size()];
} }
FatalErrorIn FatalErrorIn
( (
"label extrudeLayer::addressingCalculator::origPoint" "label extrudeLayer::addressingCalculator::origPoint"
"(const label, const label) const" "(const label, const label) const"
) << "Cannot find point for the given position" << abort(FatalError); ) << "Cannot find point for the given position" << abort(FatalError);
return -1; return -1;
} }
@ -114,18 +114,18 @@ inline label extrudeLayer::addressingCalculator::faceSharingEdge
) const ) const
{ {
const face& f = faces_[extrudedFaces_[extrudedI].first()]; const face& f = faces_[extrudedFaces_[extrudedI].first()];
const label pointI = f[eI]; const label pointI = f[eI];
const label nextI = f.nextLabel(eI); const label nextI = f.nextLabel(eI);
label otherFace(-1); label otherFace(-1);
forAllRow(pointExtruded_, pointI, pfI) forAllRow(pointExtruded_, pointI, pfI)
{ {
const label currFaceI = pointExtruded_(pointI, pfI); const label currFaceI = pointExtruded_(pointI, pfI);
if( currFaceI == extrudedI ) if( currFaceI == extrudedI )
continue; continue;
if( pointExtruded_.contains(nextI, currFaceI) ) if( pointExtruded_.contains(nextI, currFaceI) )
{ {
if( otherFace != -1 ) if( otherFace != -1 )
@ -135,11 +135,11 @@ inline label extrudeLayer::addressingCalculator::faceSharingEdge
"(const label, const label) const" "(const label, const label) const"
) << "Expected only one such face" ) << "Expected only one such face"
<< abort(FatalError); << abort(FatalError);
otherFace = currFaceI; otherFace = currFaceI;
} }
} }
return otherFace; return otherFace;
} }
@ -151,11 +151,11 @@ inline void extrudeLayer::addressingCalculator::facesSharingEdge
) const ) const
{ {
edgeFaces.clear(); edgeFaces.clear();
forAllRow(pointExtruded_, start, pfI) forAllRow(pointExtruded_, start, pfI)
{ {
const label currFaceI = pointExtruded_(start, pfI); const label currFaceI = pointExtruded_(start, pfI);
if( pointExtruded_.contains(end, currFaceI) ) if( pointExtruded_.contains(end, currFaceI) )
edgeFaces.append(currFaceI); edgeFaces.append(currFaceI);
} }

View file

@ -39,9 +39,9 @@ Foam::DynList<T, staticSize>::DynList(Istream& is)
"template<class T, Foam::label staticSize>" "template<class T, Foam::label staticSize>"
"\nFoam::DynList<T, staticSize>::DynList(Istream& is)" "\nFoam::DynList<T, staticSize>::DynList(Istream& is)"
) << "Not implemented" << exit(FatalError); ) << "Not implemented" << exit(FatalError);
List<T> helper(is); List<T> helper(is);
nextFree_ = helper.size(); nextFree_ = helper.size();
UList<T>::swap(helper); UList<T>::swap(helper);
} }
@ -74,7 +74,7 @@ Foam::Istream& Foam::operator>>
"\nFoam::Istream& Foam::operator>>" "\nFoam::Istream& Foam::operator>>"
"(Foam::Istream& is, Foam::DynList<T, staticSize>& DL)" "(Foam::Istream& is, Foam::DynList<T, staticSize>& DL)"
) << "Not implemented" << exit(FatalError); ) << "Not implemented" << exit(FatalError);
is >> static_cast<List<T>&>(DL); is >> static_cast<List<T>&>(DL);
DL.nextFree_ = DL.List<T>::size(); DL.nextFree_ = DL.List<T>::size();

View file

@ -36,7 +36,7 @@ void Foam::FRWGraph<T, width>::checkIndex(const label i, const label j) const
<< " is not in range " << 0 << " is not in range " << 0
<< " and " << nRows_ << abort(FatalError); << " and " << nRows_ << abort(FatalError);
} }
if( (j < 0) || (j >= width) ) if( (j < 0) || (j >= width) )
FatalErrorIn FatalErrorIn
( (
@ -158,7 +158,7 @@ inline bool Foam::FRWGraph<T,width>::contains
for(register label i=0;i<width;++i) for(register label i=0;i<width;++i)
if( data_[start+i] == e ) if( data_[start+i] == e )
return true; return true;
return false; return false;
} }
@ -173,7 +173,7 @@ inline Foam::label Foam::FRWGraph<T,width>::containsAtPosition
for(register label i=0;i<width;++i) for(register label i=0;i<width;++i)
if( data_[start+i] == e ) if( data_[start+i] == e )
return i; return i;
return -1; return -1;
} }
@ -188,7 +188,7 @@ inline const T& Foam::FRWGraph<T,width>::operator()
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i, j); checkIndex(i, j);
#endif #endif
return data_[i * width + j]; return data_[i * width + j];
} }
@ -201,7 +201,7 @@ inline T& Foam::FRWGraph<T,width>::operator()
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i, j); checkIndex(i, j);
#endif #endif
return data_[i * width + j]; return data_[i * width + j];
} }

View file

@ -81,7 +81,7 @@ IODynList<T, IndexType>::IODynList
readStream(typeName) >> *this; readStream(typeName) >> *this;
close(); close();
} }
DynList<T, IndexType>::operator=(list); DynList<T, IndexType>::operator=(list);
} }

View file

@ -81,7 +81,7 @@ IOLongList<T, Offset>::IOLongList
readStream(typeName) >> *this; readStream(typeName) >> *this;
close(); close();
} }
LongList<T, Offset>::operator=(list); LongList<T, Offset>::operator=(list);
} }

View file

@ -29,7 +29,7 @@ Description
every time it is resized every time it is resized
SourceFiles SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -53,24 +53,24 @@ class cellListPMG
// Private data // Private data
//- number of used elements //- number of used elements
label nElmts_; label nElmts_;
// Disallow bitwise assignment // Disallow bitwise assignment
void operator=(const cellListPMG&); void operator=(const cellListPMG&);
cellListPMG(const cellListPMG&); cellListPMG(const cellListPMG&);
// Disallow transfer from cellList // Disallow transfer from cellList
void transfer(cellList&); void transfer(cellList&);
public: public:
// Constructors // Constructors
//- null construct //- null construct
inline cellListPMG(); inline cellListPMG();
// Destructor // Destructor
inline ~cellListPMG(); inline ~cellListPMG();
// Member functions // Member functions
//- return the number of used elements //- return the number of used elements
inline label size() const; inline label size() const;
@ -83,15 +83,15 @@ public:
//- add a cell at the end of the list //- add a cell at the end of the list
inline void append(const cell&); inline void append(const cell&);
//- return an element with bound checking //- return an element with bound checking
inline cell& newElmt(const label); inline cell& newElmt(const label);
// Member operators // Member operators
inline void operator=(const cellList&); inline void operator=(const cellList&);
friend inline Ostream& operator<<(Ostream&, const cellListPMG&); friend inline Ostream& operator<<(Ostream&, const cellListPMG&);
friend inline Istream& operator>>(Istream&, cellListPMG&); friend inline Istream& operator>>(Istream&, cellListPMG&);
}; };

View file

@ -52,7 +52,7 @@ inline cellListPMG::~cellListPMG()
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline label cellListPMG::size() const inline label cellListPMG::size() const
{ {
return nElmts_; return nElmts_;
@ -68,7 +68,7 @@ inline void cellListPMG::setSize(const label nElmts)
cellList copy(label(1.5*nElmts)); cellList copy(label(1.5*nElmts));
for(label i=0;i<nElmts_;++i) for(label i=0;i<nElmts_;++i)
copy[i].transfer(this->operator[](i)); copy[i].transfer(this->operator[](i));
cellList::transfer(copy); cellList::transfer(copy);
} }
else else
@ -106,11 +106,11 @@ inline void cellListPMG::operator=(const cellList& cls)
forAll(cls, cI) forAll(cls, cI)
this->operator[](cI) = cls[cI]; this->operator[](cI) = cls[cI];
} }
inline Ostream& operator<<(Ostream& os, const cellListPMG& cls) inline Ostream& operator<<(Ostream& os, const cellListPMG& cls)
{ {
SubList<cell> c(cls, cls.nElmts_, 0); SubList<cell> c(cls, cls.nElmts_, 0);
os << c; os << c;
return os; return os;
} }
@ -120,7 +120,7 @@ inline Istream& operator>>(Istream& is, cellListPMG& cls)
cellList& cells = static_cast<cellList&>(cls); cellList& cells = static_cast<cellList&>(cls);
is >> cells; is >> cells;
cls.nElmts_ = cells.size(); cls.nElmts_ = cells.size();
return is; return is;
} }

View file

@ -69,7 +69,7 @@ inline faceListPMG::~faceListPMG()
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline label faceListPMG::size() const inline label faceListPMG::size() const
{ {
return nElmts_; return nElmts_;
@ -85,7 +85,7 @@ inline void faceListPMG::setSize(const label nElmts)
faceList copy(label(1.5*nElmts)); faceList copy(label(1.5*nElmts));
for(label i=0;i<nElmts_;++i) for(label i=0;i<nElmts_;++i)
copy[i].transfer(this->operator[](i)); copy[i].transfer(this->operator[](i));
faceList::transfer(copy); faceList::transfer(copy);
} }
else else
@ -128,11 +128,11 @@ inline void faceListPMG::operator=(const faceList& fcs)
forAll(fcs, fI) forAll(fcs, fI)
this->operator[](fI) = fcs[fI]; this->operator[](fI) = fcs[fI];
} }
inline Ostream& operator<<(Ostream& os, const faceListPMG& fcs) inline Ostream& operator<<(Ostream& os, const faceListPMG& fcs)
{ {
SubList<face> f(fcs, fcs.nElmts_, 0); SubList<face> f(fcs, fcs.nElmts_, 0);
os << f; os << f;
return os; return os;
} }
@ -142,7 +142,7 @@ inline Istream& operator>>(Istream& is, faceListPMG& fcs)
faceList& faces = static_cast<faceList&>(fcs); faceList& faces = static_cast<faceList&>(fcs);
is >> faces; is >> faces;
fcs.nElmts_ = faces.size(); fcs.nElmts_ = faces.size();
return is; return is;
} }

View file

@ -67,7 +67,7 @@ inline pointFieldPMG::~pointFieldPMG()
{} {}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline label pointFieldPMG::size() const inline label pointFieldPMG::size() const
{ {
return nElmts_; return nElmts_;
@ -121,11 +121,11 @@ inline void pointFieldPMG::operator=(const pointField& pts)
forAll(pts, pI) forAll(pts, pI)
this->operator[](pI) = pts[pI]; this->operator[](pI) = pts[pI];
} }
inline Ostream& operator<<(Ostream& os, const pointFieldPMG& pts) inline Ostream& operator<<(Ostream& os, const pointFieldPMG& pts)
{ {
SubList<point> p(pts, pts.nElmts_, 0); SubList<point> p(pts, pts.nElmts_, 0);
os << p; os << p;
return os; return os;
} }
@ -135,7 +135,7 @@ inline Istream& operator>>(Istream& is, pointFieldPMG& pts)
pointField& points = static_cast<pointField&>(pts); pointField& points = static_cast<pointField&>(pts);
is >> points; is >> points;
pts.nElmts_ = points.size(); pts.nElmts_ = points.size();
return is; return is;
} }

View file

@ -36,20 +36,20 @@ Foam::Ostream& Foam::operator<<
) )
{ {
os << DL.size() << nl << token::BEGIN_LIST; os << DL.size() << nl << token::BEGIN_LIST;
for(register label i=0;i<DL.size();++i) for(register label i=0;i<DL.size();++i)
{ {
os << nl << DL.sizeOfRow(i) << token::BEGIN_LIST; os << nl << DL.sizeOfRow(i) << token::BEGIN_LIST;
for(label j=0;j<DL.sizeOfRow(i);++j) for(label j=0;j<DL.sizeOfRow(i);++j)
{ {
if( j > 0 ) os << token::SPACE; if( j > 0 ) os << token::SPACE;
os << DL(i, j); os << DL(i, j);
} }
os << token::END_LIST; os << token::END_LIST;
} }
os << nl << token::END_LIST; os << nl << token::END_LIST;
return os; return os;
} }
@ -90,14 +90,14 @@ void Foam::VRWGraph::optimizeMemoryUsage()
{ {
newPosForNode[elI] = -1; newPosForNode[elI] = -1;
} }
//- create new data //- create new data
for(label elI=0;elI<nElements;++elI) for(label elI=0;elI<nElements;++elI)
if( (newPosForNode[elI] != -1) && (newPosForNode[elI] < elI) ) if( (newPosForNode[elI] != -1) && (newPosForNode[elI] < elI) )
data_[newPosForNode[elI]] = data_[elI]; data_[newPosForNode[elI]] = data_[elI];
data_.setSize(pos); data_.setSize(pos);
//- renumber rows //- renumber rows
nElements = rows_.size(); nElements = rows_.size();
for(label rowI=0;rowI<nElements;++rowI) for(label rowI=0;rowI<nElements;++rowI)

View file

@ -27,7 +27,7 @@ Class
Description Description
This class is a modifier for VRWGraph which allows for multi-threaded This class is a modifier for VRWGraph which allows for multi-threaded
execution of most time-consuimg functions execution of most time-consuimg functions
SourceFiles SourceFiles
VRWGraphSMPModifier.H VRWGraphSMPModifier.H
VRWGraphSMPModifier.C VRWGraphSMPModifier.C
@ -64,7 +64,7 @@ class VRWGraphSMPModifier
//- Disallow bitwise assignment //- Disallow bitwise assignment
void operator=(const VRWGraphSMPModifier&); void operator=(const VRWGraphSMPModifier&);
public: public:
// Constructor // Constructor
@ -81,27 +81,27 @@ public:
//- set the size and row sizes //- set the size and row sizes
template<class ListType> template<class ListType>
void setSizeAndRowSize(const ListType&); void setSizeAndRowSize(const ListType&);
//- merge graphs with the identical number of rows //- merge graphs with the identical number of rows
//- into a single one. Use for SMP parallelisation //- into a single one. Use for SMP parallelisation
void mergeGraphs(const List<VRWGraph>& graphParts); void mergeGraphs(const List<VRWGraph>& graphParts);
//- set the graph to the reverse of the original graph. //- set the graph to the reverse of the original graph.
//- the rows of such graph store the rows which contain the elements //- the rows of such graph store the rows which contain the elements
//- of the original graph //- of the original graph
template<class GraphType> template<class GraphType>
void reverseAddressing(const GraphType& origGraph); void reverseAddressing(const GraphType& origGraph);
void reverseAddressing(const VRWGraph& origGraph); void reverseAddressing(const VRWGraph& origGraph);
//- set the graph to the reverse of the original graph and mapped //- set the graph to the reverse of the original graph and mapped
//- to another space. //- to another space.
template<class ListType, class GraphType> template<class ListType, class GraphType>
void reverseAddressing(const ListType&, const GraphType&); void reverseAddressing(const ListType&, const GraphType&);
template<class ListType> template<class ListType>
void reverseAddressing(const ListType&, const VRWGraph&); void reverseAddressing(const ListType&, const VRWGraph&);
//- optimize memory usage //- optimize memory usage
// this should be used once the graph will not be resized any more // this should be used once the graph will not be resized any more
void optimizeMemoryUsage(); void optimizeMemoryUsage();

View file

@ -36,12 +36,12 @@ Foam::Ostream& Foam::operator<<
) )
{ {
os << DL.size() << nl << token::BEGIN_LIST; os << DL.size() << nl << token::BEGIN_LIST;
for(register label i=0;i<DL.size();++i) for(register label i=0;i<DL.size();++i)
{ {
os << nl << DL[i]; os << nl << DL[i];
} }
os << nl << token::END_LIST; os << nl << token::END_LIST;
return os; return os;
} }

View file

@ -51,11 +51,11 @@ namespace Foam
class VRWGraphList class VRWGraphList
{ {
// Private data // Private data
//- graph containing the data //- graph containing the data
VRWGraph data_; VRWGraph data_;
//- number of rows //- number of rows
LongList<rowElement> rows_; LongList<rowElement> rows_;
@ -67,7 +67,7 @@ class VRWGraphList
const label j, const label j,
const label k const label k
) const; ) const;
public: public:
// Constructors // Constructors
@ -88,10 +88,10 @@ public:
//- Returns the number of graphs //- Returns the number of graphs
inline label size() const; inline label size() const;
//- Returns the number of rows in the graph at that position //- Returns the number of rows in the graph at that position
inline label sizeOfGraph(const label posI) const; inline label sizeOfGraph(const label posI) const;
//- Return the number of element in the row at the given position //- Return the number of element in the row at the given position
inline label sizeOfRow(const label posI, const label rowI) const; inline label sizeOfRow(const label posI, const label rowI) const;
@ -103,7 +103,7 @@ public:
//- Append a graph at the end of the graphList //- Append a graph at the end of the graphList
template<class GraphType> template<class GraphType>
inline void appendGraph(const GraphType& l); inline void appendGraph(const GraphType& l);
//- get and set operators //- get and set operators
inline label operator() inline label operator()
( (
@ -111,11 +111,11 @@ public:
const label j, const label j,
const label k const label k
) const; ) const;
inline label& operator()(const label i, const label j, const label k); inline label& operator()(const label i, const label j, const label k);
inline const subGraph<const VRWGraph> operator[](const label i) const; inline const subGraph<const VRWGraph> operator[](const label i) const;
//- Assignment operator //- Assignment operator
inline void operator=(const VRWGraphList&); inline void operator=(const VRWGraphList&);

View file

@ -25,7 +25,7 @@ License
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline void Foam::VRWGraphList::checkIndex inline void Foam::VRWGraphList::checkIndex
@ -45,7 +45,7 @@ inline void Foam::VRWGraphList::checkIndex
<< " is not in range " << Foam::label(0) << " is not in range " << Foam::label(0)
<< " and " << rows_.size() << abort(FatalError); << " and " << rows_.size() << abort(FatalError);
} }
if( (j < 0) || (j >= rows_[i].size()) ) if( (j < 0) || (j >= rows_[i].size()) )
FatalErrorIn FatalErrorIn
( (
@ -54,7 +54,7 @@ inline void Foam::VRWGraphList::checkIndex
) << "Row index " << Foam::label(j) ) << "Row index " << Foam::label(j)
<< " is not in range " << Foam::label(0) << " is not in range " << Foam::label(0)
<< " and " << rows_[i].size() << abort(FatalError); << " and " << rows_[i].size() << abort(FatalError);
if( (k < 0) || (k >= data_.sizeOfRow(rows_[i].start()+j)) ) if( (k < 0) || (k >= data_.sizeOfRow(rows_[i].start()+j)) )
FatalErrorIn FatalErrorIn
( (
@ -125,10 +125,10 @@ inline void Foam::VRWGraphList::appendGraph
) )
{ {
rowElement re(data_.size(), l.size()); rowElement re(data_.size(), l.size());
for(label i=0;i<l.size();++i) for(label i=0;i<l.size();++i)
data_.appendList(l[i]); data_.appendList(l[i]);
rows_.append(re); rows_.append(re);
} }
@ -144,7 +144,7 @@ inline Foam::label Foam::VRWGraphList::operator()
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i, j, k); checkIndex(i, j, k);
#endif #endif
return data_(rows_[i].start() + j, k); return data_(rows_[i].start() + j, k);
} }
@ -157,7 +157,7 @@ inline Foam::label& Foam::VRWGraphList::operator()
#ifdef FULLDEBUG #ifdef FULLDEBUG
checkIndex(i, j, k); checkIndex(i, j, k);
#endif #endif
return data_(rows_[i].start() + j, k); return data_(rows_[i].start() + j, k);
} }

View file

@ -43,7 +43,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
class VRWGraph; class VRWGraph;
template<class graphType> class graphRow; template<class graphType> class graphRow;
@ -60,14 +60,14 @@ class graphRow
// Private data // Private data
//- reference to the graph //- reference to the graph
graphType& data_; graphType& data_;
//- row number //- row number
const label rowI_; const label rowI_;
// Private member functions // Private member functions
//- check index //- check index
inline void checkIndex(const label i) const; inline void checkIndex(const label i) const;
public: public:
// Constructors // Constructors
@ -94,21 +94,21 @@ public:
inline void clear(); inline void clear();
// Member Operators // Member Operators
//- Append an element to the given row //- Append an element to the given row
inline void append(const label); inline void append(const label);
//- Append an element to the given row if it does not exist there //- Append an element to the given row if it does not exist there
inline void appendIfNotIn(const label); inline void appendIfNotIn(const label);
//- check if the element is in the given row (takes linear time) //- check if the element is in the given row (takes linear time)
inline bool contains(const label e) const; inline bool contains(const label e) const;
inline label containsAtPosition(const label e) const; inline label containsAtPosition(const label e) const;
//- set and get operators //- set and get operators
inline label operator[](const label) const; inline label operator[](const label) const;
inline label& operator[](const label); inline label& operator[](const label);
//- Assignment operator //- Assignment operator
inline void operator=(const graphRow<graphType>&); inline void operator=(const graphRow<graphType>&);
template<class listType> template<class listType>

View file

@ -160,7 +160,7 @@ inline Foam::Ostream& operator<<
for(Foam::label i=0;i<r.size();++i) for(Foam::label i=0;i<r.size();++i)
os << r[i] << " "; os << r[i] << " ";
os << ")"; os << ")";
return os; return os;
} }

View file

@ -59,17 +59,17 @@ class subGraph
// Private data // Private data
//- reference to the graph //- reference to the graph
graphType& data_; graphType& data_;
//- starts at row //- starts at row
const label start_; const label start_;
//- number of rows in the subGraph //- number of rows in the subGraph
const label size_; const label size_;
// Private member functions // Private member functions
//- check index //- check index
inline void checkIndex(const label i) const; inline void checkIndex(const label i) const;
public: public:
// Constructors // Constructors
@ -93,17 +93,17 @@ public:
inline label sizeOfRow(const label rowI) const; inline label sizeOfRow(const label rowI) const;
// Member Operators // Member Operators
//- Append an element to the given row //- Append an element to the given row
inline void append(const label rowI, const label); inline void append(const label rowI, const label);
//- Append an element to the given row if it does not exist there //- Append an element to the given row if it does not exist there
inline void appendIfNotIn(const label rowI, const label); inline void appendIfNotIn(const label rowI, const label);
//- check if the element is in the given row (takes linear time) //- check if the element is in the given row (takes linear time)
inline bool contains(const label rowI, const label e) const; inline bool contains(const label rowI, const label e) const;
inline label containsAtPosition(const label rowI, const label e) const; inline label containsAtPosition(const label rowI, const label e) const;
//- set and get operators //- set and get operators
inline label operator()(const label i, const label j) const; inline label operator()(const label i, const label j) const;
inline label& operator()(const label i, const label j); inline label& operator()(const label i, const label j);

View file

@ -137,7 +137,7 @@ inline Foam::label Foam::subGraph<graphType>::operator()
# ifdef FULLDEBUG # ifdef FULLDEBUG
checkIndex(i); checkIndex(i);
# endif # endif
return data_(start_+i, j); return data_(start_+i, j);
} }
@ -183,13 +183,13 @@ inline Foam::Ostream& operator<<
for(Foam::label j=0;j<sg.sizeOfRow(i);++j) for(Foam::label j=0;j<sg.sizeOfRow(i);++j)
{ {
if( j > 0 ) os << " "; if( j > 0 ) os << " ";
os << sg(i, j); os << sg(i, j);
} }
os << ")"; os << ")";
} }
os << "\n" << ")"; os << "\n" << ")";
return os; return os;

View file

@ -57,19 +57,19 @@ void Foam::fpmaMesh::writePoints(Foam::OFstream& fpmaGeometryFile) const
const point& p = points[pointI]; const point& p = points[pointI];
fpmaGeometryFile << p.x() << ' ' << p.y() << ' ' << p.z() << ' '; fpmaGeometryFile << p.x() << ' ' << p.y() << ' ' << p.z() << ' ';
} }
fpmaGeometryFile << nl; fpmaGeometryFile << nl;
} }
void fpmaMesh::writeCells(OFstream& fpmaGeometryFile) const void fpmaMesh::writeCells(OFstream& fpmaGeometryFile) const
{ {
const cellListPMG& cells = mesh_.cells(); const cellListPMG& cells = mesh_.cells();
fpmaGeometryFile << cells.size() << nl; fpmaGeometryFile << cells.size() << nl;
forAll(cells, cellI) forAll(cells, cellI)
{ {
const cell& c = cells[cellI]; const cell& c = cells[cellI];
fpmaGeometryFile << c.size(); fpmaGeometryFile << c.size();
forAll(c, fI) forAll(c, fI)
fpmaGeometryFile << ' ' << c[fI]; fpmaGeometryFile << ' ' << c[fI];
@ -84,7 +84,7 @@ void Foam::fpmaMesh::writeFaces(OFstream& fpmaGeometryFile) const
forAll(faces, faceI) forAll(faces, faceI)
{ {
const face& f = faces[faceI]; const face& f = faces[faceI];
fpmaGeometryFile << f.size(); fpmaGeometryFile << f.size();
forAllReverse(f, pI) forAllReverse(f, pI)
fpmaGeometryFile << ' ' << f[pI]; fpmaGeometryFile << ' ' << f[pI];
@ -96,9 +96,9 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
{ {
//- write patches as face selections //- write patches as face selections
const PtrList<boundaryPatch>& patches = mesh_.boundaries(); const PtrList<boundaryPatch>& patches = mesh_.boundaries();
label nSubsets(0); label nSubsets(0);
nSubsets += patches.size(); nSubsets += patches.size();
DynList<label> indices; DynList<label> indices;
mesh_.pointSubsetIndices(indices); mesh_.pointSubsetIndices(indices);
@ -110,15 +110,15 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
mesh_.cellSubsetIndices(indices); mesh_.cellSubsetIndices(indices);
nSubsets += indices.size(); nSubsets += indices.size();
Info << "Mesh has " << indices.size() << " cell subsets" << endl; Info << "Mesh has " << indices.size() << " cell subsets" << endl;
fpmaGeometryFile << nSubsets << nl; fpmaGeometryFile << nSubsets << nl;
//- write patches as face selections //- write patches as face selections
forAll(patches, patchI) forAll(patches, patchI)
{ {
label start = patches[patchI].patchStart(); label start = patches[patchI].patchStart();
const label size = patches[patchI].patchSize(); const label size = patches[patchI].patchSize();
fpmaGeometryFile << patches[patchI].patchName() << nl; fpmaGeometryFile << patches[patchI].patchName() << nl;
fpmaGeometryFile << 3 << nl; fpmaGeometryFile << 3 << nl;
fpmaGeometryFile << size << nl; fpmaGeometryFile << size << nl;
@ -126,14 +126,14 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
fpmaGeometryFile << start++ << ' '; fpmaGeometryFile << start++ << ' ';
fpmaGeometryFile << nl; fpmaGeometryFile << nl;
} }
//- write node selections //- write node selections
mesh_.pointSubsetIndices(indices); mesh_.pointSubsetIndices(indices);
forAll(indices, indexI) forAll(indices, indexI)
{ {
labelLongList nodesInSubset; labelLongList nodesInSubset;
mesh_.pointsInSubset(indices[indexI], nodesInSubset); mesh_.pointsInSubset(indices[indexI], nodesInSubset);
fpmaGeometryFile << mesh_.pointSubsetName(indices[indexI]) << nl; fpmaGeometryFile << mesh_.pointSubsetName(indices[indexI]) << nl;
fpmaGeometryFile << 1 << nl; fpmaGeometryFile << 1 << nl;
fpmaGeometryFile << nodesInSubset.size() << nl; fpmaGeometryFile << nodesInSubset.size() << nl;
@ -141,14 +141,14 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
fpmaGeometryFile << nodesInSubset[i] << ' '; fpmaGeometryFile << nodesInSubset[i] << ' ';
fpmaGeometryFile << nl; fpmaGeometryFile << nl;
} }
//- write face selections //- write face selections
mesh_.faceSubsetIndices(indices); mesh_.faceSubsetIndices(indices);
forAll(indices, indexI) forAll(indices, indexI)
{ {
labelLongList facesInSubset; labelLongList facesInSubset;
mesh_.facesInSubset(indices[indexI], facesInSubset); mesh_.facesInSubset(indices[indexI], facesInSubset);
fpmaGeometryFile << mesh_.faceSubsetName(indices[indexI]) << nl; fpmaGeometryFile << mesh_.faceSubsetName(indices[indexI]) << nl;
fpmaGeometryFile << 3 << nl; fpmaGeometryFile << 3 << nl;
fpmaGeometryFile << facesInSubset.size() << nl; fpmaGeometryFile << facesInSubset.size() << nl;
@ -156,14 +156,14 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
fpmaGeometryFile << facesInSubset[i] << ' '; fpmaGeometryFile << facesInSubset[i] << ' ';
fpmaGeometryFile << nl; fpmaGeometryFile << nl;
} }
//- write cell selections //- write cell selections
mesh_.cellSubsetIndices(indices); mesh_.cellSubsetIndices(indices);
forAll(indices, indexI) forAll(indices, indexI)
{ {
labelLongList cellsInSubset; labelLongList cellsInSubset;
mesh_.cellsInSubset(indices[indexI], cellsInSubset); mesh_.cellsInSubset(indices[indexI], cellsInSubset);
fpmaGeometryFile << mesh_.cellSubsetName(indices[indexI]) << nl; fpmaGeometryFile << mesh_.cellSubsetName(indices[indexI]) << nl;
fpmaGeometryFile << 2 << nl; fpmaGeometryFile << 2 << nl;
fpmaGeometryFile << cellsInSubset.size() << nl; fpmaGeometryFile << cellsInSubset.size() << nl;
@ -177,7 +177,7 @@ void Foam::fpmaMesh::writeSubsets(Foam::OFstream& fpmaGeometryFile) const
void fpmaMesh::write(OFstream& fpmaGeometryFile) const void fpmaMesh::write(OFstream& fpmaGeometryFile) const
{ {
writePoints(fpmaGeometryFile); writePoints(fpmaGeometryFile);
writeFaces(fpmaGeometryFile); writeFaces(fpmaGeometryFile);
writeCells(fpmaGeometryFile); writeCells(fpmaGeometryFile);

View file

@ -60,11 +60,11 @@ class fpmaMesh
void operator=(const fpmaMesh&); void operator=(const fpmaMesh&);
void writePoints(OFstream& fpmaGeometryFile) const; void writePoints(OFstream& fpmaGeometryFile) const;
void writeFaces(OFstream& fpmaGeometryFile) const; void writeFaces(OFstream& fpmaGeometryFile) const;
void writeCells(OFstream& fpmaGeometryFile) const; void writeCells(OFstream& fpmaGeometryFile) const;
void writeSubsets(OFstream& fpmaGeometryFile) const; void writeSubsets(OFstream& fpmaGeometryFile) const;
public: public:

View file

@ -44,7 +44,7 @@ namespace Foam
{ {
class polyMeshGen; class polyMeshGen;
void writeMeshFPMA(const polyMeshGen& mesh, const word& fName); void writeMeshFPMA(const polyMeshGen& mesh, const word& fName);
void createFIRESelections(polyMeshGen& mesh); void createFIRESelections(polyMeshGen& mesh);

View file

@ -56,7 +56,7 @@ label faceDecomposition::concaveVertex() const
evn /= mag(evn); evn /= mag(evn);
const vector prod = (ev ^ evn); const vector prod = (ev ^ evn);
if( (prod & n) < -SMALL ) if( (prod & n) < -SMALL )
{ {
if( concaveVrt != -1 ) if( concaveVrt != -1 )
@ -134,7 +134,7 @@ bool faceDecomposition::isFacePlanar() const
const point c = f_.centre(points_); const point c = f_.centre(points_);
forAll(f_, pI) forAll(f_, pI)
tol = Foam::max(tol, Foam::mag(c - points_[f_[pI]])); tol = Foam::max(tol, Foam::mag(c - points_[f_[pI]]));
tol *= 0.05; tol *= 0.05;
return isFacePlanar(tol); return isFacePlanar(tol);
@ -191,7 +191,7 @@ faceList faceDecomposition::decomposeFace() const
if( il == ir - 1 ) if( il == ir - 1 )
storage.newElmt(fI++) = rf; storage.newElmt(fI++) = rf;
} }
il++; il++;
ir--; ir--;
@ -256,7 +256,7 @@ faceList faceDecomposition::decomposeFaceIntoTriangles(const label cv) const
add[0] = f_[start]; add[0] = f_[start];
add[1] = edg[i].start(); add[1] = edg[i].start();
add[2] = edg[i].end(); add[2] = edg[i].end();
fcs.newElmt(fI++) = add; fcs.newElmt(fI++) = add;
} }
@ -266,12 +266,12 @@ faceList faceDecomposition::decomposeFaceIntoTriangles(const label cv) const
Info << "face " << faceNo << " " << f_ Info << "face " << faceNo << " " << f_
<< " is decomposed into " << fcs << endl; << " is decomposed into " << fcs << endl;
# endif # endif
return fcs; return fcs;
} }
faceList fcs(1, f_); faceList fcs(1, f_);
return fcs; return fcs;
} }

View file

@ -49,14 +49,14 @@ class faceDecomposition
{ {
// private data // private data
const face& f_; const face& f_;
const pointField& points_; const pointField& points_;
// private member functions // private member functions
//- find concave vertex and return its position //- find concave vertex and return its position
//- in the face //- in the face
label concaveVertex() const; label concaveVertex() const;
//- decomposes the face into triangle starting from //- decomposes the face into triangle starting from
//- the given vertex //- the given vertex
faceList decomposeFaceIntoTriangles(const label cv) const; faceList decomposeFaceIntoTriangles(const label cv) const;
@ -91,7 +91,7 @@ public:
//- decompose face into triangles //- decompose face into triangles
faceList decomposeFaceIntoTriangles() const; faceList decomposeFaceIntoTriangles() const;
//- decompose face into the minimal number //- decompose face into the minimal number
//- of convex faces //- of convex faces
faceList decomposeFace() const; faceList decomposeFace() const;

View file

@ -47,18 +47,18 @@ namespace Foam
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class labelledMeshOctreeCubeCoordinates Declaration Class labelledMeshOctreeCubeCoordinates Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class labelledMeshOctreeCubeCoordinates class labelledMeshOctreeCubeCoordinates
{ {
// Private data // Private data
//- label //- label
label cLabel_; label cLabel_;
//- cube coordinates //- cube coordinates
meshOctreeCubeCoordinates coordinates_; meshOctreeCubeCoordinates coordinates_;
public: public:
// Constructors // Constructors
//- Null construct //- Null construct
labelledMeshOctreeCubeCoordinates() labelledMeshOctreeCubeCoordinates()
@ -66,7 +66,7 @@ class labelledMeshOctreeCubeCoordinates
cLabel_(-1), cLabel_(-1),
coordinates_() coordinates_()
{} {}
//- Construct from label and cube coordinates //- Construct from label and cube coordinates
labelledMeshOctreeCubeCoordinates labelledMeshOctreeCubeCoordinates
( (
@ -77,32 +77,32 @@ class labelledMeshOctreeCubeCoordinates
cLabel_(cl), cLabel_(cl),
coordinates_(cc) coordinates_(cc)
{} {}
// Destructor // Destructor
~labelledMeshOctreeCubeCoordinates() ~labelledMeshOctreeCubeCoordinates()
{} {}
// Member functions // Member functions
//- return cube label //- return cube label
inline label cubeLabel() const inline label cubeLabel() const
{ {
return cLabel_; return cLabel_;
} }
//- return the value //- return the value
inline const meshOctreeCubeCoordinates& coordinates() const inline const meshOctreeCubeCoordinates& coordinates() const
{ {
return coordinates_; return coordinates_;
} }
// Member operators // Member operators
inline void operator=(const labelledMeshOctreeCubeCoordinates& lcc) inline void operator=(const labelledMeshOctreeCubeCoordinates& lcc)
{ {
cLabel_ = lcc.cLabel_; cLabel_ = lcc.cLabel_;
coordinates_ = lcc.coordinates_; coordinates_ = lcc.coordinates_;
} }
inline bool operator== inline bool operator==
( (
const labelledMeshOctreeCubeCoordinates& lcc const labelledMeshOctreeCubeCoordinates& lcc
@ -110,10 +110,10 @@ class labelledMeshOctreeCubeCoordinates
{ {
if( cLabel_ == lcc.cLabel_ ) if( cLabel_ == lcc.cLabel_ )
return true; return true;
return false; return false;
} }
inline bool operator!= inline bool operator!=
( (
const labelledMeshOctreeCubeCoordinates& lcc const labelledMeshOctreeCubeCoordinates& lcc
@ -121,7 +121,7 @@ class labelledMeshOctreeCubeCoordinates
{ {
return !this->operator==(lcc); return !this->operator==(lcc);
} }
// Friend operators // Friend operators
friend Ostream& operator<< friend Ostream& operator<<
( (
@ -141,7 +141,7 @@ class labelledMeshOctreeCubeCoordinates
return os; return os;
} }
friend Istream& operator>> friend Istream& operator>>
( (
Istream& is, Istream& is,
@ -150,16 +150,16 @@ class labelledMeshOctreeCubeCoordinates
{ {
// Read beginning of labelledMeshOctreeCubeCoordinates // Read beginning of labelledMeshOctreeCubeCoordinates
is.readBegin("labelledMeshOctreeCubeCoordinates"); is.readBegin("labelledMeshOctreeCubeCoordinates");
is >> lcc.cLabel_; is >> lcc.cLabel_;
is >> lcc.coordinates_; is >> lcc.coordinates_;
// Read end of labelledMeshOctreeCubeCoordinates // Read end of labelledMeshOctreeCubeCoordinates
is.readEnd("labelledMeshOctreeCubeCoordinates"); is.readEnd("labelledMeshOctreeCubeCoordinates");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, labelledMeshOctreeCubeCoordinates"); is.check("operator>>(Istream&, labelledMeshOctreeCubeCoordinates");
return is; return is;
} }
}; };

View file

@ -47,18 +47,18 @@ namespace Foam
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class labelledPoint Declaration Class labelledPoint Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class labelledPoint class labelledPoint
{ {
// Private data // Private data
//- point label //- point label
label pLabel_; label pLabel_;
//- point coordinates //- point coordinates
point coords_; point coords_;
public: public:
// Constructors // Constructors
//- Null construct //- Null construct
labelledPoint() labelledPoint()
@ -66,62 +66,62 @@ class labelledPoint
pLabel_(-1), pLabel_(-1),
coords_(vector::zero) coords_(vector::zero)
{} {}
//- Construct from point and label //- Construct from point and label
labelledPoint(const label pl, const point& p) labelledPoint(const label pl, const point& p)
: :
pLabel_(pl), pLabel_(pl),
coords_(p) coords_(p)
{} {}
// Destructor // Destructor
~labelledPoint() ~labelledPoint()
{} {}
// Member functions // Member functions
//- return point label //- return point label
inline label pointLabel() const inline label pointLabel() const
{ {
return pLabel_; return pLabel_;
} }
inline label& pointLabel() inline label& pointLabel()
{ {
return pLabel_; return pLabel_;
} }
//- return point coordinates //- return point coordinates
inline const point& coordinates() const inline const point& coordinates() const
{ {
return coords_; return coords_;
} }
inline point& coordinates() inline point& coordinates()
{ {
return coords_; return coords_;
} }
// Member operators // Member operators
inline void operator=(const labelledPoint& lp) inline void operator=(const labelledPoint& lp)
{ {
pLabel_ = lp.pLabel_; pLabel_ = lp.pLabel_;
coords_ = lp.coords_; coords_ = lp.coords_;
} }
inline bool operator==(const labelledPoint& lp) const inline bool operator==(const labelledPoint& lp) const
{ {
if( pLabel_ == lp.pLabel_ ) if( pLabel_ == lp.pLabel_ )
return true; return true;
return false; return false;
} }
inline bool operator!=(const labelledPoint& lp) const inline bool operator!=(const labelledPoint& lp) const
{ {
return !this->operator==(lp); return !this->operator==(lp);
} }
// Friend operators // Friend operators
friend Ostream& operator<<(Ostream& os, const labelledPoint& lp) friend Ostream& operator<<(Ostream& os, const labelledPoint& lp)
{ {
@ -134,21 +134,21 @@ class labelledPoint
return os; return os;
} }
friend Istream& operator>>(Istream& is, labelledPoint& lp) friend Istream& operator>>(Istream& is, labelledPoint& lp)
{ {
// Read beginning of labelledPoint // Read beginning of labelledPoint
is.readBegin("labelledPoint"); is.readBegin("labelledPoint");
is >> lp.pLabel_; is >> lp.pLabel_;
is >> lp.coords_; is >> lp.coords_;
// Read end of labelledPoint // Read end of labelledPoint
is.readEnd("labelledPoint"); is.readEnd("labelledPoint");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, labelledPoint"); is.check("operator>>(Istream&, labelledPoint");
return is; return is;
} }
}; };

View file

@ -46,18 +46,18 @@ namespace Foam
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class refLabelledPoint Declaration Class refLabelledPoint Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class refLabelledPoint class refLabelledPoint
{ {
// Private data // Private data
//- label of the object it is associated to //- label of the object it is associated to
label objectLabel_; label objectLabel_;
//- point to be transferred //- point to be transferred
labelledPoint p_; labelledPoint p_;
public: public:
// Constructors // Constructors
//- Null construct //- Null construct
refLabelledPoint() refLabelledPoint()
@ -65,52 +65,52 @@ class refLabelledPoint
objectLabel_(-1), objectLabel_(-1),
p_() p_()
{} {}
//- Construct from label and labelledPoint //- Construct from label and labelledPoint
refLabelledPoint(const label pl, const labelledPoint& p) refLabelledPoint(const label pl, const labelledPoint& p)
: :
objectLabel_(pl), objectLabel_(pl),
p_(p) p_(p)
{} {}
// Destructor // Destructor
~refLabelledPoint() ~refLabelledPoint()
{} {}
// Member functions // Member functions
//- return label of the object it is associated to //- return label of the object it is associated to
inline label objectLabel() const inline label objectLabel() const
{ {
return objectLabel_; return objectLabel_;
} }
//- return labelledPoint //- return labelledPoint
inline const labelledPoint& lPoint() const inline const labelledPoint& lPoint() const
{ {
return p_; return p_;
} }
// Member operators // Member operators
inline void operator=(const refLabelledPoint& lp) inline void operator=(const refLabelledPoint& lp)
{ {
objectLabel_ = lp.objectLabel_; objectLabel_ = lp.objectLabel_;
p_ = lp.p_; p_ = lp.p_;
} }
inline bool operator==(const refLabelledPoint& lp) const inline bool operator==(const refLabelledPoint& lp) const
{ {
if( objectLabel_ == lp.objectLabel_ ) if( objectLabel_ == lp.objectLabel_ )
return true; return true;
return false; return false;
} }
inline bool operator!=(const refLabelledPoint& lp) const inline bool operator!=(const refLabelledPoint& lp) const
{ {
return !this->operator==(lp); return !this->operator==(lp);
} }
// Friend operators // Friend operators
friend Ostream& operator<<(Ostream& os, const refLabelledPoint& lp) friend Ostream& operator<<(Ostream& os, const refLabelledPoint& lp)
{ {
@ -123,21 +123,21 @@ class refLabelledPoint
return os; return os;
} }
friend Istream& operator>>(Istream& is, refLabelledPoint& lp) friend Istream& operator>>(Istream& is, refLabelledPoint& lp)
{ {
// Read beginning of refLabelledPoint // Read beginning of refLabelledPoint
is.readBegin("refLabelledPoint"); is.readBegin("refLabelledPoint");
is >> lp.objectLabel_; is >> lp.objectLabel_;
is >> lp.p_; is >> lp.p_;
// Read end of refLabelledPoint // Read end of refLabelledPoint
is.readEnd("refLabelledPoint"); is.readEnd("refLabelledPoint");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, refLabelledPoint"); is.check("operator>>(Istream&, refLabelledPoint");
return is; return is;
} }
}; };

View file

@ -47,21 +47,21 @@ namespace Foam
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class labelledPointScalar Declaration Class labelledPointScalar Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class labelledPointScalar class labelledPointScalar
{ {
// Private data // Private data
//- point label //- point label
label pLabel_; label pLabel_;
//- point coordinates //- point coordinates
point coords_; point coords_;
//- scalar data //- scalar data
scalar weight_; scalar weight_;
public: public:
// Constructors // Constructors
//- Null construct //- Null construct
labelledPointScalar() labelledPointScalar()
@ -70,7 +70,7 @@ class labelledPointScalar
coords_(vector::zero), coords_(vector::zero),
weight_(0.0) weight_(0.0)
{} {}
//- Construct from point and label //- Construct from point and label
labelledPointScalar(const label pl, const point& p, const scalar s) labelledPointScalar(const label pl, const point& p, const scalar s)
: :
@ -78,67 +78,67 @@ class labelledPointScalar
coords_(p), coords_(p),
weight_(s) weight_(s)
{} {}
// Destructor // Destructor
~labelledPointScalar() ~labelledPointScalar()
{} {}
// Member functions // Member functions
//- return point label //- return point label
inline label pointLabel() const inline label pointLabel() const
{ {
return pLabel_; return pLabel_;
} }
inline label& pointLabel() inline label& pointLabel()
{ {
return pLabel_; return pLabel_;
} }
//- return point coordinates //- return point coordinates
inline const point& coordinates() const inline const point& coordinates() const
{ {
return coords_; return coords_;
} }
inline point& coordinates() inline point& coordinates()
{ {
return coords_; return coords_;
} }
//- return scalar value //- return scalar value
inline const scalar& scalarValue() const inline const scalar& scalarValue() const
{ {
return weight_; return weight_;
} }
inline scalar& scalarValue() inline scalar& scalarValue()
{ {
return weight_; return weight_;
} }
// Member operators // Member operators
inline void operator=(const labelledPointScalar& lps) inline void operator=(const labelledPointScalar& lps)
{ {
pLabel_ = lps.pLabel_; pLabel_ = lps.pLabel_;
coords_ = lps.coords_; coords_ = lps.coords_;
weight_ = lps.weight_; weight_ = lps.weight_;
} }
inline bool operator==(const labelledPointScalar& lps) const inline bool operator==(const labelledPointScalar& lps) const
{ {
if( pLabel_ == lps.pLabel_ ) if( pLabel_ == lps.pLabel_ )
return true; return true;
return false; return false;
} }
inline bool operator!=(const labelledPointScalar& lps) const inline bool operator!=(const labelledPointScalar& lps) const
{ {
return !this->operator==(lps); return !this->operator==(lps);
} }
// Friend operators // Friend operators
friend Ostream& operator<<(Ostream& os, const labelledPointScalar& lps) friend Ostream& operator<<(Ostream& os, const labelledPointScalar& lps)
{ {
@ -152,22 +152,22 @@ class labelledPointScalar
return os; return os;
} }
friend Istream& operator>>(Istream& is, labelledPointScalar& lps) friend Istream& operator>>(Istream& is, labelledPointScalar& lps)
{ {
// Read beginning of labelledPointScalar // Read beginning of labelledPointScalar
is.readBegin("labelledPointScalar"); is.readBegin("labelledPointScalar");
is >> lps.pLabel_; is >> lps.pLabel_;
is >> lps.coords_; is >> lps.coords_;
is >> lps.weight_; is >> lps.weight_;
// Read end of labelledPointScalar // Read end of labelledPointScalar
is.readEnd("labelledPointScalar"); is.readEnd("labelledPointScalar");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, labelledPointScalar"); is.check("operator>>(Istream&, labelledPointScalar");
return is; return is;
} }
}; };

View file

@ -46,19 +46,19 @@ namespace Foam
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class parPartTet Declaration Class parPartTet Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class parPartTet class parPartTet
{ {
// Private data // Private data
labelledPoint pts_[4]; labelledPoint pts_[4];
public: public:
// Constructors // Constructors
inline parPartTet() inline parPartTet()
{} {}
explicit inline parPartTet explicit inline parPartTet
( (
const labelledPoint& p0, const labelledPoint& p0,
@ -72,31 +72,31 @@ public:
pts_[2] = p2; pts_[2] = p2;
pts_[3] = p3; pts_[3] = p3;
} }
// Destructor // Destructor
~parPartTet() ~parPartTet()
{} {}
// Member functions // Member functions
// Member operators // Member operators
inline const labelledPoint& operator[](const label i) const inline const labelledPoint& operator[](const label i) const
{ {
return pts_[i]; return pts_[i];
} }
inline bool operator !=(const parPartTet& ptf) const inline bool operator !=(const parPartTet& ptf) const
{ {
Serr << "Not implemented" << endl; Serr << "Not implemented" << endl;
::exit(1); ::exit(1);
return true; return true;
} }
// Friend operators // Friend operators
inline friend Ostream& operator<<(Ostream& os, const parPartTet& ppt) inline friend Ostream& operator<<(Ostream& os, const parPartTet& ppt)
{ {
os << token::BEGIN_LIST; os << token::BEGIN_LIST;
@ -110,21 +110,21 @@ public:
os.check("operator<<(Ostream&, const parPartTet&"); os.check("operator<<(Ostream&, const parPartTet&");
return os; return os;
} }
inline friend Istream& operator>>(Istream& is, parPartTet& ppt) inline friend Istream& operator>>(Istream& is, parPartTet& ppt)
{ {
// Read beginning of parPartTet // Read beginning of parPartTet
is.readBegin("parPartTet"); is.readBegin("parPartTet");
for(label i=0;i<4;++i) for(label i=0;i<4;++i)
is >> ppt.pts_[i]; is >> ppt.pts_[i];
// Read end of parHelper // Read end of parHelper
is.readEnd("parPartTet"); is.readEnd("parPartTet");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, parPartTet"); is.check("operator>>(Istream&, parPartTet");
return is; return is;
} }
}; };

View file

@ -52,41 +52,41 @@ class sortEdgesIntoChains
{ {
// Members // Members
const DynList<edge>& bEdges_; const DynList<edge>& bEdges_;
bool openEdges_; bool openEdges_;
Map<label> newNodeLabel_; Map<label> newNodeLabel_;
List<DynList<label> > edgesAtPoint_; List<DynList<label> > edgesAtPoint_;
DynList<labelList> createdChains_; DynList<labelList> createdChains_;
// Private member functions // Private member functions
void createNodeLabels(); void createNodeLabels();
bool findPointsBelongingToTheChain bool findPointsBelongingToTheChain
( (
const label currPos, const label currPos,
boolList& chainEdges boolList& chainEdges
) const; ) const;
void shrinkEdges(const boolList& chainEdges); void shrinkEdges(const boolList& chainEdges);
void createChainFromEdges(const boolList& chainEdges); void createChainFromEdges(const boolList& chainEdges);
void sortEdges(); void sortEdges();
public: public:
sortEdgesIntoChains sortEdgesIntoChains
( (
const DynList<edge>& bEdges const DynList<edge>& bEdges
); );
~sortEdgesIntoChains(); ~sortEdgesIntoChains();
// Member functions // Member functions
//- a list of points which have not yet been resolved //- a list of points which have not yet been resolved
const DynList<labelList>& sortedChains() const; const DynList<labelList>& sortedChains() const;
}; };

View file

@ -43,7 +43,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace help namespace help
{ {

View file

@ -46,7 +46,7 @@ scalar textToScalar(const word& w)
{ {
std::stringstream ss; std::stringstream ss;
ss << w; ss << w;
double s; double s;
ss >> s; ss >> s;
return s; return s;
@ -62,7 +62,7 @@ word scalarToText(const scalar s)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << s; ss << s;
return ss.str(); return ss.str();
} }
@ -70,7 +70,7 @@ word labelToText(const label l)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << l; ss << l;
return ss.str(); return ss.str();
} }

View file

@ -52,13 +52,13 @@ namespace help
//- convert the text to scalar //- convert the text to scalar
scalar textToScalar(const word& w); scalar textToScalar(const word& w);
//- convert the text to label //- convert the text to label
label textToLabel(const word& w); label textToLabel(const word& w);
//- convert the scalar value into text //- convert the scalar value into text
word scalarToText(const scalar s); word scalarToText(const scalar s);
//- convert the integer value into text //- convert the integer value into text
word labelToText(const label l); word labelToText(const label l);

View file

@ -40,7 +40,7 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void partTetMesh::createParallelAddressing void partTetMesh::createParallelAddressing
@ -52,27 +52,27 @@ void partTetMesh::createParallelAddressing
{ {
//- vertices marked as SMOOTH and BOUNDARY are used by the smoother //- vertices marked as SMOOTH and BOUNDARY are used by the smoother
const direction useType = SMOOTH + BOUNDARY; const direction useType = SMOOTH + BOUNDARY;
//- allocate global point labels //- allocate global point labels
if( !globalPointLabelPtr_ ) if( !globalPointLabelPtr_ )
globalPointLabelPtr_ = new labelLongList(); globalPointLabelPtr_ = new labelLongList();
labelLongList& globalTetPointLabel = *globalPointLabelPtr_; labelLongList& globalTetPointLabel = *globalPointLabelPtr_;
globalTetPointLabel.setSize(points_.size()); globalTetPointLabel.setSize(points_.size());
globalTetPointLabel = -1; globalTetPointLabel = -1;
//- allocated point-processors addressing //- allocated point-processors addressing
if( !pAtProcsPtr_ ) if( !pAtProcsPtr_ )
pAtProcsPtr_ = new VRWGraph(); pAtProcsPtr_ = new VRWGraph();
VRWGraph& pProcs = *pAtProcsPtr_; VRWGraph& pProcs = *pAtProcsPtr_;
pProcs.setSize(0); pProcs.setSize(0);
pProcs.setSize(points_.size()); pProcs.setSize(points_.size());
//- allocate global-to-local point addressing //- allocate global-to-local point addressing
if( !globalToLocalPointAddressingPtr_ ) if( !globalToLocalPointAddressingPtr_ )
globalToLocalPointAddressingPtr_ = new Map<label>(); globalToLocalPointAddressingPtr_ = new Map<label>();
Map<label>& globalToLocal = *globalToLocalPointAddressingPtr_; Map<label>& globalToLocal = *globalToLocalPointAddressingPtr_;
globalToLocal.clear(); globalToLocal.clear();
//- allocate storage for points at parallel boundaries //- allocate storage for points at parallel boundaries
if( !pAtParallelBoundariesPtr_ ) if( !pAtParallelBoundariesPtr_ )
pAtParallelBoundariesPtr_ = new labelLongList(); pAtParallelBoundariesPtr_ = new labelLongList();
@ -82,23 +82,23 @@ void partTetMesh::createParallelAddressing
//- create point-processors addressing //- create point-processors addressing
std::map<label, labelLongList> exchangeData; std::map<label, labelLongList> exchangeData;
std::map<label, labelLongList>::iterator iter; std::map<label, labelLongList>::iterator iter;
const polyMeshGenAddressing& addressing = origMesh_.addressingData(); const polyMeshGenAddressing& addressing = origMesh_.addressingData();
const Map<label>& globalToLocalPointAddressing = const Map<label>& globalToLocalPointAddressing =
addressing.globalToLocalPointAddressing(); addressing.globalToLocalPointAddressing();
const VRWGraph& pAtProcs = addressing.pointAtProcs(); const VRWGraph& pAtProcs = addressing.pointAtProcs();
const DynList<label>& pNeiProcs = addressing.pointNeiProcs(); const DynList<label>& pNeiProcs = addressing.pointNeiProcs();
forAll(pNeiProcs, procI) forAll(pNeiProcs, procI)
exchangeData.insert(std::make_pair(pNeiProcs[procI], labelLongList())); exchangeData.insert(std::make_pair(pNeiProcs[procI], labelLongList()));
//- make sure that the same vertices are marked for smoothing on all procs //- make sure that the same vertices are marked for smoothing on all procs
//- this is performed by sending the labels of vertices which are not used //- this is performed by sending the labels of vertices which are not used
//- for tet mesh creation and the tet mesh vertices which are not moved //- for tet mesh creation and the tet mesh vertices which are not moved
forAllConstIter(Map<label>, globalToLocalPointAddressing, it) forAllConstIter(Map<label>, globalToLocalPointAddressing, it)
{ {
const label pI = it(); const label pI = it();
if( if(
nodeLabelForPoint[pI] == -1 || nodeLabelForPoint[pI] == -1 ||
!smoothVertex_[nodeLabelForPoint[pI]] !smoothVertex_[nodeLabelForPoint[pI]]
@ -109,12 +109,12 @@ void partTetMesh::createParallelAddressing
const label neiProc = pAtProcs(pI, procI); const label neiProc = pAtProcs(pI, procI);
if( neiProc == Pstream::myProcNo() ) if( neiProc == Pstream::myProcNo() )
continue; continue;
exchangeData[neiProc].append(it.key()); exchangeData[neiProc].append(it.key());
} }
} }
} }
//- exchange data with other processors //- exchange data with other processors
labelLongList receivedData; labelLongList receivedData;
help::exchangeMap(exchangeData, receivedData); help::exchangeMap(exchangeData, receivedData);
@ -123,62 +123,62 @@ void partTetMesh::createParallelAddressing
forAll(receivedData, i) forAll(receivedData, i)
{ {
const label pointI = globalToLocalPointAddressing[receivedData[i]]; const label pointI = globalToLocalPointAddressing[receivedData[i]];
if( nodeLabelForPoint[pointI] == -1 ) if( nodeLabelForPoint[pointI] == -1 )
continue; continue;
smoothVertex_[nodeLabelForPoint[pointI]] = NONE; smoothVertex_[nodeLabelForPoint[pointI]] = NONE;
} }
for(iter=exchangeData.begin();iter!=exchangeData.end();++iter) for(iter=exchangeData.begin();iter!=exchangeData.end();++iter)
iter->second.clear(); iter->second.clear();
//- start creating global-to-local addressing //- start creating global-to-local addressing
//- find the starting point labels //- find the starting point labels
label startPoint(0), nLocalPoints(0), nSharedPoints(0); label startPoint(0), nLocalPoints(0), nSharedPoints(0);
//- count the number of points at processor boundaries //- count the number of points at processor boundaries
forAllConstIter(Map<label>, globalToLocalPointAddressing, it) forAllConstIter(Map<label>, globalToLocalPointAddressing, it)
{ {
const label pI = it(); const label pI = it();
if( nodeLabelForPoint[pI] == -1 ) if( nodeLabelForPoint[pI] == -1 )
continue; continue;
if( !(smoothVertex_[nodeLabelForPoint[pI]] & useType) ) if( !(smoothVertex_[nodeLabelForPoint[pI]] & useType) )
continue; continue;
++nSharedPoints; ++nSharedPoints;
label pMin(Pstream::myProcNo()); label pMin(Pstream::myProcNo());
forAllRow(pAtProcs, pI, procI) forAllRow(pAtProcs, pI, procI)
pMin = Foam::min(pMin, pAtProcs(pI, procI)); pMin = Foam::min(pMin, pAtProcs(pI, procI));
if( pMin == Pstream::myProcNo() ) if( pMin == Pstream::myProcNo() )
++nLocalPoints; ++nLocalPoints;
} }
labelList nPointsAtProc(Pstream::nProcs()); labelList nPointsAtProc(Pstream::nProcs());
nSharedPoints -= nLocalPoints; nSharedPoints -= nLocalPoints;
nPointsAtProc[Pstream::myProcNo()] = points_.size() - nSharedPoints; nPointsAtProc[Pstream::myProcNo()] = points_.size() - nSharedPoints;
Pstream::gatherList(nPointsAtProc); Pstream::gatherList(nPointsAtProc);
Pstream::scatterList(nPointsAtProc); Pstream::scatterList(nPointsAtProc);
for(label i=0;i<Pstream::myProcNo();++i) for(label i=0;i<Pstream::myProcNo();++i)
startPoint += nPointsAtProc[i]; startPoint += nPointsAtProc[i];
//- create global labels for points at processor boundaries //- create global labels for points at processor boundaries
forAllConstIter(Map<label>, globalToLocalPointAddressing, it) forAllConstIter(Map<label>, globalToLocalPointAddressing, it)
{ {
const label pI = it(); const label pI = it();
if( nodeLabelForPoint[pI] == -1 ) if( nodeLabelForPoint[pI] == -1 )
continue; continue;
const label pLabel = nodeLabelForPoint[pI]; const label pLabel = nodeLabelForPoint[pI];
if( !(smoothVertex_[pLabel] & useType) ) if( !(smoothVertex_[pLabel] & useType) )
continue; continue;
label pMin(Pstream::myProcNo()); label pMin(Pstream::myProcNo());
forAllRow(pAtProcs, pI, procI) forAllRow(pAtProcs, pI, procI)
{ {
@ -186,19 +186,19 @@ void partTetMesh::createParallelAddressing
pProcs.append(pLabel, neiProc); pProcs.append(pLabel, neiProc);
pMin = Foam::min(pMin, neiProc); pMin = Foam::min(pMin, neiProc);
} }
if( pMin != Pstream::myProcNo() ) if( pMin != Pstream::myProcNo() )
continue; continue;
globalTetPointLabel[pLabel] = startPoint++; globalTetPointLabel[pLabel] = startPoint++;
forAllRow(pAtProcs, pI, procI) forAllRow(pAtProcs, pI, procI)
{ {
const label neiProc = pAtProcs(pI, procI); const label neiProc = pAtProcs(pI, procI);
if( neiProc == Pstream::myProcNo() ) if( neiProc == Pstream::myProcNo() )
continue; continue;
//- the following information is sent to other processor //- the following information is sent to other processor
//- 1. global point label in the original mesh //- 1. global point label in the original mesh
//- 2. global point label in the tet mesh //- 2. global point label in the tet mesh
@ -210,7 +210,7 @@ void partTetMesh::createParallelAddressing
//- exchange data with other processors //- exchange data with other processors
receivedData.clear(); receivedData.clear();
help::exchangeMap(exchangeData, receivedData); help::exchangeMap(exchangeData, receivedData);
label counter(0); label counter(0);
while( counter < receivedData.size() ) while( counter < receivedData.size() )
{ {
@ -218,17 +218,17 @@ void partTetMesh::createParallelAddressing
const label tgI = receivedData[counter++]; const label tgI = receivedData[counter++];
const label pLabel = const label pLabel =
nodeLabelForPoint[globalToLocalPointAddressing[gpI]]; nodeLabelForPoint[globalToLocalPointAddressing[gpI]];
globalTetPointLabel[pLabel] = tgI; globalTetPointLabel[pLabel] = tgI;
} }
//- set global labels for remaining points //- set global labels for remaining points
forAll(globalTetPointLabel, pI) forAll(globalTetPointLabel, pI)
{ {
if( globalTetPointLabel[pI] == -1 ) if( globalTetPointLabel[pI] == -1 )
globalTetPointLabel[pI] = startPoint++; globalTetPointLabel[pI] = startPoint++;
} }
//- create global to local mapping //- create global to local mapping
forAll(globalTetPointLabel, pI) forAll(globalTetPointLabel, pI)
{ {
@ -238,20 +238,20 @@ void partTetMesh::createParallelAddressing
globalToLocal.insert(globalTetPointLabel[pI], pI); globalToLocal.insert(globalTetPointLabel[pI], pI);
} }
} }
//- mark vertices at parallel boundaries //- mark vertices at parallel boundaries
forAll(smoothVertex_, pI) forAll(smoothVertex_, pI)
if( (smoothVertex_[pI] & useType) && (pProcs.sizeOfRow(pI) != 0) ) if( (smoothVertex_[pI] & useType) && (pProcs.sizeOfRow(pI) != 0) )
smoothVertex_[pI] |= PARALLELBOUNDARY; smoothVertex_[pI] |= PARALLELBOUNDARY;
//- create neighbour processors addressing //- create neighbour processors addressing
if( !neiProcsPtr_ ) if( !neiProcsPtr_ )
neiProcsPtr_ = new DynList<label>(); neiProcsPtr_ = new DynList<label>();
DynList<label>& neiProcs = *neiProcsPtr_; DynList<label>& neiProcs = *neiProcsPtr_;
for(iter=exchangeData.begin();iter!=exchangeData.end();++iter) for(iter=exchangeData.begin();iter!=exchangeData.end();++iter)
neiProcs.append(iter->first); neiProcs.append(iter->first);
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
for(label i=0;i<Pstream::nProcs();++i) for(label i=0;i<Pstream::nProcs();++i)
{ {
@ -259,21 +259,21 @@ void partTetMesh::createParallelAddressing
{ {
Pout << "globalTetPointLabel " << globalTetPointLabel << endl; Pout << "globalTetPointLabel " << globalTetPointLabel << endl;
} }
returnReduce(i, sumOp<label>()); returnReduce(i, sumOp<label>());
} }
returnReduce(1, sumOp<label>()); returnReduce(1, sumOp<label>());
forAll(nodeLabelForPoint, pI) forAll(nodeLabelForPoint, pI)
{ {
const label tpI = nodeLabelForPoint[pI]; const label tpI = nodeLabelForPoint[pI];
if( tpI != -1 && globalTetPointLabel[tpI] == -1 ) if( tpI != -1 && globalTetPointLabel[tpI] == -1 )
FatalError << "Crap1 " << tpI << abort(FatalError); FatalError << "Crap1 " << tpI << abort(FatalError);
} }
returnReduce(1, sumOp<label>()); returnReduce(1, sumOp<label>());
forAll(nodeLabelForFace, fI) forAll(nodeLabelForFace, fI)
{ {
const label tpI = nodeLabelForFace[fI]; const label tpI = nodeLabelForFace[fI];
@ -284,33 +284,33 @@ void partTetMesh::createParallelAddressing
FatalError << "Crap2" << tpI << abort(FatalError); FatalError << "Crap2" << tpI << abort(FatalError);
} }
} }
returnReduce(1, sumOp<label>()); returnReduce(1, sumOp<label>());
forAll(nodeLabelForCell, cI) forAll(nodeLabelForCell, cI)
{ {
const label tpI = nodeLabelForCell[cI]; const label tpI = nodeLabelForCell[cI];
if( tpI != -1 && globalTetPointLabel[tpI] == -1 ) if( tpI != -1 && globalTetPointLabel[tpI] == -1 )
FatalError << "Crap3" << tpI << abort(FatalError); FatalError << "Crap3" << tpI << abort(FatalError);
} }
forAll(smoothVertex_, vI) forAll(smoothVertex_, vI)
if( smoothVertex_[vI] & partTetMesh::PARALLELBOUNDARY ) if( smoothVertex_[vI] & partTetMesh::PARALLELBOUNDARY )
Pout << "Point " << globalTetPointLabel[vI] Pout << "Point " << globalTetPointLabel[vI]
<< " is at par bnd" << endl; << " is at par bnd" << endl;
Serr << Pstream::myProcNo() << "points " << points_ << endl; Serr << Pstream::myProcNo() << "points " << points_ << endl;
Serr << Pstream::myProcNo() << "Tets " << tets_ << endl; Serr << Pstream::myProcNo() << "Tets " << tets_ << endl;
forAll(pProcs, pI) forAll(pProcs, pI)
{ {
if( pProcs.sizeOfRow(pI) == 0 ) if( pProcs.sizeOfRow(pI) == 0 )
continue; continue;
Serr << Pstream::myProcNo() << "Point " << globalTetPointLabel[pI] Serr << Pstream::myProcNo() << "Point " << globalTetPointLabel[pI]
<< " is at procs " << pProcs[pI] << " n tets " << " is at procs " << pProcs[pI] << " n tets "
<< pointTets_[pI].size() << endl; << pointTets_[pI].size() << endl;
} }
returnReduce(1, sumOp<label>()); returnReduce(1, sumOp<label>());
# endif # endif
} }
@ -321,12 +321,12 @@ void partTetMesh::createBufferLayers()
labelLongList& globalTetPointLabel = *globalPointLabelPtr_; labelLongList& globalTetPointLabel = *globalPointLabelPtr_;
Map<label>& globalToLocal = *globalToLocalPointAddressingPtr_; Map<label>& globalToLocal = *globalToLocalPointAddressingPtr_;
const DynList<label>& neiProcs = *this->neiProcsPtr_; const DynList<label>& neiProcs = *this->neiProcsPtr_;
if( !pAtBufferLayersPtr_ ) if( !pAtBufferLayersPtr_ )
pAtBufferLayersPtr_ = new labelLongList(); pAtBufferLayersPtr_ = new labelLongList();
labelLongList& pAtBufferLayers = *pAtBufferLayersPtr_; labelLongList& pAtBufferLayers = *pAtBufferLayersPtr_;
pAtBufferLayers.clear(); pAtBufferLayers.clear();
//- create the map //- create the map
std::map<label, LongList<parPartTet> > exchangeTets; std::map<label, LongList<parPartTet> > exchangeTets;
forAll(neiProcs, procI) forAll(neiProcs, procI)
@ -334,32 +334,32 @@ void partTetMesh::createBufferLayers()
( (
std::make_pair(neiProcs[procI], LongList<parPartTet>()) std::make_pair(neiProcs[procI], LongList<parPartTet>())
); );
//- go through the tets and add the ones having vertices at parallel //- go through the tets and add the ones having vertices at parallel
//- boundaries for sending //- boundaries for sending
forAll(tets_, tetI) forAll(tets_, tetI)
{ {
const partTet& pt = tets_[tetI]; const partTet& pt = tets_[tetI];
DynList<label> sendToProcs; DynList<label> sendToProcs;
forAll(pt, i) forAll(pt, i)
{ {
const label pLabel = pt[i]; const label pLabel = pt[i];
if( smoothVertex_[pLabel] & PARALLELBOUNDARY ) if( smoothVertex_[pLabel] & PARALLELBOUNDARY )
{ {
forAllRow(pProcs, pLabel, i) forAllRow(pProcs, pLabel, i)
{ {
const label neiProc = pProcs(pLabel, i); const label neiProc = pProcs(pLabel, i);
if( neiProc == Pstream::myProcNo() ) if( neiProc == Pstream::myProcNo() )
continue; continue;
sendToProcs.appendIfNotIn(neiProc); sendToProcs.appendIfNotIn(neiProc);
} }
} }
} }
if( sendToProcs.size() ) if( sendToProcs.size() )
{ {
const parPartTet tet const parPartTet tet
@ -369,36 +369,36 @@ void partTetMesh::createBufferLayers()
labelledPoint(globalTetPointLabel[pt[2]], points_[pt[2]]), labelledPoint(globalTetPointLabel[pt[2]], points_[pt[2]]),
labelledPoint(globalTetPointLabel[pt[3]], points_[pt[3]]) labelledPoint(globalTetPointLabel[pt[3]], points_[pt[3]])
); );
forAll(sendToProcs, i) forAll(sendToProcs, i)
{ {
exchangeTets[sendToProcs[i]].append(tet); exchangeTets[sendToProcs[i]].append(tet);
forAll(pt, j) forAll(pt, j)
{ {
if( pProcs.sizeOfRow(pt[j]) == 0 ) if( pProcs.sizeOfRow(pt[j]) == 0 )
pAtBufferLayers.append(pt[j]); pAtBufferLayers.append(pt[j]);
pProcs.appendIfNotIn(pt[j], sendToProcs[i]); pProcs.appendIfNotIn(pt[j], sendToProcs[i]);
} }
} }
} }
} }
LongList<parPartTet> receivedTets; LongList<parPartTet> receivedTets;
help::exchangeMap(exchangeTets, receivedTets); help::exchangeMap(exchangeTets, receivedTets);
exchangeTets.clear(); exchangeTets.clear();
Map<label> newGlobalToLocal; Map<label> newGlobalToLocal;
forAll(receivedTets, i) forAll(receivedTets, i)
{ {
const parPartTet& tet = receivedTets[i]; const parPartTet& tet = receivedTets[i];
DynList<label> tetPointLabels; DynList<label> tetPointLabels;
for(label j=0;j<4;++j) for(label j=0;j<4;++j)
{ {
const label gpI = tet[j].pointLabel(); const label gpI = tet[j].pointLabel();
if( globalToLocal.found(gpI) ) if( globalToLocal.found(gpI) )
{ {
const label pI = globalToLocal[gpI]; const label pI = globalToLocal[gpI];
@ -419,13 +419,13 @@ void partTetMesh::createBufferLayers()
DynList<label> helper; DynList<label> helper;
helper.append(tets_.size()); helper.append(tets_.size());
pointTets_.appendList(helper); pointTets_.appendList(helper);
globalTetPointLabel.append(gpI); globalTetPointLabel.append(gpI);
helper[0] = Pstream::myProcNo(); helper[0] = Pstream::myProcNo();
pProcs.appendList(helper); pProcs.appendList(helper);
} }
} }
//- append tet //- append tet
tets_.append tets_.append
( (
@ -438,7 +438,7 @@ void partTetMesh::createBufferLayers()
) )
); );
} }
//- insert the global labels of the buffer points //- insert the global labels of the buffer points
//- into the globalToLocal map //- into the globalToLocal map
forAllConstIter(Map<label>, newGlobalToLocal, it) forAllConstIter(Map<label>, newGlobalToLocal, it)
@ -455,13 +455,13 @@ void partTetMesh::createBufferLayers()
if( it() < pProcs.size() ) if( it() < pProcs.size() )
forAllRow(pProcs, it(), j) forAllRow(pProcs, it(), j)
np.append(pProcs(it(), j)); np.append(pProcs(it(), j));
Pout << "Tet mesh point " << it() << " has global label " Pout << "Tet mesh point " << it() << " has global label "
<< it.key() << " and is located at procs " << it.key() << " and is located at procs "
<< np << endl; << np << endl;
} }
} }
returnReduce(1, sumOp<label>()); returnReduce(1, sumOp<label>());
} }
# endif # endif

View file

@ -49,7 +49,7 @@ partTetMeshSimplex::partTetMeshSimplex
const LongList<point>& points = tm.points(); const LongList<point>& points = tm.points();
const LongList<partTet>& tets = tm.tets(); const LongList<partTet>& tets = tm.tets();
const VRWGraph& pt = tm.pointTets(); const VRWGraph& pt = tm.pointTets();
tets_.setSize(pt.sizeOfRow(pI)); tets_.setSize(pt.sizeOfRow(pI));
label counter(0); label counter(0);
@ -67,11 +67,11 @@ partTetMeshSimplex::partTetMeshSimplex
++counter; ++counter;
} }
} }
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "Tet " << tetI << " is " << tet << endl; Info << "Tet " << tetI << " is " << tet << endl;
# endif # endif
const label pos = tet.whichPosition(pI); const label pos = tet.whichPosition(pI);
switch( pos ) switch( pos )
{ {
@ -143,12 +143,12 @@ partTetMeshSimplex::partTetMeshSimplex
{ {
tets_.setSize(pt.size()); tets_.setSize(pt.size());
label pI(0); label pI(0);
Map<label> addr; Map<label> addr;
forAll(pt, tetI) forAll(pt, tetI)
{ {
const parPartTet& tet = pt[tetI]; const parPartTet& tet = pt[tetI];
label pos(-1); label pos(-1);
for(label i=0;i<4;++i) for(label i=0;i<4;++i)
{ {
@ -158,11 +158,11 @@ partTetMeshSimplex::partTetMeshSimplex
pts_.append(tet[i].coordinates()); pts_.append(tet[i].coordinates());
++pI; ++pI;
} }
if( tet[i].pointLabel() == gpI ) if( tet[i].pointLabel() == gpI )
pos = i; pos = i;
} }
switch( pos ) switch( pos )
{ {
case 0: case 0:
@ -299,7 +299,7 @@ partTetMeshSimplex::partTetMeshSimplex
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
partTetMeshSimplex::~partTetMeshSimplex() partTetMeshSimplex::~partTetMeshSimplex()
{} {}

View file

@ -26,9 +26,9 @@ Class
Description Description
A simplex which is used for smoothing purposes A simplex which is used for smoothing purposes
SourceFiles SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -42,7 +42,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward declarations
class partTetMesh; class partTetMesh;
@ -55,16 +55,16 @@ class partTetMeshSimplex
// Private data // Private data
//- points making the simplex //- points making the simplex
DynList<point, 128> pts_; DynList<point, 128> pts_;
//- tets making the simplex //- tets making the simplex
DynList<partTet, 128> tets_; DynList<partTet, 128> tets_;
public: public:
// Constructors // Constructors
//- Construct from partTetMeshSimplex and point label //- Construct from partTetMeshSimplex and point label
partTetMeshSimplex(const partTetMesh& tm, const label pI); partTetMeshSimplex(const partTetMesh& tm, const label pI);
//- Construct from the list of parPartTet and point label //- Construct from the list of parPartTet and point label
partTetMeshSimplex partTetMeshSimplex
( (
@ -80,29 +80,29 @@ class partTetMeshSimplex
const DynList<partTet, 128>& tets, const DynList<partTet, 128>& tets,
const label pointI const label pointI
); );
// Destructor // Destructor
~partTetMeshSimplex(); ~partTetMeshSimplex();
// Member functions // Member functions
//- return points //- return points
inline DynList<point, 128>& pts() inline DynList<point, 128>& pts()
{ {
return pts_; return pts_;
} }
//- return points //- return points
inline const DynList<point, 128>& pts() const inline const DynList<point, 128>& pts() const
{ {
return pts_; return pts_;
} }
//- return tets //- return tets
inline const DynList<partTet, 128>& tets() const inline const DynList<partTet, 128>& tets() const
{ {
return tets_; return tets_;
} }
//- return centre point coordinates //- return centre point coordinates
inline const point& centrePoint() const inline const point& centrePoint() const
{ {

View file

@ -50,7 +50,7 @@ partTriMeshSimplex::partTriMeshSimplex
const LongList<labelledTri>& trias = tm.triangles(); const LongList<labelledTri>& trias = tm.triangles();
const VRWGraph& pt = tm.pointTriangles(); const VRWGraph& pt = tm.pointTriangles();
const LongList<direction>& pType = tm.pointType(); const LongList<direction>& pType = tm.pointType();
//trias_.setSize(pt.sizeOfRow(pI)); //trias_.setSize(pt.sizeOfRow(pI));
label counter(0); label counter(0);
@ -69,11 +69,11 @@ partTriMeshSimplex::partTriMeshSimplex
++counter; ++counter;
} }
} }
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "Tet " << tetI << " is " << tet << endl; Info << "Tet " << tetI << " is " << tet << endl;
# endif # endif
label pos(-1); label pos(-1);
for(label i=0;i<3;++i) for(label i=0;i<3;++i)
if( tri[i] == pI ) if( tri[i] == pI )
@ -132,7 +132,7 @@ partTriMeshSimplex::partTriMeshSimplex
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
partTriMeshSimplex::~partTriMeshSimplex() partTriMeshSimplex::~partTriMeshSimplex()
{} {}

View file

@ -26,9 +26,9 @@ Class
Description Description
A simplex which is used for smoothing purposes A simplex which is used for smoothing purposes
SourceFiles SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -42,7 +42,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward declarations
class partTriMesh; class partTriMesh;
@ -55,38 +55,38 @@ class partTriMeshSimplex
// Private data // Private data
//- points making the simplex //- points making the simplex
DynList<point, 32> pts_; DynList<point, 32> pts_;
//- triangles making the simplex //- triangles making the simplex
DynList<triFace, 32> trias_; DynList<triFace, 32> trias_;
public: public:
// Constructors // Constructors
//- Construct from partTriMesh and point label //- Construct from partTriMesh and point label
partTriMeshSimplex(const partTriMesh& tm, const label pI); partTriMeshSimplex(const partTriMesh& tm, const label pI);
// Destructor // Destructor
~partTriMeshSimplex(); ~partTriMeshSimplex();
// Member functions // Member functions
//- return points //- return points
inline DynList<point, 32>& pts() inline DynList<point, 32>& pts()
{ {
return pts_; return pts_;
} }
//- return points //- return points
inline const DynList<point, 32>& pts() const inline const DynList<point, 32>& pts() const
{ {
return pts_; return pts_;
} }
//- return triangles //- return triangles
inline const DynList<triFace, 32>& triangles() const inline const DynList<triFace, 32>& triangles() const
{ {
return trias_; return trias_;
} }
//- return centre point coordinates //- return centre point coordinates
inline const point& centrePoint() const inline const point& centrePoint() const
{ {

View file

@ -43,7 +43,7 @@ defineTemplateTypeNameAndDebugWithName
"polyBoundaryMesh", "polyBoundaryMesh",
0 0
); );
defineTypeNameAndDebug(boundaryPatchBase, 0); defineTypeNameAndDebug(boundaryPatchBase, 0);
defineRunTimeSelectionTable(boundaryPatchBase, dictionary); defineRunTimeSelectionTable(boundaryPatchBase, dictionary);
@ -60,7 +60,7 @@ autoPtr<boundaryPatchBase> boundaryPatchBase::New
//- Other patch types are treated as ordinary patches //- Other patch types are treated as ordinary patches
if( type != "processor" ) if( type != "processor" )
type = "patch"; type = "patch";
dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(type); dictionaryConstructorTablePtr_->find(type);
@ -76,7 +76,7 @@ autoPtr<boundaryPatchBase> boundaryPatchBase::New
<< dictionaryConstructorTablePtr_->toc() << dictionaryConstructorTablePtr_->toc()
<< exit(FatalIOError); << exit(FatalIOError);
} }
return autoPtr<boundaryPatchBase>(cstrIter()(name, dict)); return autoPtr<boundaryPatchBase>(cstrIter()(name, dict));
} }
@ -90,7 +90,7 @@ autoPtr<boundaryPatchBase> boundaryPatchBase::New
return boundaryPatchBase::New(name, dict); return boundaryPatchBase::New(name, dict);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
boundaryPatchBase::boundaryPatchBase boundaryPatchBase::boundaryPatchBase
@ -106,7 +106,7 @@ boundaryPatchBase::boundaryPatchBase
nFaces_(nF), nFaces_(nF),
startFace_(sF) startFace_(sF)
{} {}
boundaryPatchBase::boundaryPatchBase(const word& name, const dictionary& dict) boundaryPatchBase::boundaryPatchBase(const word& name, const dictionary& dict)
: :
name_(name), name_(name),

View file

@ -51,23 +51,23 @@ namespace Foam
class boundaryPatchBase class boundaryPatchBase
{ {
protected: protected:
// Protected data // Protected data
word name_; word name_;
word type_; word type_;
label nFaces_; label nFaces_;
label startFace_; label startFace_;
public: public:
//- Runtime type information //- Runtime type information
TypeName("boundaryPatchBase"); TypeName("boundaryPatchBase");
// Constructors // Constructors
boundaryPatchBase boundaryPatchBase
( (
const word&, const word&,
@ -84,7 +84,7 @@ public:
{} {}
// Declare run-time constructor selection table // Declare run-time constructor selection table
declareRunTimeSelectionTable declareRunTimeSelectionTable
( (
autoPtr, autoPtr,
@ -98,20 +98,20 @@ public:
); );
// Selectors // Selectors
static autoPtr<boundaryPatchBase> New static autoPtr<boundaryPatchBase> New
( (
const word& name, const word& name,
const dictionary& dict const dictionary& dict
); );
static autoPtr<boundaryPatchBase> New static autoPtr<boundaryPatchBase> New
( (
Istream& Istream&
); );
// Construct and return a clone // Construct and return a clone
autoPtr<boundaryPatchBase> clone() const autoPtr<boundaryPatchBase> clone() const
{ {
return New return New
@ -120,7 +120,7 @@ public:
this->dict() this->dict()
); );
} }
//- Write //- Write
virtual void write(Ostream&) const = 0; virtual void write(Ostream&) const = 0;
@ -133,45 +133,45 @@ public:
{ {
return name_; return name_;
} }
inline word& patchName() inline word& patchName()
{ {
return name_; return name_;
} }
inline const word& patchType() const inline const word& patchType() const
{ {
return type_; return type_;
} }
inline word& patchType() inline word& patchType()
{ {
return type_; return type_;
} }
inline label patchStart() const inline label patchStart() const
{ {
return startFace_; return startFace_;
} }
inline label& patchStart() inline label& patchStart()
{ {
return startFace_; return startFace_;
} }
inline label patchSize() const inline label patchSize() const
{ {
return nFaces_; return nFaces_;
} }
inline label& patchSize() inline label& patchSize()
{ {
return nFaces_; return nFaces_;
} }
//- Return as dictionary of entries //- Return as dictionary of entries
virtual dictionary dict() const = 0; virtual dictionary dict() const = 0;
// Member operators // Member operators
friend Ostream& operator<<(Ostream&, const boundaryPatchBase&); friend Ostream& operator<<(Ostream&, const boundaryPatchBase&);
virtual Istream& operator>>(Istream&) = 0; virtual Istream& operator>>(Istream&) = 0;

View file

@ -39,7 +39,7 @@ namespace Foam
defineTypeNameAndDebug(processorBoundaryPatch, 0); defineTypeNameAndDebug(processorBoundaryPatch, 0);
addToRunTimeSelectionTable(boundaryPatchBase, processorBoundaryPatch, dictionary); addToRunTimeSelectionTable(boundaryPatchBase, processorBoundaryPatch, dictionary);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
processorBoundaryPatch::processorBoundaryPatch processorBoundaryPatch::processorBoundaryPatch
@ -56,7 +56,7 @@ processorBoundaryPatch::processorBoundaryPatch
myProcNo_(myProcNo), myProcNo_(myProcNo),
neighbProcNo_(neighbProcNo) neighbProcNo_(neighbProcNo)
{} {}
processorBoundaryPatch::processorBoundaryPatch processorBoundaryPatch::processorBoundaryPatch
( (
const word& name, const word& name,
@ -67,10 +67,10 @@ processorBoundaryPatch::processorBoundaryPatch
myProcNo_(readLabel(dict.lookup("myProcNo"))), myProcNo_(readLabel(dict.lookup("myProcNo"))),
neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))) neighbProcNo_(readLabel(dict.lookup("neighbProcNo")))
{ {
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionary processorBoundaryPatch::dict() const dictionary processorBoundaryPatch::dict() const
{ {
dictionary dict; dictionary dict;
@ -92,7 +92,7 @@ void processorBoundaryPatch::write(Ostream& os) const
void processorBoundaryPatch::writeDict(Ostream& os) const void processorBoundaryPatch::writeDict(Ostream& os) const
{ {
} }
Ostream& processorBoundaryPatch::operator<<(Ostream& os) const Ostream& processorBoundaryPatch::operator<<(Ostream& os) const

View file

@ -39,12 +39,12 @@ namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const faceListPMG& polyMeshGenFaces::faces() const inline const faceListPMG& polyMeshGenFaces::faces() const
{ {
return faces_; return faces_;
} }
inline label polyMeshGenFaces::nInternalFaces() const inline label polyMeshGenFaces::nInternalFaces() const
{ {
if( !(ownerPtr_ && neighbourPtr_) ) if( !(ownerPtr_ && neighbourPtr_) )
@ -79,7 +79,7 @@ inline const labelList& polyMeshGenFaces::owner() const
calculateOwnersAndNeighbours(); calculateOwnersAndNeighbours();
} }
return *ownerPtr_; return *ownerPtr_;
} }
@ -98,7 +98,7 @@ inline const labelList& polyMeshGenFaces::neighbour() const
calculateOwnersAndNeighbours(); calculateOwnersAndNeighbours();
} }
return *neighbourPtr_; return *neighbourPtr_;
} }
@ -122,7 +122,7 @@ inline void polyMeshGenFaces::addFaceToSubset
std::map<label, meshSubset>::iterator it = faceSubsets_.find(setID); std::map<label, meshSubset>::iterator it = faceSubsets_.find(setID);
if( it == faceSubsets_.end() ) if( it == faceSubsets_.end() )
return; return;
it->second.addElement(faceI); it->second.addElement(faceI);
} }
@ -134,7 +134,7 @@ inline void polyMeshGenFaces::removeFaceFromSubset
std::map<label, meshSubset>::iterator it = faceSubsets_.find(setI); std::map<label, meshSubset>::iterator it = faceSubsets_.find(setI);
if( it == faceSubsets_.end() ) if( it == faceSubsets_.end() )
return; return;
it->second.removeElement(faceI); it->second.removeElement(faceI);
} }
@ -145,7 +145,7 @@ inline void polyMeshGenFaces::faceInSubsets
) const ) const
{ {
faceSubsets.clear(); faceSubsets.clear();
std::map<label, meshSubset>::const_iterator it; std::map<label, meshSubset>::const_iterator it;
for for
( (
@ -162,7 +162,7 @@ inline void polyMeshGenFaces::faceInSubsets
inline void polyMeshGenFaces::faceSubsetIndices(DynList<label>& indices) const inline void polyMeshGenFaces::faceSubsetIndices(DynList<label>& indices) const
{ {
indices.clear(); indices.clear();
std::map<label, meshSubset>::const_iterator it; std::map<label, meshSubset>::const_iterator it;
for for
( (
@ -181,12 +181,12 @@ inline void polyMeshGenFaces::facesInSubset
) const ) const
{ {
faceLabels.clear(); faceLabels.clear();
std::map<label, meshSubset>::const_iterator it = std::map<label, meshSubset>::const_iterator it =
faceSubsets_.find(setI); faceSubsets_.find(setI);
if( it == faceSubsets_.end() ) if( it == faceSubsets_.end() )
return; return;
it->second.containedElements(faceLabels); it->second.containedElements(faceLabels);
} }

View file

@ -53,7 +53,7 @@ namespace Foam
class polyMeshGenPoints class polyMeshGenPoints
{ {
protected: protected:
// Protected data // Protected data
//- reference to the Time registry //- reference to the Time registry
const Time& runTime_; const Time& runTime_;
@ -63,14 +63,14 @@ protected:
//- map of point subsets //- map of point subsets
std::map<label, meshSubset> pointSubsets_; std::map<label, meshSubset> pointSubsets_;
// Disallow bitwise assignment // Disallow bitwise assignment
void operator=(const polyMeshGenPoints&); void operator=(const polyMeshGenPoints&);
polyMeshGenPoints(const polyMeshGenPoints&); polyMeshGenPoints(const polyMeshGenPoints&);
public: public:
friend class polyMeshGenModifier; friend class polyMeshGenModifier;
// Constructors // Constructors
@ -83,23 +83,23 @@ public:
const Time&, const Time&,
const pointField& points const pointField& points
); );
// Destructor // Destructor
~polyMeshGenPoints(); ~polyMeshGenPoints();
// Member functions // Member functions
//- access to Time //- access to Time
inline const Time& returnTime() const; inline const Time& returnTime() const;
//- access to points //- access to points
inline const pointFieldPMG& points() const; inline const pointFieldPMG& points() const;
//- non-const access to points //- non-const access to points
inline pointFieldPMG& points(); inline pointFieldPMG& points();
//- append a vertex to the end of the list //- append a vertex to the end of the list
inline void appendVertex(const point& p); inline void appendVertex(const point& p);
//- point subsets //- point subsets
label addPointSubset(const word&); label addPointSubset(const word&);
void removePointSubset(const label); void removePointSubset(const label);
@ -113,10 +113,10 @@ public:
inline void pointsInSubset(const label, ListType&) const; inline void pointsInSubset(const label, ListType&) const;
template<class ListType> template<class ListType>
inline void updatePointSubsets(const ListType&); inline void updatePointSubsets(const ListType&);
// Read mesh // Read mesh
void read(); void read();
// Write mesh // Write mesh
void write() const; void write() const;
}; };

View file

@ -40,7 +40,7 @@ inline const Time& polyMeshGenPoints::returnTime() const
{ {
return runTime_; return runTime_;
} }
inline const pointFieldPMG& polyMeshGenPoints::points() const inline const pointFieldPMG& polyMeshGenPoints::points() const
{ {
return points_; return points_;
@ -50,7 +50,7 @@ inline pointFieldPMG& polyMeshGenPoints::points()
{ {
return points_; return points_;
} }
inline void polyMeshGenPoints::appendVertex(const point& p) inline void polyMeshGenPoints::appendVertex(const point& p)
{ {
points_.append(p); points_.append(p);
@ -65,7 +65,7 @@ inline void polyMeshGenPoints::addPointToSubset
std::map<label, meshSubset>::iterator it = pointSubsets_.find(setI); std::map<label, meshSubset>::iterator it = pointSubsets_.find(setI);
if( it == pointSubsets_.end() ) if( it == pointSubsets_.end() )
return; return;
it->second.addElement(pointI); it->second.addElement(pointI);
} }
@ -78,7 +78,7 @@ inline void polyMeshGenPoints::removePointFromSubset
std::map<label, meshSubset>::iterator it = pointSubsets_.find(setI); std::map<label, meshSubset>::iterator it = pointSubsets_.find(setI);
if( it == pointSubsets_.end() ) if( it == pointSubsets_.end() )
return; return;
it->second.removeElement(pointI); it->second.removeElement(pointI);
} }
@ -89,7 +89,7 @@ inline void polyMeshGenPoints::pointInSubsets
) const ) const
{ {
pointSubsets.clear(); pointSubsets.clear();
std::map<label, meshSubset>::const_iterator it; std::map<label, meshSubset>::const_iterator it;
for for
( (
@ -106,7 +106,7 @@ inline void polyMeshGenPoints::pointInSubsets
inline void polyMeshGenPoints::pointSubsetIndices(DynList<label>& indices) const inline void polyMeshGenPoints::pointSubsetIndices(DynList<label>& indices) const
{ {
indices.clear(); indices.clear();
std::map<label, meshSubset>::const_iterator it; std::map<label, meshSubset>::const_iterator it;
for for
( (
@ -125,12 +125,12 @@ inline void polyMeshGenPoints::pointsInSubset
) const ) const
{ {
pointLabels.clear(); pointLabels.clear();
std::map<label, meshSubset>::const_iterator it = std::map<label, meshSubset>::const_iterator it =
pointSubsets_.find(setI); pointSubsets_.find(setI);
if( it == pointSubsets_.end() ) if( it == pointSubsets_.end() )
return; return;
it->second.containedElements(pointLabels); it->second.containedElements(pointLabels);
} }

View file

@ -126,38 +126,38 @@ class polyMeshGenAddressing
//- Face areas //- Face areas
mutable vectorField* faceAreasPtr_; mutable vectorField* faceAreasPtr_;
// Parallel demand driven data // Parallel demand driven data
//- global point labels //- global point labels
mutable labelLongList* globalPointLabelPtr_; mutable labelLongList* globalPointLabelPtr_;
//- global face labels //- global face labels
mutable labelLongList* globalFaceLabelPtr_; mutable labelLongList* globalFaceLabelPtr_;
//- global cell labels //- global cell labels
mutable labelLongList* globalCellLabelPtr_; mutable labelLongList* globalCellLabelPtr_;
//- global edge labels //- global edge labels
mutable labelLongList* globalEdgeLabelPtr_; mutable labelLongList* globalEdgeLabelPtr_;
// Parallel addressing // Parallel addressing
//- processors containing a vertex //- processors containing a vertex
mutable VRWGraph* pProcsPtr_; mutable VRWGraph* pProcsPtr_;
//- global to local point adressing //- global to local point adressing
mutable Map<label>* globalToLocalPointAddressingPtr_; mutable Map<label>* globalToLocalPointAddressingPtr_;
//- neighbour processors sharing a point with this processor //- neighbour processors sharing a point with this processor
mutable DynList<label>* pointNeiProcsPtr_; mutable DynList<label>* pointNeiProcsPtr_;
//- processors containing an edge //- processors containing an edge
mutable VRWGraph* eProcsPtr_; mutable VRWGraph* eProcsPtr_;
//- global to local edge addressing //- global to local edge addressing
mutable Map<label>* globalToLocalEdgeAddressingPtr_; mutable Map<label>* globalToLocalEdgeAddressingPtr_;
//- neighbour processors sharing an edge with the current processor //- neighbour processors sharing an edge with the current processor
mutable DynList<label>* edgeNeiProcsPtr_; mutable DynList<label>* edgeNeiProcsPtr_;
@ -186,7 +186,7 @@ class polyMeshGenAddressing
//- Calculate edge-face addressing //- Calculate edge-face addressing
void calcEdgeFaces() const; void calcEdgeFaces() const;
//- Calculate face-edge addressing //- Calculate face-edge addressing
void calcFaceEdges() const; void calcFaceEdges() const;
@ -211,16 +211,16 @@ class polyMeshGenAddressing
void clearOutEdges(); void clearOutEdges();
// Parallel calculations // Parallel calculations
//- calculate global point labels //- calculate global point labels
void calcGlobalPointLabels() const; void calcGlobalPointLabels() const;
//- calculate global face labels //- calculate global face labels
void calcGlobalFaceLabels() const; void calcGlobalFaceLabels() const;
//- calculate global cell labels //- calculate global cell labels
void calcGlobalCellLabels() const; void calcGlobalCellLabels() const;
//- calculate global edge labels //- calculate global edge labels
void calcGlobalEdgeLabels() const; void calcGlobalEdgeLabels() const;
@ -247,7 +247,7 @@ class polyMeshGenAddressing
//- Calculate edge vectors //- Calculate edge vectors
void calcEdgeVectors() const; void calcEdgeVectors() const;
// Disallow bitwise construct // Disallow bitwise construct
//- Default constructor //- Default constructor
polyMeshGenAddressing(); polyMeshGenAddressing();
@ -325,12 +325,12 @@ public:
const VRWGraph& cellPoints() const; const VRWGraph& cellPoints() const;
// Parallel addressing // Parallel addressing
const labelLongList& globalPointLabel() const; const labelLongList& globalPointLabel() const;
const labelLongList& globalFaceLabel() const; const labelLongList& globalFaceLabel() const;
const labelLongList& globalCellLabel() const; const labelLongList& globalCellLabel() const;
const labelLongList& globalEdgeLabel() const; const labelLongList& globalEdgeLabel() const;
const VRWGraph& pointAtProcs() const; const VRWGraph& pointAtProcs() const;
const Map<label>& globalToLocalPointAddressing() const; const Map<label>& globalToLocalPointAddressing() const;
const DynList<label>& pointNeiProcs() const; const DynList<label>& pointNeiProcs() const;
@ -355,7 +355,7 @@ public:
//- Clear topological data //- Clear topological data
void clearAddressing(); void clearAddressing();
//- Clear parallel addressing //- Clear parallel addressing
void clearParallelAddressing(); void clearParallelAddressing();
@ -364,7 +364,7 @@ public:
//- Clear everything primitive, geometry and addressing //- Clear everything primitive, geometry and addressing
void clearAll(); void clearAll();
// Update geometry data // Update geometry data
void updateGeometry(const boolList& changedFace); void updateGeometry(const boolList& changedFace);
}; };

View file

@ -44,9 +44,9 @@ void polyMeshGenModifier::addBufferCells()
{ {
if( !Pstream::parRun() ) if( !Pstream::parRun() )
return; return;
Info << "Adding buffer layers" << endl; Info << "Adding buffer layers" << endl;
const labelList& owner = mesh_.owner(); const labelList& owner = mesh_.owner();
pointFieldPMG& points = mesh_.points(); pointFieldPMG& points = mesh_.points();
faceListPMG& faces = facesAccess(); faceListPMG& faces = facesAccess();
@ -55,12 +55,12 @@ void polyMeshGenModifier::addBufferCells()
const polyMeshGenAddressing& addressing = mesh_.addressingData(); const polyMeshGenAddressing& addressing = mesh_.addressingData();
const labelLongList& globalPointLabel = addressing.globalPointLabel(); const labelLongList& globalPointLabel = addressing.globalPointLabel();
const Map<label>& globalToLocal = addressing.globalToLocalPointAddressing(); const Map<label>& globalToLocal = addressing.globalToLocalPointAddressing();
//- receive vertices //- receive vertices
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
labelHashSet pointsToSend; labelHashSet pointsToSend;
label faceI = procBoundaries[patchI].patchStart(); label faceI = procBoundaries[patchI].patchStart();
const label end = faceI + procBoundaries[patchI].patchSize(); const label end = faceI + procBoundaries[patchI].patchSize();
for(;faceI<end;++faceI) for(;faceI<end;++faceI)
@ -69,12 +69,12 @@ void polyMeshGenModifier::addBufferCells()
forAll(c, fI) forAll(c, fI)
{ {
const face& f = faces[c[fI]]; const face& f = faces[c[fI]];
forAll(f, pI) forAll(f, pI)
pointsToSend.insert(f[pI]); pointsToSend.insert(f[pI]);
} }
} }
faceI = 0; faceI = 0;
List<labelledPoint> ptsToSend(pointsToSend.size()); List<labelledPoint> ptsToSend(pointsToSend.size());
forAllConstIter(labelHashSet, pointsToSend, it) forAllConstIter(labelHashSet, pointsToSend, it)
@ -84,16 +84,16 @@ void polyMeshGenModifier::addBufferCells()
globalPointLabel[it.key()], globalPointLabel[it.key()],
points[it.key()] points[it.key()]
); );
OPstream toOtherProc OPstream toOtherProc
( (
Pstream::blocking, Pstream::blocking,
procBoundaries[patchI].neiProcNo() procBoundaries[patchI].neiProcNo()
); );
toOtherProc << ptsToSend; toOtherProc << ptsToSend;
} }
Map<label> globalToLocalReceived; Map<label> globalToLocalReceived;
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
@ -103,16 +103,16 @@ void polyMeshGenModifier::addBufferCells()
IPstream::blocking, IPstream::blocking,
procBoundaries[patchI].neiProcNo() procBoundaries[patchI].neiProcNo()
); );
fromOtherProc >> receivedPoints; fromOtherProc >> receivedPoints;
forAll(receivedPoints, i) forAll(receivedPoints, i)
{ {
if( globalToLocal.found(receivedPoints[i].pointLabel()) ) if( globalToLocal.found(receivedPoints[i].pointLabel()) )
continue; continue;
if( globalToLocalReceived.found(receivedPoints[i].pointLabel()) ) if( globalToLocalReceived.found(receivedPoints[i].pointLabel()) )
continue; continue;
globalToLocalReceived.insert globalToLocalReceived.insert
( (
receivedPoints[i].pointLabel(), receivedPoints[i].pointLabel(),
@ -121,62 +121,62 @@ void polyMeshGenModifier::addBufferCells()
points.append(receivedPoints[i].coordinates()); points.append(receivedPoints[i].coordinates());
} }
} }
//- send cells to other processors //- send cells to other processors
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
labelHashSet cellsToSend; labelHashSet cellsToSend;
label faceI = procBoundaries[patchI].patchStart(); label faceI = procBoundaries[patchI].patchStart();
const label end = faceI + procBoundaries[patchI].patchSize(); const label end = faceI + procBoundaries[patchI].patchSize();
for(;faceI<end;++faceI) for(;faceI<end;++faceI)
cellsToSend.insert(owner[faceI]); cellsToSend.insert(owner[faceI]);
labelLongList flattenedCells; labelLongList flattenedCells;
forAllConstIter(labelHashSet, cellsToSend, it) forAllConstIter(labelHashSet, cellsToSend, it)
{ {
const cell& c = cells[it.key()]; const cell& c = cells[it.key()];
//- the number of faces in the cell //- the number of faces in the cell
flattenedCells.append(c.size()); flattenedCells.append(c.size());
//- add faces //- add faces
forAll(c, fI) forAll(c, fI)
{ {
const face& f = faces[c[fI]]; const face& f = faces[c[fI]];
//- the number of vertices in the face //- the number of vertices in the face
flattenedCells.append(f.size()); flattenedCells.append(f.size());
forAll(f, pI) forAll(f, pI)
flattenedCells.append(globalPointLabel[f[pI]]); flattenedCells.append(globalPointLabel[f[pI]]);
} }
} }
OPstream toOtherProc OPstream toOtherProc
( (
Pstream::blocking, Pstream::blocking,
procBoundaries[patchI].neiProcNo() procBoundaries[patchI].neiProcNo()
); );
toOtherProc << flattenedCells; toOtherProc << flattenedCells;
} }
forAll(procBoundaries, patchI) forAll(procBoundaries, patchI)
{ {
word subsetName = "processor_"; word subsetName = "processor_";
subsetName += help::scalarToText(procBoundaries[patchI].neiProcNo()); subsetName += help::scalarToText(procBoundaries[patchI].neiProcNo());
const label subsetID = mesh_.addCellSubset(subsetName); const label subsetID = mesh_.addCellSubset(subsetName);
labelList receivedCells; labelList receivedCells;
IPstream fromOtherProc IPstream fromOtherProc
( (
Pstream::blocking, Pstream::blocking,
procBoundaries[patchI].neiProcNo() procBoundaries[patchI].neiProcNo()
); );
fromOtherProc >> receivedCells; fromOtherProc >> receivedCells;
label counter(0); label counter(0);
while( counter < receivedCells.size() ) while( counter < receivedCells.size() )
{ {
@ -187,7 +187,7 @@ void polyMeshGenModifier::addBufferCells()
forAll(c[fI], pI) forAll(c[fI], pI)
{ {
const label gpI = receivedCells[counter++]; const label gpI = receivedCells[counter++];
if( globalToLocal.found(gpI) ) if( globalToLocal.found(gpI) )
{ {
c[fI][pI] = globalToLocal[gpI]; c[fI][pI] = globalToLocal[gpI];
@ -198,14 +198,14 @@ void polyMeshGenModifier::addBufferCells()
} }
} }
} }
mesh_.addCellToSubset(subsetID, cells.size()); mesh_.addCellToSubset(subsetID, cells.size());
addCell(c); addCell(c);
} }
} }
mesh_.clearOut(); mesh_.clearOut();
Info << "Finished adding buffer layers" << endl; Info << "Finished adding buffer layers" << endl;
} }

View file

@ -48,12 +48,12 @@ polyMeshGenModifierAddCellByCell::polyMeshGenModifierAddCellByCell
faceListPMG& faces = this->facesAccess(); faceListPMG& faces = this->facesAccess();
forAll(faces, faceI) forAll(faces, faceI)
newFaces_[faceI].transfer(faces[faceI]); newFaces_[faceI].transfer(faces[faceI]);
cellListPMG& cells = this->cellsAccess(); cellListPMG& cells = this->cellsAccess();
forAll(cells, cellI) forAll(cells, cellI)
newCells_[cellI].transfer(cells[cellI]); newCells_[cellI].transfer(cells[cellI]);
}; };
// Destructor // Destructor
polyMeshGenModifierAddCellByCell::~polyMeshGenModifierAddCellByCell() polyMeshGenModifierAddCellByCell::~polyMeshGenModifierAddCellByCell()
{ {
@ -61,46 +61,46 @@ polyMeshGenModifierAddCellByCell::~polyMeshGenModifierAddCellByCell()
faces.setSize(nFaces_); faces.setSize(nFaces_);
forAll(faces, faceI) forAll(faces, faceI)
faces[faceI].transfer(newFaces_[faceI]); faces[faceI].transfer(newFaces_[faceI]);
cellListPMG& cells = this->cellsAccess(); cellListPMG& cells = this->cellsAccess();
cells.setSize(newCells_.size()); cells.setSize(newCells_.size());
forAll(cells, cellI) forAll(cells, cellI)
cells[cellI].transfer(newCells_[cellI]); cells[cellI].transfer(newCells_[cellI]);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void polyMeshGenModifierAddCellByCell::addCell(const faceList& cellFaces) void polyMeshGenModifierAddCellByCell::addCell(const faceList& cellFaces)
{ {
cell c(cellFaces.size()); cell c(cellFaces.size());
VRWGraph& pointFaces = this->pointFaces(); VRWGraph& pointFaces = this->pointFaces();
forAll(cellFaces, faceI) forAll(cellFaces, faceI)
{ {
const face& f = cellFaces[faceI]; const face& f = cellFaces[faceI];
const label pointI = f[0]; const label pointI = f[0];
label fLabel(-1); label fLabel(-1);
forAllRow(pointFaces, pointI, pfI) forAllRow(pointFaces, pointI, pfI)
{ {
const label faceI = pointFaces(pointI, pfI); const label faceI = pointFaces(pointI, pfI);
if( newFaces_[faceI] == f ) if( newFaces_[faceI] == f )
{ {
fLabel = faceI; fLabel = faceI;
break; break;
} }
} }
if( fLabel == -1 ) if( fLabel == -1 )
{ {
newFaces_.append(f); newFaces_.append(f);
c[faceI] = nFaces_; c[faceI] = nFaces_;
forAll(f, pI) forAll(f, pI)
pointFaces.append(f[pI], nFaces_); pointFaces.append(f[pI], nFaces_);
++nFaces_; ++nFaces_;
} }
else else
@ -108,7 +108,7 @@ void polyMeshGenModifierAddCellByCell::addCell(const faceList& cellFaces)
c[faceI] = fLabel; c[faceI] = fLabel;
} }
} }
newCells_.append(c); newCells_.append(c);
++nCells_; ++nCells_;
} }

View file

@ -51,7 +51,7 @@ class polyMeshGenModifierAddCellByCell
//- number of faces //- number of faces
label nFaces_; label nFaces_;
LongList<face> newFaces_; LongList<face> newFaces_;
//- number of cells //- number of cells
label nCells_; label nCells_;
LongList<cell> newCells_; LongList<cell> newCells_;
@ -61,10 +61,10 @@ public:
// Constructors // Constructors
//- Construct from the reference to the mesh //- Construct from the reference to the mesh
polyMeshGenModifierAddCellByCell(polyMeshGen& mesh); polyMeshGenModifierAddCellByCell(polyMeshGen& mesh);
// Destructor // Destructor
~polyMeshGenModifierAddCellByCell(); ~polyMeshGenModifierAddCellByCell();
// Member functions // Member functions
//- add a single cell (vertices must be added); //- add a single cell (vertices must be added);
void addCell(const faceList& cell); void addCell(const faceList& cell);

View file

@ -42,12 +42,12 @@ namespace Foam
void polyMeshGenModifier::zipUpCells() void polyMeshGenModifier::zipUpCells()
{ {
this->clearOut(); this->clearOut();
Info<< "Zipping up topologically open cells" << endl; Info<< "Zipping up topologically open cells" << endl;
const pointFieldPMG& points = mesh_.points(); const pointFieldPMG& points = mesh_.points();
const cellListPMG& cells = mesh_.cells(); const cellListPMG& cells = mesh_.cells();
faceListPMG& faces = mesh_.faces_; faceListPMG& faces = mesh_.faces_;
// Algorithm: // Algorithm:
@ -67,7 +67,7 @@ void polyMeshGenModifier::zipUpCells()
// pass. It is therefore essential to discard the addressing // pass. It is therefore essential to discard the addressing
// after every pass. The algorithm is completed when the mesh // after every pass. The algorithm is completed when the mesh
// stops changing. // stops changing.
// //
label nChangedFacesInMesh; label nChangedFacesInMesh;
label nCycles(0); label nCycles(0);
@ -77,7 +77,7 @@ void polyMeshGenModifier::zipUpCells()
do do
{ {
nChangedFacesInMesh = 0; nChangedFacesInMesh = 0;
//- calculate pointFaces addressing //- calculate pointFaces addressing
# ifdef DEBUG_ZIPUP # ifdef DEBUG_ZIPUP
Info << "Starting pointFaces addressing " << endl; Info << "Starting pointFaces addressing " << endl;
@ -90,20 +90,20 @@ void polyMeshGenModifier::zipUpCells()
forAll(f, pI) forAll(f, pI)
++nUsage[f[pI]]; ++nUsage[f[pI]];
} }
VRWGraph pFaces(points.size()); VRWGraph pFaces(points.size());
forAll(nUsage, pI) forAll(nUsage, pI)
pFaces.setRowSize(pI, nUsage[pI]); pFaces.setRowSize(pI, nUsage[pI]);
nUsage = 0; nUsage = 0;
forAll(faces, fI) forAll(faces, fI)
{ {
const face& f = faces[fI]; const face& f = faces[fI];
forAll(f, pI) forAll(f, pI)
pFaces(f[pI], nUsage[f[pI]]++) = fI; pFaces(f[pI], nUsage[f[pI]]++) = fI;
} }
nUsage.clear(); nUsage.clear();
# ifdef DEBUG_ZIPUP # ifdef DEBUG_ZIPUP
@ -271,7 +271,7 @@ void polyMeshGenModifier::zipUpCells()
// Go through the points and start from the point used twice // Go through the points and start from the point used twice
// check all the edges to find the edges starting from this point // check all the edges to find the edges starting from this point
// add the // add the
labelListList edgesToInsert(singleEdges.size()); labelListList edgesToInsert(singleEdges.size());
label nEdgesToInsert = 0; label nEdgesToInsert = 0;
@ -472,7 +472,7 @@ void polyMeshGenModifier::zipUpCells()
// Warning: the ordering must be parametric, because in // Warning: the ordering must be parametric, because in
// the case of multiple point insertion onto the same edge // the case of multiple point insertion onto the same edge
// it is possible to get non-cyclic loops // it is possible to get non-cyclic loops
// //
const labelList& unorderedEdge = edgesToInsert[edgeToInsertI]; const labelList& unorderedEdge = edgesToInsert[edgeToInsertI];
@ -552,17 +552,17 @@ void polyMeshGenModifier::zipUpCells()
// point-face addressing in two goes. // point-face addressing in two goes.
const label start = testEdge.start(); const label start = testEdge.start();
const label end = testEdge.end(); const label end = testEdge.end();
labelList facesSharingEdge labelList facesSharingEdge
( (
pFaces.sizeOfRow(start) + pFaces.sizeOfRow(start) +
pFaces.sizeOfRow(end) pFaces.sizeOfRow(end)
); );
label nfse = 0; label nfse = 0;
forAllRow(pFaces, start, pfI) forAllRow(pFaces, start, pfI)
facesSharingEdge[nfse++] = pFaces(start, pfI); facesSharingEdge[nfse++] = pFaces(start, pfI);
forAllRow(pFaces, end, pfI) forAllRow(pFaces, end, pfI)
facesSharingEdge[nfse++] = pFaces(end, pfI); facesSharingEdge[nfse++] = pFaces(end, pfI);
@ -708,7 +708,7 @@ void polyMeshGenModifier::zipUpCells()
nNewFacePoints++; nNewFacePoints++;
} }
} }
forAll(newFace, pI) forAll(newFace, pI)
pFaces.appendIfNotIn pFaces.appendIfNotIn
( (
@ -721,7 +721,7 @@ void polyMeshGenModifier::zipUpCells()
<< faces[currentFaceIndex] << nl << faces[currentFaceIndex] << nl
<< "newFace: " << newFace << endl; << "newFace: " << newFace << endl;
# endif # endif
// Check for duplicate points in the new face // Check for duplicate points in the new face
forAll (newFace, checkI) forAll (newFace, checkI)
{ {

View file

@ -62,131 +62,131 @@ class meshOctreeAddressing
// Private data // Private data
//- reference to the octree //- reference to the octree
const meshOctree& octree_; const meshOctree& octree_;
//- reference to the dictionary //- reference to the dictionary
const dictionary& meshDict_; const dictionary& meshDict_;
//- use DATA boxes //- use DATA boxes
bool useDATABoxes_; bool useDATABoxes_;
//- number of created octree nodes //- number of created octree nodes
mutable label nNodes_; mutable label nNodes_;
//- coordinates of octree nodes //- coordinates of octree nodes
mutable pointField* octreePointsPtr_; mutable pointField* octreePointsPtr_;
//- node labels //- node labels
mutable VRWGraph* nodeLabelsPtr_; mutable VRWGraph* nodeLabelsPtr_;
//- node leaves //- node leaves
mutable FRWGraph<label, 8>* nodeLeavesPtr_; mutable FRWGraph<label, 8>* nodeLeavesPtr_;
//- identify which boxes should be used as mesh cells //- identify which boxes should be used as mesh cells
mutable List<direction>* boxTypePtr_; mutable List<direction>* boxTypePtr_;
//- identify created nodes as OUTERNODE or INNERNODE //- identify created nodes as OUTERNODE or INNERNODE
mutable List<direction>* nodeTypePtr_; mutable List<direction>* nodeTypePtr_;
// Additional addressing useful for some algorithms // Additional addressing useful for some algorithms
//- faces of the octree //- faces of the octree
mutable VRWGraph* octreeFacesPtr_; mutable VRWGraph* octreeFacesPtr_;
mutable labelLongList* octreeFacesOwnersPtr_; mutable labelLongList* octreeFacesOwnersPtr_;
mutable labelLongList* octreeFacesNeighboursPtr_; mutable labelLongList* octreeFacesNeighboursPtr_;
//- octree box-faces addressing //- octree box-faces addressing
mutable VRWGraph* leafFacesPtr_; mutable VRWGraph* leafFacesPtr_;
//- node-faces addressing //- node-faces addressing
mutable VRWGraph* nodeFacesPtr_; mutable VRWGraph* nodeFacesPtr_;
//- leaf-leaves addressing //- leaf-leaves addressing
mutable VRWGraph* leafLeavesPtr_; mutable VRWGraph* leafLeavesPtr_;
//- edges of the octree //- edges of the octree
mutable LongList<edge>* octreeEdgesPtr_; mutable LongList<edge>* octreeEdgesPtr_;
//- edges-leaves addressing //- edges-leaves addressing
mutable VRWGraph* edgeLeavesPtr_; mutable VRWGraph* edgeLeavesPtr_;
//- leaf-edges addressing //- leaf-edges addressing
mutable VRWGraph* leafEdgesPtr_; mutable VRWGraph* leafEdgesPtr_;
//- node-edges addressing //- node-edges addressing
mutable VRWGraph* nodeEdgesPtr_; mutable VRWGraph* nodeEdgesPtr_;
//- face-edges addressing //- face-edges addressing
mutable VRWGraph* faceEdgesPtr_; mutable VRWGraph* faceEdgesPtr_;
//- edge-faces addressing //- edge-faces addressing
mutable VRWGraph* edgeFacesPtr_; mutable VRWGraph* edgeFacesPtr_;
//- global octree point label //- global octree point label
mutable labelLongList* globalPointLabelPtr_; mutable labelLongList* globalPointLabelPtr_;
//- global point to local label addressing //- global point to local label addressing
mutable Map<label>* globalPointToLocalPtr_; mutable Map<label>* globalPointToLocalPtr_;
//- point-processors addressing //- point-processors addressing
mutable VRWGraph* pointProcsPtr_; mutable VRWGraph* pointProcsPtr_;
//- global octree face label //- global octree face label
mutable labelLongList* globalFaceLabelPtr_; mutable labelLongList* globalFaceLabelPtr_;
//- global face label to local label addressing //- global face label to local label addressing
mutable Map<label>* globalFaceToLocalPtr_; mutable Map<label>* globalFaceToLocalPtr_;
//- face-processors addressing //- face-processors addressing
mutable VRWGraph* faceProcsPtr_; mutable VRWGraph* faceProcsPtr_;
//- global leaf label //- global leaf label
mutable labelLongList* globalLeafLabelPtr_; mutable labelLongList* globalLeafLabelPtr_;
//- global leaf label to local label addressing for octree leaves //- global leaf label to local label addressing for octree leaves
mutable Map<label>* globalLeafToLocalPtr_; mutable Map<label>* globalLeafToLocalPtr_;
//- leaf at procs //- leaf at procs
mutable VRWGraph* leafAtProcsPtr_; mutable VRWGraph* leafAtProcsPtr_;
// Private member functions // Private member functions
//- calculate octreePointsPtr_ //- calculate octreePointsPtr_
void createOctreePoints() const; void createOctreePoints() const;
//- calculate nodeLabelsPtr_ //- calculate nodeLabelsPtr_
void createNodeLabels() const; void createNodeLabels() const;
//- calculate nodeLeavesPtr_ //- calculate nodeLeavesPtr_
void createNodeLeaves() const; void createNodeLeaves() const;
//- assemble boxTypePtr_ list //- assemble boxTypePtr_ list
void findUsedBoxes() const; void findUsedBoxes() const;
//- calculate nodeTypePtr_ //- calculate nodeTypePtr_
void calculateNodeType() const; void calculateNodeType() const;
//- calculate faces //- calculate faces
void createOctreeFaces() const; void createOctreeFaces() const;
//- calculate leaf-faces addressing //- calculate leaf-faces addressing
void calculateLeafFaces() const; void calculateLeafFaces() const;
//- calculate node-faces addressing //- calculate node-faces addressing
void calculateNodeFaces() const; void calculateNodeFaces() const;
//- calculate leaf-leaves addressing //- calculate leaf-leaves addressing
void calculateLeafLeaves() const; void calculateLeafLeaves() const;
//- calculate edges //- calculate edges
void createOctreeEdges() const; void createOctreeEdges() const;
//- calculate leaf-edges //- calculate leaf-edges
void calculateLeafEdges() const; void calculateLeafEdges() const;
//- calculate edge-leaves addressing //- calculate edge-leaves addressing
void calculateEdgeLeaves() const; void calculateEdgeLeaves() const;
//- calculate edge-faces //- calculate edge-faces
void calculateEdgeFaces() const; void calculateEdgeFaces() const;
//- Clear allocated data //- Clear allocated data
void clearOut(); void clearOut();
void clearBoxTypes(); void clearBoxTypes();
@ -194,12 +194,12 @@ class meshOctreeAddressing
void clearOctreeFaces(); void clearOctreeFaces();
void clearAddressing(); void clearAddressing();
void clearParallelAddressing(); void clearParallelAddressing();
//- check if distinct parts are glued together //- check if distinct parts are glued together
void checkGluedRegions(); void checkGluedRegions();
// Private member functions for parallel runs // Private member functions for parallel runs
void calcGlobalPointLabels() const; void calcGlobalPointLabels() const;
void calcGlobalFaceLabels() const; void calcGlobalFaceLabels() const;
void calcGlobalLeafLabels() const; void calcGlobalLeafLabels() const;
@ -239,9 +239,9 @@ public:
OUTERNODE = 16, OUTERNODE = 16,
BOUNDARYNODE = 32 BOUNDARYNODE = 32
}; };
// Member Functions // Member Functions
//- check if there exist any non-signly connected edges and vertices //- check if there exist any non-signly connected edges and vertices
//- in the octree mesh. This is primarily needed //- in the octree mesh. This is primarily needed
//- for the cartesian template //- for the cartesian template
@ -249,7 +249,7 @@ public:
//- return number of octree nodes //- return number of octree nodes
inline label numberOfNodes() const; inline label numberOfNodes() const;
//- return coordinates of octree vertices //- return coordinates of octree vertices
inline const pointField& octreePoints() const; inline const pointField& octreePoints() const;
@ -258,46 +258,46 @@ public:
//- return nodeLeaves //- return nodeLeaves
inline const FRWGraph<label, 8>& nodeLeaves() const; inline const FRWGraph<label, 8>& nodeLeaves() const;
//- return which octree boxes are used for mesh creation //- return which octree boxes are used for mesh creation
inline const List<direction>& boxType() const; inline const List<direction>& boxType() const;
//- return type of node (INNERNODE,or OUTERNODE) //- return type of node (INNERNODE,or OUTERNODE)
inline const List<direction>& nodeType() const; inline const List<direction>& nodeType() const;
//- set box type //- set box type
inline void setBoxType(const label boxI, const direction type); inline void setBoxType(const label boxI, const direction type);
//- return octree faces, created for MESHCELL boxes //- return octree faces, created for MESHCELL boxes
inline const VRWGraph& octreeFaces() const; inline const VRWGraph& octreeFaces() const;
//- return owners of octree faces //- return owners of octree faces
inline const labelLongList& octreeFaceOwner() const; inline const labelLongList& octreeFaceOwner() const;
//- return neighbours of octree faces //- return neighbours of octree faces
inline const labelLongList& octreeFaceNeighbour() const; inline const labelLongList& octreeFaceNeighbour() const;
//- return octree box-faces addressing //- return octree box-faces addressing
inline const VRWGraph& leafFaces() const; inline const VRWGraph& leafFaces() const;
//- checks if the face is intersected by the surface //- checks if the face is intersected by the surface
bool isIntersectedFace(const label fI) const; bool isIntersectedFace(const label fI) const;
//- return leaf-leaves addressing //- return leaf-leaves addressing
inline const VRWGraph& leafLeaves() const; inline const VRWGraph& leafLeaves() const;
//- return node-faces addressing //- return node-faces addressing
inline const VRWGraph& nodeFaces() const; inline const VRWGraph& nodeFaces() const;
//- return octree edges, created for MESHCELL boxes //- return octree edges, created for MESHCELL boxes
inline const LongList<edge>& octreeEdges() const; inline const LongList<edge>& octreeEdges() const;
//- return edge-leaves addressing //- return edge-leaves addressing
inline const VRWGraph& edgeLeaves() const; inline const VRWGraph& edgeLeaves() const;
//- return leaf-edges addressing //- return leaf-edges addressing
inline const VRWGraph& leafEdges() const; inline const VRWGraph& leafEdges() const;
//- checks if the edge is intersected by the surface //- checks if the edge is intersected by the surface
bool isIntersectedEdge(const label eI) const; bool isIntersectedEdge(const label eI) const;
void edgeIntersections void edgeIntersections
@ -305,19 +305,19 @@ public:
const label eI, const label eI,
DynList<point>& intersections DynList<point>& intersections
) const; ) const;
//- return node-edges addressing //- return node-edges addressing
inline const VRWGraph& nodeEdges() const; inline const VRWGraph& nodeEdges() const;
//- return face-edges addressing //- return face-edges addressing
inline const VRWGraph& faceEdges() const; inline const VRWGraph& faceEdges() const;
//- return edge-faces addressing //- return edge-faces addressing
inline const VRWGraph& edgeFaces() const; inline const VRWGraph& edgeFaces() const;
//- return const reference to meshOctree //- return const reference to meshOctree
inline const meshOctree& octree() const; inline const meshOctree& octree() const;
//- find cubes around an edge (cubes must be at the same level) //- find cubes around an edge (cubes must be at the same level)
void cubesAroundEdge void cubesAroundEdge
( (
@ -325,36 +325,36 @@ public:
const direction eI, const direction eI,
FixedList<label, 4>& edgeCubes FixedList<label, 4>& edgeCubes
) const; ) const;
//- find edge centre if it exists //- find edge centre if it exists
label findEdgeCentre(const label leafI, const direction eI) const; label findEdgeCentre(const label leafI, const direction eI) const;
// Access to data needed for parallel execution // Access to data needed for parallel execution
//- return global point labels //- return global point labels
inline const labelLongList& globalPointLabel() const; inline const labelLongList& globalPointLabel() const;
//- global point label to local label. Only for processors points //- global point label to local label. Only for processors points
inline const Map<label>& globalToLocalPointAddressing() const; inline const Map<label>& globalToLocalPointAddressing() const;
//- processors which contain an octree point //- processors which contain an octree point
inline const VRWGraph& pointAtProcs() const; inline const VRWGraph& pointAtProcs() const;
//- return global labels of octree faces //- return global labels of octree faces
inline const labelLongList& globalFaceLabel() const; inline const labelLongList& globalFaceLabel() const;
//- return global face label to face label. Only for processor faces //- return global face label to face label. Only for processor faces
inline const Map<label>& globalToLocalFaceAddressing() const; inline const Map<label>& globalToLocalFaceAddressing() const;
//- return processors which contain each octree face //- return processors which contain each octree face
inline const VRWGraph& faceAtProcs() const; inline const VRWGraph& faceAtProcs() const;
//- return global labels of octree leaves //- return global labels of octree leaves
inline const labelLongList& globalLeafLabel() const; inline const labelLongList& globalLeafLabel() const;
//- return processors which contain each octree leaf //- return processors which contain each octree leaf
inline const VRWGraph& leafAtProcs() const; inline const VRWGraph& leafAtProcs() const;
//- return global leaf label to local label addressing //- return global leaf label to local label addressing
inline const Map<label>& globalToLocalLeafAddressing() const; inline const Map<label>& globalToLocalLeafAddressing() const;
}; };

View file

@ -37,7 +37,7 @@ inline label meshOctreeAddressing::numberOfNodes() const
{ {
if( !nodeLabelsPtr_ ) if( !nodeLabelsPtr_ )
createNodeLabels(); createNodeLabels();
return nNodes_; return nNodes_;
} }
@ -45,15 +45,15 @@ inline const pointField& meshOctreeAddressing::octreePoints() const
{ {
if( !octreePointsPtr_ ) if( !octreePointsPtr_ )
createOctreePoints(); createOctreePoints();
return *octreePointsPtr_; return *octreePointsPtr_;
} }
inline const VRWGraph& meshOctreeAddressing::nodeLabels() const inline const VRWGraph& meshOctreeAddressing::nodeLabels() const
{ {
if( !nodeLabelsPtr_ ) if( !nodeLabelsPtr_ )
createNodeLabels(); createNodeLabels();
return *nodeLabelsPtr_; return *nodeLabelsPtr_;
} }
@ -61,15 +61,15 @@ inline const FRWGraph<label, 8>& meshOctreeAddressing::nodeLeaves() const
{ {
if( !nodeLeavesPtr_ ) if( !nodeLeavesPtr_ )
createNodeLeaves(); createNodeLeaves();
return *nodeLeavesPtr_; return *nodeLeavesPtr_;
} }
inline const List<direction>& meshOctreeAddressing::boxType() const inline const List<direction>& meshOctreeAddressing::boxType() const
{ {
if( !boxTypePtr_ ) if( !boxTypePtr_ )
findUsedBoxes(); findUsedBoxes();
return *boxTypePtr_; return *boxTypePtr_;
} }
@ -95,7 +95,7 @@ inline const List<direction>& meshOctreeAddressing::nodeType() const
{ {
if( !nodeTypePtr_ ) if( !nodeTypePtr_ )
calculateNodeType(); calculateNodeType();
return *nodeTypePtr_; return *nodeTypePtr_;
} }
@ -103,7 +103,7 @@ inline const VRWGraph& meshOctreeAddressing::octreeFaces() const
{ {
if( !octreeFacesPtr_ ) if( !octreeFacesPtr_ )
createOctreeFaces(); createOctreeFaces();
return *octreeFacesPtr_; return *octreeFacesPtr_;
} }
@ -111,7 +111,7 @@ inline const labelLongList& meshOctreeAddressing::octreeFaceOwner() const
{ {
if( !octreeFacesOwnersPtr_ ) if( !octreeFacesOwnersPtr_ )
createOctreeFaces(); createOctreeFaces();
return *octreeFacesOwnersPtr_; return *octreeFacesOwnersPtr_;
} }
@ -119,7 +119,7 @@ inline const labelLongList& meshOctreeAddressing::octreeFaceNeighbour() const
{ {
if( !octreeFacesNeighboursPtr_ ) if( !octreeFacesNeighboursPtr_ )
createOctreeFaces(); createOctreeFaces();
return *octreeFacesNeighboursPtr_; return *octreeFacesNeighboursPtr_;
} }
@ -127,7 +127,7 @@ inline const VRWGraph& meshOctreeAddressing::leafFaces() const
{ {
if( !leafFacesPtr_ ) if( !leafFacesPtr_ )
calculateLeafFaces(); calculateLeafFaces();
return *leafFacesPtr_; return *leafFacesPtr_;
} }
@ -135,7 +135,7 @@ inline const VRWGraph& meshOctreeAddressing::leafLeaves() const
{ {
if( !leafLeavesPtr_ ) if( !leafLeavesPtr_ )
calculateLeafLeaves(); calculateLeafLeaves();
return *leafLeavesPtr_; return *leafLeavesPtr_;
} }
@ -143,7 +143,7 @@ inline const VRWGraph& meshOctreeAddressing::nodeFaces() const
{ {
if( !nodeFacesPtr_ ) if( !nodeFacesPtr_ )
calculateNodeFaces(); calculateNodeFaces();
return *nodeFacesPtr_; return *nodeFacesPtr_;
} }
@ -151,7 +151,7 @@ inline const LongList<edge>& meshOctreeAddressing::octreeEdges() const
{ {
if( !octreeEdgesPtr_ ) if( !octreeEdgesPtr_ )
createOctreeEdges(); createOctreeEdges();
return *octreeEdgesPtr_; return *octreeEdgesPtr_;
} }
@ -159,7 +159,7 @@ inline const VRWGraph& meshOctreeAddressing::edgeLeaves() const
{ {
if( !edgeLeavesPtr_ ) if( !edgeLeavesPtr_ )
calculateEdgeLeaves(); calculateEdgeLeaves();
return *edgeLeavesPtr_; return *edgeLeavesPtr_;
} }
@ -167,7 +167,7 @@ inline const VRWGraph& meshOctreeAddressing::leafEdges() const
{ {
if( !leafEdgesPtr_ ) if( !leafEdgesPtr_ )
calculateLeafEdges(); calculateLeafEdges();
return *leafEdgesPtr_; return *leafEdgesPtr_;
} }
@ -175,7 +175,7 @@ inline const VRWGraph& meshOctreeAddressing::nodeEdges() const
{ {
if( !nodeEdgesPtr_ ) if( !nodeEdgesPtr_ )
createOctreeEdges(); createOctreeEdges();
return *nodeEdgesPtr_; return *nodeEdgesPtr_;
} }
@ -183,7 +183,7 @@ inline const VRWGraph& meshOctreeAddressing::faceEdges() const
{ {
if( !faceEdgesPtr_ ) if( !faceEdgesPtr_ )
createOctreeEdges(); createOctreeEdges();
return *faceEdgesPtr_; return *faceEdgesPtr_;
} }
@ -191,7 +191,7 @@ inline const VRWGraph& meshOctreeAddressing::edgeFaces() const
{ {
if( !edgeFacesPtr_ ) if( !edgeFacesPtr_ )
calculateEdgeFaces(); calculateEdgeFaces();
return *edgeFacesPtr_; return *edgeFacesPtr_;
} }
@ -199,57 +199,57 @@ inline const labelLongList& meshOctreeAddressing::globalPointLabel() const
{ {
if( !globalPointLabelPtr_ ) if( !globalPointLabelPtr_ )
calcGlobalPointLabels(); calcGlobalPointLabels();
return *globalPointLabelPtr_; return *globalPointLabelPtr_;
} }
inline const Map<label>& meshOctreeAddressing:: inline const Map<label>& meshOctreeAddressing::
globalToLocalPointAddressing() const globalToLocalPointAddressing() const
{ {
if( !globalPointToLocalPtr_ ) if( !globalPointToLocalPtr_ )
calcGlobalPointLabels(); calcGlobalPointLabels();
return *globalPointToLocalPtr_; return *globalPointToLocalPtr_;
} }
inline const VRWGraph& meshOctreeAddressing::pointAtProcs() const inline const VRWGraph& meshOctreeAddressing::pointAtProcs() const
{ {
if( !pointProcsPtr_ ) if( !pointProcsPtr_ )
calcGlobalPointLabels(); calcGlobalPointLabels();
return *pointProcsPtr_; return *pointProcsPtr_;
} }
inline const labelLongList& meshOctreeAddressing::globalFaceLabel() const inline const labelLongList& meshOctreeAddressing::globalFaceLabel() const
{ {
if( !globalFaceLabelPtr_ ) if( !globalFaceLabelPtr_ )
calcGlobalFaceLabels(); calcGlobalFaceLabels();
return *globalFaceLabelPtr_; return *globalFaceLabelPtr_;
} }
inline const Map<label>& meshOctreeAddressing:: inline const Map<label>& meshOctreeAddressing::
globalToLocalFaceAddressing() const globalToLocalFaceAddressing() const
{ {
if( !globalFaceToLocalPtr_ ) if( !globalFaceToLocalPtr_ )
calcGlobalFaceLabels(); calcGlobalFaceLabels();
return *globalFaceToLocalPtr_; return *globalFaceToLocalPtr_;
} }
inline const VRWGraph& meshOctreeAddressing::faceAtProcs() const inline const VRWGraph& meshOctreeAddressing::faceAtProcs() const
{ {
if( !faceProcsPtr_ ) if( !faceProcsPtr_ )
calcGlobalFaceLabels(); calcGlobalFaceLabels();
return *faceProcsPtr_; return *faceProcsPtr_;
} }
inline const labelLongList& meshOctreeAddressing::globalLeafLabel() const inline const labelLongList& meshOctreeAddressing::globalLeafLabel() const
{ {
if( !globalLeafLabelPtr_ ) if( !globalLeafLabelPtr_ )
calcGlobalLeafLabels(); calcGlobalLeafLabels();
return *globalLeafLabelPtr_; return *globalLeafLabelPtr_;
} }
@ -257,7 +257,7 @@ inline const VRWGraph& meshOctreeAddressing::leafAtProcs() const
{ {
if( !leafAtProcsPtr_ ) if( !leafAtProcsPtr_ )
calcGlobalLeafLabels(); calcGlobalLeafLabels();
return *leafAtProcsPtr_; return *leafAtProcsPtr_;
} }
@ -266,7 +266,7 @@ globalToLocalLeafAddressing() const
{ {
if( !globalLeafToLocalPtr_ ) if( !globalLeafToLocalPtr_ )
calcGlobalLeafLabels(); calcGlobalLeafLabels();
return *globalLeafToLocalPtr_; return *globalLeafToLocalPtr_;
} }

View file

@ -49,60 +49,60 @@ namespace Foam
class meshOctreeInsideOutside class meshOctreeInsideOutside
{ {
// Private data // Private data
//- meshOctreeAddressing //- meshOctreeAddressing
meshOctreeModifier octreeModifier_; meshOctreeModifier octreeModifier_;
//- group for a given leaf //- group for a given leaf
labelLongList cubeGroup_; labelLongList cubeGroup_;
//- cubes belonging to each group of octree boxes //- cubes belonging to each group of octree boxes
VRWGraph cubesInGroup_; VRWGraph cubesInGroup_;
//- type for a group //- type for a group
std::map<label, direction> groupType_; std::map<label, direction> groupType_;
//- boundary DATA boxes for a given group //- boundary DATA boxes for a given group
VRWGraph boundaryDATACubes_; VRWGraph boundaryDATACubes_;
//- flag for DATA boxes next to the OUTSIDE boxes //- flag for DATA boxes next to the OUTSIDE boxes
boolList hasOutsideNeighbour_; boolList hasOutsideNeighbour_;
//- label of cubes at processor boundaries //- label of cubes at processor boundaries
labelLongList communicationCubes_; labelLongList communicationCubes_;
//- labels of cubes marked by different threads //- labels of cubes marked by different threads
VRWGraph neighbouringGroups_; VRWGraph neighbouringGroups_;
// Private member functions // Private member functions
//- initialise octree boxes //- initialise octree boxes
void initialiseBoxes(); void initialiseBoxes();
//- frontal marking algorithm //- frontal marking algorithm
void frontalMarking(); void frontalMarking();
//- mark OUTSIDE octree boxes //- mark OUTSIDE octree boxes
void markOutsideCubes(); void markOutsideCubes();
//- revise DATA boxes //- revise DATA boxes
void reviseDataBoxes(); void reviseDataBoxes();
//- mark INSIDE octree boxes //- mark INSIDE octree boxes
void markInsideCubes(); void markInsideCubes();
public: public:
// Constructor // Constructor
//- Construct from octree //- Construct from octree
meshOctreeInsideOutside meshOctreeInsideOutside
( (
meshOctree& octree meshOctree& octree
); );
// Destructor // Destructor
~meshOctreeInsideOutside(); ~meshOctreeInsideOutside();
}; };

View file

@ -55,7 +55,7 @@ class boxRefinement
// Private data // Private data
//- centre of the box //- centre of the box
point centre_; point centre_;
//- length of box sides //- length of box sides
scalar lengthX_; scalar lengthX_;
scalar lengthY_; scalar lengthY_;
@ -86,7 +86,7 @@ public:
//- Construct from dictionary //- Construct from dictionary
boxRefinement(const word& name, const dictionary& dict); boxRefinement(const word& name, const dictionary& dict);
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<objectRefinement> clone virtual autoPtr<objectRefinement> clone
( (
@ -107,12 +107,12 @@ public:
) )
); );
} }
// Member Functions // Member Functions
//- check if a boundBox intersects or is inside the object //- check if a boundBox intersects or is inside the object
bool intersectsObject(const boundBox&) const; bool intersectsObject(const boundBox&) const;
//- Return as dictionary of entries //- Return as dictionary of entries
dictionary dict(bool ignoreType = false) const; dictionary dict(bool ignoreType = false) const;
@ -123,7 +123,7 @@ public:
//- Write dictionary //- Write dictionary
void writeDict(Ostream&, bool subDict = true) const; void writeDict(Ostream&, bool subDict = true) const;
// Member Operators // Member Operators
//- assign from dictionary //- assign from dictionary

View file

@ -85,22 +85,22 @@ bool coneRefinement::intersectsObject(const boundBox& bb) const
{ {
//- check if the centre is inside the cone //- check if the centre is inside the cone
const point c = (bb.max() + bb.min()) / 2.0; const point c = (bb.max() + bb.min()) / 2.0;
const vector v = p1_ - p0_; const vector v = p1_ - p0_;
const scalar d = magSqr(v); const scalar d = magSqr(v);
if( d < VSMALL ) if( d < VSMALL )
return false; return false;
const scalar t = ((c - p0_) & v) / d; const scalar t = ((c - p0_) & v) / d;
if( (t > 1.0) || (t < 0.0) ) if( (t > 1.0) || (t < 0.0) )
return false; return false;
const scalar r = r0_ + (r1_ - r0_) * t; const scalar r = r0_ + (r1_ - r0_) * t;
if( mag(p0_ + t * v - c) < r ) if( mag(p0_ + t * v - c) < r )
return true; return true;
return false; return false;
} }
@ -144,7 +144,7 @@ void coneRefinement::writeDict(Ostream& os, bool subDict) const
{ {
os << indent << token::BEGIN_BLOCK << incrIndent << nl; os << indent << token::BEGIN_BLOCK << incrIndent << nl;
} }
if( additionalRefinementLevels() == 0 && cellSize() >= 0.0 ) if( additionalRefinementLevels() == 0 && cellSize() >= 0.0 )
{ {
os.writeKeyword("cellSize") << cellSize() << token::END_STATEMENT << nl; os.writeKeyword("cellSize") << cellSize() << token::END_STATEMENT << nl;
@ -166,7 +166,7 @@ void coneRefinement::writeDict(Ostream& os, bool subDict) const
os.writeKeyword("radius0") << r0_ << token::END_STATEMENT << nl; os.writeKeyword("radius0") << r0_ << token::END_STATEMENT << nl;
os.writeKeyword("p1") << p1_ << token::END_STATEMENT << nl; os.writeKeyword("p1") << p1_ << token::END_STATEMENT << nl;
os.writeKeyword("radius1") << r1_ << token::END_STATEMENT << nl; os.writeKeyword("radius1") << r1_ << token::END_STATEMENT << nl;
if( subDict ) if( subDict )
{ {
os << decrIndent << indent << token::END_BLOCK << endl; os << decrIndent << indent << token::END_BLOCK << endl;
@ -210,7 +210,7 @@ void coneRefinement::operator=(const dictionary& d)
) << "Entry radius0 is not specified!" << exit(FatalError); ) << "Entry radius0 is not specified!" << exit(FatalError);
r0_ = -1.0; r0_ = -1.0;
} }
// unspecified centre is (0 0 0) // unspecified centre is (0 0 0)
if( dict.found("p1") ) if( dict.found("p1") )
{ {
@ -251,9 +251,9 @@ Ostream& coneRefinement::operator<<(Ostream& os) const
write(os); write(os);
return os; return os;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View file

@ -56,7 +56,7 @@ class coneRefinement
//- start point and the radius //- start point and the radius
point p0_; point p0_;
scalar r0_; scalar r0_;
//- end point and the radius //- end point and the radius
point p1_; point p1_;
scalar r1_; scalar r1_;
@ -86,7 +86,7 @@ public:
//- Construct from dictionary //- Construct from dictionary
coneRefinement(const word& name, const dictionary& dict); coneRefinement(const word& name, const dictionary& dict);
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<objectRefinement> clone virtual autoPtr<objectRefinement> clone
( (
@ -107,12 +107,12 @@ public:
) )
); );
} }
// Member Functions // Member Functions
//- check if a boundBox intersects or is inside the object //- check if a boundBox intersects or is inside the object
bool intersectsObject(const boundBox&) const; bool intersectsObject(const boundBox&) const;
//- Return as dictionary of entries //- Return as dictionary of entries
dictionary dict(bool ignoreType = false) const; dictionary dict(bool ignoreType = false) const;
@ -123,7 +123,7 @@ public:
//- Write dictionary //- Write dictionary
void writeDict(Ostream&, bool subDict = true) const; void writeDict(Ostream&, bool subDict = true) const;
// Member Operators // Member Operators
//- assign from dictionary //- assign from dictionary

View file

@ -93,23 +93,23 @@ bool hollowConeRefinement::intersectsObject(const boundBox& bb) const
{ {
//- check if the centre is inside the cone //- check if the centre is inside the cone
const point c = (bb.max() + bb.min()) / 2.0; const point c = (bb.max() + bb.min()) / 2.0;
const vector v = p1_ - p0_; const vector v = p1_ - p0_;
const scalar d = magSqr(v); const scalar d = magSqr(v);
if( d < VSMALL ) if( d < VSMALL )
return false; return false;
const scalar t = ((c - p0_) & v) / d; const scalar t = ((c - p0_) & v) / d;
if( (t > 1.0) || (t < 0.0) ) if( (t > 1.0) || (t < 0.0) )
return false; return false;
const scalar rOuter = r0Outer_ + (r1Outer_ - r0Outer_) * t; const scalar rOuter = r0Outer_ + (r1Outer_ - r0Outer_) * t;
const scalar rInner = r0Inner_ + (r1Inner_ - r0Inner_) * t; const scalar rInner = r0Inner_ + (r1Inner_ - r0Inner_) * t;
if(( mag(p0_ + t * v - c) < rOuter ) && ( mag(p0_ + t * v - c) > rInner )) if(( mag(p0_ + t * v - c) < rOuter ) && ( mag(p0_ + t * v - c) > rInner ))
return true; return true;
return false; return false;
} }
@ -157,7 +157,7 @@ void hollowConeRefinement::writeDict(Ostream& os, bool subDict) const
{ {
os << indent << token::BEGIN_BLOCK << incrIndent << nl; os << indent << token::BEGIN_BLOCK << incrIndent << nl;
} }
if( additionalRefinementLevels() == 0 && cellSize() >= 0.0 ) if( additionalRefinementLevels() == 0 && cellSize() >= 0.0 )
{ {
os.writeKeyword("cellSize") << cellSize() << token::END_STATEMENT << nl; os.writeKeyword("cellSize") << cellSize() << token::END_STATEMENT << nl;
@ -181,7 +181,7 @@ void hollowConeRefinement::writeDict(Ostream& os, bool subDict) const
os.writeKeyword("p1") << p1_ << token::END_STATEMENT << nl; os.writeKeyword("p1") << p1_ << token::END_STATEMENT << nl;
os.writeKeyword("radius1_Outer") << r1Outer_ << token::END_STATEMENT << nl; os.writeKeyword("radius1_Outer") << r1Outer_ << token::END_STATEMENT << nl;
os.writeKeyword("radius1_Inner") << r1Inner_ << token::END_STATEMENT << nl; os.writeKeyword("radius1_Inner") << r1Inner_ << token::END_STATEMENT << nl;
if( subDict ) if( subDict )
{ {
os << decrIndent << indent << token::END_BLOCK << endl; os << decrIndent << indent << token::END_BLOCK << endl;
@ -240,7 +240,7 @@ void hollowConeRefinement::operator=(const dictionary& d)
r0Inner_ = -1.0; r0Inner_ = -1.0;
} }
// unspecified centre is (0 0 0) // unspecified centre is (0 0 0)
if( dict.found("p1") ) if( dict.found("p1") )
{ {
@ -295,9 +295,9 @@ Ostream& hollowConeRefinement::operator<<(Ostream& os) const
write(os); write(os);
return os; return os;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View file

@ -57,7 +57,7 @@ class hollowConeRefinement
point p0_; point p0_;
scalar r0Outer_; scalar r0Outer_;
scalar r0Inner_; scalar r0Inner_;
//- end point and the radii //- end point and the radii
point p1_; point p1_;
scalar r1Outer_; scalar r1Outer_;
@ -90,7 +90,7 @@ public:
//- Construct from dictionary //- Construct from dictionary
hollowConeRefinement(const word& name, const dictionary& dict); hollowConeRefinement(const word& name, const dictionary& dict);
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<objectRefinement> clone virtual autoPtr<objectRefinement> clone
( (
@ -113,12 +113,12 @@ public:
) )
); );
} }
// Member Functions // Member Functions
//- check if a boundBox intersects or is inside the object //- check if a boundBox intersects or is inside the object
bool intersectsObject(const boundBox&) const; bool intersectsObject(const boundBox&) const;
//- Return as dictionary of entries //- Return as dictionary of entries
dictionary dict(bool ignoreType = false) const; dictionary dict(bool ignoreType = false) const;
@ -129,7 +129,7 @@ public:
//- Write dictionary //- Write dictionary
void writeDict(Ostream&, bool subDict = true) const; void writeDict(Ostream&, bool subDict = true) const;
// Member Operators // Member Operators
//- assign from dictionary //- assign from dictionary

View file

@ -79,7 +79,7 @@ bool lineRefinement::intersectsObject(const boundBox& bb) const
{ {
//- check if the cube contains start point or end point //- check if the cube contains start point or end point
const scalar l = bb.max().x() - bb.min().x(); const scalar l = bb.max().x() - bb.min().x();
const point min = bb.min() - l * vector(SMALL, SMALL, SMALL); const point min = bb.min() - l * vector(SMALL, SMALL, SMALL);
const point max = bb.max() + l * vector(SMALL, SMALL, SMALL); const point max = bb.max() + l * vector(SMALL, SMALL, SMALL);
@ -240,7 +240,7 @@ void lineRefinement::writeDict(Ostream& os, bool subDict) const
{ {
os << indent << token::BEGIN_BLOCK << incrIndent << nl; os << indent << token::BEGIN_BLOCK << incrIndent << nl;
} }
if( additionalRefinementLevels() == 0 && cellSize() >= 0.0 ) if( additionalRefinementLevels() == 0 && cellSize() >= 0.0 )
{ {
os.writeKeyword("cellSize") << cellSize() << token::END_STATEMENT << nl; os.writeKeyword("cellSize") << cellSize() << token::END_STATEMENT << nl;
@ -317,9 +317,9 @@ Ostream& lineRefinement::operator<<(Ostream& os) const
write(os); write(os);
return os; return os;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View file

@ -55,7 +55,7 @@ class lineRefinement
// Private data // Private data
//- start point of the line //- start point of the line
point p0_; point p0_;
//- end point of the line //- end point of the line
point p1_; point p1_;
@ -82,7 +82,7 @@ public:
//- Construct from dictionary //- Construct from dictionary
lineRefinement(const word& name, const dictionary& dict); lineRefinement(const word& name, const dictionary& dict);
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<objectRefinement> clone virtual autoPtr<objectRefinement> clone
( (
@ -101,12 +101,12 @@ public:
) )
); );
} }
// Member Functions // Member Functions
//- check if the line intersects the box //- check if the line intersects the box
bool intersectsObject(const boundBox&) const; bool intersectsObject(const boundBox&) const;
//- Return as dictionary of entries //- Return as dictionary of entries
dictionary dict(bool ignoreType = false) const; dictionary dict(bool ignoreType = false) const;
@ -117,7 +117,7 @@ public:
//- Write dictionary //- Write dictionary
void writeDict(Ostream&, bool subDict = true) const; void writeDict(Ostream&, bool subDict = true) const;
// Member Operators // Member Operators
//- assign from dictionary //- assign from dictionary

View file

@ -78,10 +78,10 @@ sphereRefinement::sphereRefinement
bool sphereRefinement::intersectsObject(const boundBox& bb) const bool sphereRefinement::intersectsObject(const boundBox& bb) const
{ {
const point& c = (bb.max() + bb.min()) / 2.0; const point& c = (bb.max() + bb.min()) / 2.0;
if( magSqr(c - centre_) < sqr(radius_) ) if( magSqr(c - centre_) < sqr(radius_) )
return true; return true;
return false; return false;
} }
@ -121,7 +121,7 @@ void sphereRefinement::writeDict(Ostream& os, bool subDict) const
{ {
os << indent << token::BEGIN_BLOCK << incrIndent << nl; os << indent << token::BEGIN_BLOCK << incrIndent << nl;
} }
if( additionalRefinementLevels() == 0 && cellSize() >= 0.0 ) if( additionalRefinementLevels() == 0 && cellSize() >= 0.0 )
{ {
os.writeKeyword("cellSize") << cellSize() << token::END_STATEMENT << nl; os.writeKeyword("cellSize") << cellSize() << token::END_STATEMENT << nl;
@ -198,9 +198,9 @@ Ostream& sphereRefinement::operator<<(Ostream& os) const
write(os); write(os);
return os; return os;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View file

@ -55,7 +55,7 @@ class sphereRefinement
// Private data // Private data
//- centre of the sphere //- centre of the sphere
point centre_; point centre_;
//- radius of the sphere //- radius of the sphere
scalar radius_; scalar radius_;
@ -82,7 +82,7 @@ public:
//- Construct from dictionary //- Construct from dictionary
sphereRefinement(const word& name, const dictionary& dict); sphereRefinement(const word& name, const dictionary& dict);
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<objectRefinement> clone virtual autoPtr<objectRefinement> clone
( (
@ -101,12 +101,12 @@ public:
) )
); );
} }
// Member Functions // Member Functions
//- check if a boundBox intersects or is inside the object //- check if a boundBox intersects or is inside the object
bool intersectsObject(const boundBox&) const; bool intersectsObject(const boundBox&) const;
//- Return as dictionary of entries //- Return as dictionary of entries
dictionary dict(bool ignoreType = false) const; dictionary dict(bool ignoreType = false) const;
@ -117,7 +117,7 @@ public:
//- Write dictionary //- Write dictionary
void writeDict(Ostream&, bool subDict = true) const; void writeDict(Ostream&, bool subDict = true) const;
// Member Operators // Member Operators
//- assign from dictionary //- assign from dictionary

View file

@ -35,53 +35,53 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Private member functions // Private member functions
scalar knuppMetric::evaluateMetric() const scalar knuppMetric::evaluateMetric() const
{ {
scalar val(0.0); scalar val(0.0);
forAll(normals_, nI) forAll(normals_, nI)
{ {
const scalar fx = (normals_[nI] & (p_ - centres_[nI])) - beta_; const scalar fx = (normals_[nI] & (p_ - centres_[nI])) - beta_;
val += Foam::sqr(mag(fx) - fx); val += Foam::sqr(mag(fx) - fx);
} }
return val; return val;
} }
scalar knuppMetric::evaluateMetricNoBeta() const scalar knuppMetric::evaluateMetricNoBeta() const
{ {
scalar val(0.0); scalar val(0.0);
forAll(normals_, nI) forAll(normals_, nI)
{ {
const scalar fx = (normals_[nI] & (p_ - centres_[nI])); const scalar fx = (normals_[nI] & (p_ - centres_[nI]));
val += Foam::sqr(mag(fx) - fx); val += Foam::sqr(mag(fx) - fx);
} }
return val; return val;
} }
void knuppMetric::evaluateGradients(vector& grad, tensor& gradGrad) const void knuppMetric::evaluateGradients(vector& grad, tensor& gradGrad) const
{ {
grad = vector::zero; grad = vector::zero;
gradGrad = tensor::zero; gradGrad = tensor::zero;
forAll(normals_, nI) forAll(normals_, nI)
{ {
const scalar fx = (normals_[nI] & (p_ - centres_[nI])) - beta_; const scalar fx = (normals_[nI] & (p_ - centres_[nI])) - beta_;
const vector gfx = (Foam::sign(fx) - 1) * normals_[nI]; const vector gfx = (Foam::sign(fx) - 1) * normals_[nI];
grad += (Foam::mag(fx) - fx) * gfx; grad += (Foam::mag(fx) - fx) * gfx;
gradGrad += gfx * gfx; gradGrad += gfx * gfx;
} }
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
knuppMetric::knuppMetric(partTetMeshSimplex& simplex) knuppMetric::knuppMetric(partTetMeshSimplex& simplex)
: :
simplexSmoother(simplex), simplexSmoother(simplex),
@ -99,20 +99,20 @@ knuppMetric::knuppMetric(partTetMeshSimplex& simplex)
points_[pt.b()], points_[pt.b()],
points_[pt.c()] points_[pt.c()]
); );
const vector n = tri.normal(); const vector n = tri.normal();
const scalar d = mag(n); const scalar d = mag(n);
if( d > VSMALL ) if( d > VSMALL )
{ {
centres_.append(tri.centre()); centres_.append(tri.centre());
normals_.append(n/d); normals_.append(n/d);
} }
} }
beta_ = 0.01 * bb_.mag(); beta_ = 0.01 * bb_.mag();
} }
knuppMetric::~knuppMetric() knuppMetric::~knuppMetric()
{ {
@ -134,7 +134,7 @@ void knuppMetric::optimizeNodePosition(const scalar tolObsolete)
tensor gradGradF; tensor gradGradF;
scalar func, lastFunc; scalar func, lastFunc;
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
forAll(normals_, nI) forAll(normals_, nI)
{ {
@ -145,14 +145,14 @@ void knuppMetric::optimizeNodePosition(const scalar tolObsolete)
Info << "BoundBox size " << (bb_.max() - bb_.min()) << endl; Info << "BoundBox size " << (bb_.max() - bb_.min()) << endl;
Info << "Tolerance " << tol << endl; Info << "Tolerance " << tol << endl;
# endif # endif
bool finished; bool finished;
do do
{ {
finished = true; finished = true;
lastFunc = evaluateMetric(); lastFunc = evaluateMetric();
iterI = 0; iterI = 0;
do do
{ {
@ -160,19 +160,19 @@ void knuppMetric::optimizeNodePosition(const scalar tolObsolete)
Info << "Iteration " << iterI << endl; Info << "Iteration " << iterI << endl;
Info << "Initial metric value " << lastFunc << endl; Info << "Initial metric value " << lastFunc << endl;
# endif # endif
//- store previous value //- store previous value
const point pOrig = p_; const point pOrig = p_;
//- evaluate gradients //- evaluate gradients
evaluateGradients(gradF, gradGradF); evaluateGradients(gradF, gradGradF);
//- calculate displacement //- calculate displacement
const scalar determinant = det(gradGradF); const scalar determinant = det(gradGradF);
if( determinant > SMALL ) if( determinant > SMALL )
{ {
disp = (inv(gradGradF, determinant) & gradF); disp = (inv(gradGradF, determinant) & gradF);
for(direction i=0;i<vector::nComponents;++i) for(direction i=0;i<vector::nComponents;++i)
{ {
const scalar& val = disp[i]; const scalar& val = disp[i];
@ -182,11 +182,11 @@ void knuppMetric::optimizeNodePosition(const scalar tolObsolete)
break; break;
} }
} }
p_ -= disp; p_ -= disp;
func = evaluateMetric(); func = evaluateMetric();
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "Second grad " << gradGradF << endl; Info << "Second grad " << gradGradF << endl;
Info << "inv(gradGradF, determinant) " << inv(gradGradF, determinant) << endl; Info << "inv(gradGradF, determinant) " << inv(gradGradF, determinant) << endl;
@ -195,7 +195,7 @@ void knuppMetric::optimizeNodePosition(const scalar tolObsolete)
Info << "Displacement " << disp << endl; Info << "Displacement " << disp << endl;
Info << "New metric value " << func << endl; Info << "New metric value " << func << endl;
# endif # endif
scalar relax(0.8); scalar relax(0.8);
label nLoops(0); label nLoops(0);
@ -204,10 +204,10 @@ void knuppMetric::optimizeNodePosition(const scalar tolObsolete)
p_ = pOrig - relax * disp; p_ = pOrig - relax * disp;
relax *= 0.5; relax *= 0.5;
func = evaluateMetric(); func = evaluateMetric();
if( func < lastFunc ) if( func < lastFunc )
continue; continue;
//- it seems that this direction is wrong //- it seems that this direction is wrong
if( ++nLoops == 5 ) if( ++nLoops == 5 )
{ {
@ -216,7 +216,7 @@ void knuppMetric::optimizeNodePosition(const scalar tolObsolete)
func = 0.0; func = 0.0;
} }
} }
lastFunc = func; lastFunc = func;
} }
else else
@ -224,15 +224,15 @@ void knuppMetric::optimizeNodePosition(const scalar tolObsolete)
disp = vector::zero; disp = vector::zero;
} }
} while( (magSqr(disp) > tol) && (++iterI < 10) ); } while( (magSqr(disp) > tol) && (++iterI < 10) );
if( (lastFunc < VSMALL) && (evaluateMetricNoBeta() > VSMALL) ) if( (lastFunc < VSMALL) && (evaluateMetricNoBeta() > VSMALL) )
{ {
beta_ /= 2.0; beta_ /= 2.0;
finished = false; finished = false;
} }
} while( !finished && (++outerIter < 5) ); } while( !finished && (++outerIter < 5) );
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "Last value " << lastFunc << endl; Info << "Last value " << lastFunc << endl;
Info << "Beta " << beta_ << endl; Info << "Beta " << beta_ << endl;

View file

@ -42,7 +42,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward declarations
class partTetMeshSimplex; class partTetMeshSimplex;
@ -58,21 +58,21 @@ class knuppMetric
// Private data // Private data
//- free vertex //- free vertex
point& p_; point& p_;
//- normals of triangles forming the outer hull //- normals of triangles forming the outer hull
DynList<vector, 64> normals_; DynList<vector, 64> normals_;
//- centres of triangles forming the outer hull //- centres of triangles forming the outer hull
DynList<point, 64> centres_; DynList<point, 64> centres_;
//- control parameter. It helps the point get inside the feasible region //- control parameter. It helps the point get inside the feasible region
scalar beta_; scalar beta_;
// Private member functions // Private member functions
//- evaluate the value of the metric //- evaluate the value of the metric
scalar evaluateMetric() const; scalar evaluateMetric() const;
scalar evaluateMetricNoBeta() const; scalar evaluateMetricNoBeta() const;
//- evaluate metric gradients //- evaluate metric gradients
void evaluateGradients(vector& grad, tensor& gradGrad) const; void evaluateGradients(vector& grad, tensor& gradGrad) const;

View file

@ -40,7 +40,7 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
meshUntangler::meshUntangler meshUntangler::meshUntangler
@ -62,9 +62,9 @@ void meshUntangler::optimizeNodePosition(const scalar tol)
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "Untangling point " << pointI_ << endl; Info << "Untangling point " << pointI_ << endl;
# endif # endif
cutRegion cr(bb_); cutRegion cr(bb_);
forAll(tets_, tetI) forAll(tets_, tetI)
{ {
const partTet& tet = tets_[tetI]; const partTet& tet = tets_[tetI];
@ -73,41 +73,41 @@ void meshUntangler::optimizeNodePosition(const scalar tol)
(points_[tet.b()] - points_[tet.a()]) ^ (points_[tet.b()] - points_[tet.a()]) ^
(points_[tet.c()] - points_[tet.a()]) (points_[tet.c()] - points_[tet.a()])
); );
if( mag(n) < VSMALL ) continue; if( mag(n) < VSMALL ) continue;
plane pl(points_[tet.a()], n); plane pl(points_[tet.a()], n);
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "tet.a() " << tet.a() << endl; Info << "tet.a() " << tet.a() << endl;
Info << "Cutting plane ref point " << pl.refPoint() << endl; Info << "Cutting plane ref point " << pl.refPoint() << endl;
Info << "Cutting plane normal " << pl.normal() << endl; Info << "Cutting plane normal " << pl.normal() << endl;
# endif # endif
cr.planeCut(pl); cr.planeCut(pl);
} }
if( cr.points().size() ) if( cr.points().size() )
{ {
point p(vector::zero); point p(vector::zero);
const DynList<point, 64>& pts = cr.points(); const DynList<point, 64>& pts = cr.points();
forAll(pts, pI) forAll(pts, pI)
p += pts[pI]; p += pts[pI];
p /= pts.size(); p /= pts.size();
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
Info << "Corners of the feasible region " << pts << endl; Info << "Corners of the feasible region " << pts << endl;
# endif # endif
for(direction i=0;i<vector::nComponents;++i) for(direction i=0;i<vector::nComponents;++i)
{ {
const scalar& val = p[i]; const scalar& val = p[i];
if( (val != val) || ((val - val) != (val - val)) ) if( (val != val) || ((val - val) != (val - val)) )
return; return;
} }
points_[pointI_] = p; points_[pointI_] = p;
} }
} }

View file

@ -51,48 +51,48 @@ class partTetMeshSimplex;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class meshUntangler Declaration Class meshUntangler Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class meshUntangler class meshUntangler
: :
public simplexSmoother public simplexSmoother
{ {
// Private nested classes // Private nested classes
class cutRegion class cutRegion
{ {
// Private data // Private data
DynList<point, 64>* pointsPtr_; DynList<point, 64>* pointsPtr_;
DynList<edge, 128>* edgesPtr_; DynList<edge, 128>* edgesPtr_;
DynList<DynList<label, 8>, 64>* facesPtr_; DynList<DynList<label, 8>, 64>* facesPtr_;
//- helper data //- helper data
DynList<point, 64>* cPtsPtr_; DynList<point, 64>* cPtsPtr_;
DynList<edge, 128>* cEdgesPtr_; DynList<edge, 128>* cEdgesPtr_;
DynList<DynList<label, 8>, 64>* cFacesPtr_; DynList<DynList<label, 8>, 64>* cFacesPtr_;
DynList<label, 64> newVertexLabel_; DynList<label, 64> newVertexLabel_;
DynList<scalar, 64> vertexDistance_; DynList<scalar, 64> vertexDistance_;
DynList<direction, 64> vertexTypes_; DynList<direction, 64> vertexTypes_;
DynList<label, 128> newEdgeLabel_; DynList<label, 128> newEdgeLabel_;
label origNumVertices_; label origNumVertices_;
scalar tol_; scalar tol_;
bool valid_; bool valid_;
// Private member functions // Private member functions
bool findNewVertices(const plane& plane); bool findNewVertices(const plane& plane);
void findNewEdges(); void findNewEdges();
void findNewFaces(); void findNewFaces();
//- tie break to resolve problems due to truncation //- tie break to resolve problems due to truncation
//- errors //- errors
void tieBreak(const DynList<label, 8>& f); void tieBreak(const DynList<label, 8>& f);
//- remove coincident vertices to improve tie breaking //- remove coincident vertices to improve tie breaking
void removeCoincidentVertices(); void removeCoincidentVertices();
void createInitialConfiguration(const boundBox&); void createInitialConfiguration(const boundBox&);
// Enumerations // Enumerations
enum vTypes enum vTypes
{ {
@ -101,39 +101,39 @@ class meshUntangler
INPLANE = 2, INPLANE = 2,
USED = 4 USED = 4
}; };
public: public:
// Constructor // Constructor
//- Construct from boundBox //- Construct from boundBox
cutRegion(const boundBox&); cutRegion(const boundBox&);
// Destructor // Destructor
~cutRegion(); ~cutRegion();
// Member functions // Member functions
//- return the vertices of the feasible region //- return the vertices of the feasible region
inline const DynList<point, 64>& points() const inline const DynList<point, 64>& points() const
{ {
return *pointsPtr_; return *pointsPtr_;
} }
//- cut the region woth the plane //- cut the region woth the plane
void planeCut(const plane& plane); void planeCut(const plane& plane);
//- export the feasible region as polyMeshGen //- export the feasible region as polyMeshGen
void createPolyMeshFromRegion(polyMeshGen&) const; void createPolyMeshFromRegion(polyMeshGen&) const;
}; };
public: public:
// Constructor // Constructor
//- Construct from partTetMeshSimplex //- Construct from partTetMeshSimplex
meshUntangler(partTetMeshSimplex& simplex); meshUntangler(partTetMeshSimplex& simplex);
// Destructor // Destructor
~meshUntangler(); ~meshUntangler();
// Member functions // Member functions
//- improve the position the the node by putting it //- improve the position the the node by putting it
//- into the feasible region //- into the feasible region

View file

@ -34,7 +34,7 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void meshUntangler::cutRegion::findNewEdges() void meshUntangler::cutRegion::findNewEdges()
@ -42,13 +42,13 @@ void meshUntangler::cutRegion::findNewEdges()
#ifdef DEBUGSmooth #ifdef DEBUGSmooth
Info << "Creating new edgesPtr_" << endl; Info << "Creating new edgesPtr_" << endl;
#endif #endif
cEdgesPtr_ = new DynList<edge, 128>(); cEdgesPtr_ = new DynList<edge, 128>();
DynList<edge, 128>& cEdges = *cEdgesPtr_; DynList<edge, 128>& cEdges = *cEdgesPtr_;
const DynList<point, 64>& pts = *pointsPtr_; const DynList<point, 64>& pts = *pointsPtr_;
const DynList<edge, 128>& edges = *edgesPtr_; const DynList<edge, 128>& edges = *edgesPtr_;
newEdgeLabel_.setSize(edges.size()); newEdgeLabel_.setSize(edges.size());
newEdgeLabel_ = -1; newEdgeLabel_ = -1;
@ -59,7 +59,7 @@ void meshUntangler::cutRegion::findNewEdges()
const label end = e.end(); const label end = e.end();
const label newStartLabel = newVertexLabel_[start]; const label newStartLabel = newVertexLabel_[start];
const label newEndLabel = newVertexLabel_[end]; const label newEndLabel = newVertexLabel_[end];
if( (newStartLabel != -1) && (newEndLabel != -1) ) if( (newStartLabel != -1) && (newEndLabel != -1) )
{ {
newEdgeLabel_[eI] = cEdges.size(); newEdgeLabel_[eI] = cEdges.size();
@ -70,11 +70,11 @@ void meshUntangler::cutRegion::findNewEdges()
//- start edge vertex is not visible, but the other one is //- start edge vertex is not visible, but the other one is
newEdgeLabel_[eI] = cEdges.size(); newEdgeLabel_[eI] = cEdges.size();
cEdges.append(edge(newEndLabel, cPtsPtr_->size())); cEdges.append(edge(newEndLabel, cPtsPtr_->size()));
const scalar t = const scalar t =
-vertexDistance_[start] / -vertexDistance_[start] /
(vertexDistance_[end] - vertexDistance_[start]); (vertexDistance_[end] - vertexDistance_[start]);
const point newP = (1.0 - t) * pts[start] + t * pts[end]; const point newP = (1.0 - t) * pts[start] + t * pts[end];
cPtsPtr_->append(newP); cPtsPtr_->append(newP);
} }
@ -83,15 +83,15 @@ void meshUntangler::cutRegion::findNewEdges()
//- end edge vertex is not visible, but the other one is //- end edge vertex is not visible, but the other one is
newEdgeLabel_[eI] = cEdges.size(); newEdgeLabel_[eI] = cEdges.size();
cEdges.append(edge(newStartLabel, cPtsPtr_->size())); cEdges.append(edge(newStartLabel, cPtsPtr_->size()));
const scalar t = const scalar t =
-vertexDistance_[end] / -vertexDistance_[end] /
(vertexDistance_[start] - vertexDistance_[end]); (vertexDistance_[start] - vertexDistance_[end]);
const point newP = (1.0 - t) * pts[end] + t * pts[start]; const point newP = (1.0 - t) * pts[end] + t * pts[start];
cPtsPtr_->append(newP); cPtsPtr_->append(newP);
} }
# ifdef DEBUGSmooth # ifdef DEBUGSmooth
if( newEdgeLabel_[eI] != -1 ) if( newEdgeLabel_[eI] != -1 )
{ {
@ -105,7 +105,7 @@ void meshUntangler::cutRegion::findNewEdges()
} }
# endif # endif
} }
#ifdef DEBUGSmooth #ifdef DEBUGSmooth
Info << "Found " << cEdges.size() << " new edges" << endl; Info << "Found " << cEdges.size() << " new edges" << endl;
#endif #endif

View file

@ -45,50 +45,50 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward declarations
class partTetMeshSimplex; class partTetMeshSimplex;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class simplexSmoother Declaration Class simplexSmoother Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
//- class for volume optimizer //- class for volume optimizer
class simplexSmoother class simplexSmoother
{ {
protected: protected:
// Protected data // Protected data
//- mesh points //- mesh points
DynList<point, 128>& points_; DynList<point, 128>& points_;
//- list tets around the given vertex //- list tets around the given vertex
const DynList<partTet, 128>& tets_; const DynList<partTet, 128>& tets_;
//- label of the point //- label of the point
const label pointI_; const label pointI_;
//- bound box //- bound box
boundBox bb_; boundBox bb_;
private: private:
// Private member functions // Private member functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
simplexSmoother(const simplexSmoother&); simplexSmoother(const simplexSmoother&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const simplexSmoother&); void operator=(const simplexSmoother&);
public: public:
// Constructor // Constructor
//- construct from partTetMeshSimplex //- construct from partTetMeshSimplex
simplexSmoother(partTetMeshSimplex& simplex); simplexSmoother(partTetMeshSimplex& simplex);
// Destructor // Destructor
virtual ~simplexSmoother(); virtual ~simplexSmoother();
// Member functions // Member functions
//- improve the position of the centre node //- improve the position of the centre node
virtual void optimizeNodePosition(const scalar tol = 0.001) = 0; virtual void optimizeNodePosition(const scalar tol = 0.001) = 0;

View file

@ -46,7 +46,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward declarations
class meshSurfaceEngine; class meshSurfaceEngine;
@ -59,39 +59,39 @@ class checkBoundaryFacesSharingTwoEdges
// Private data // Private data
//- Reference to polyMeshGen //- Reference to polyMeshGen
polyMeshGen& mesh_; polyMeshGen& mesh_;
//- pointer to meshSurfaceEngine //- pointer to meshSurfaceEngine
mutable meshSurfaceEngine* meshSurfacePtr_; mutable meshSurfaceEngine* meshSurfacePtr_;
//- number of boundary faces attached to a boundary vertex //- number of boundary faces attached to a boundary vertex
labelList nBndFacesAtBndPoint_; labelList nBndFacesAtBndPoint_;
//- a list of boundary points which can be removed from the mesh //- a list of boundary points which can be removed from the mesh
boolList removeBndPoint_; boolList removeBndPoint_;
// Private member functions // Private member functions
//- creates meshSurfaceEngine //- creates meshSurfaceEngine
void createMeshSurface() const; void createMeshSurface() const;
//- returns mesh surface //- returns mesh surface
inline const meshSurfaceEngine& meshSurface() const inline const meshSurfaceEngine& meshSurface() const
{ {
if( !meshSurfacePtr_ ) if( !meshSurfacePtr_ )
createMeshSurface(); createMeshSurface();
return *meshSurfacePtr_; return *meshSurfacePtr_;
} }
//- find the faces connected to each boundary edge //- find the faces connected to each boundary edge
//- mark the points which can be removed //- mark the points which can be removed
void findFacesAtBndEdge(); void findFacesAtBndEdge();
//- find the number of faces connected to the boundary vertex //- find the number of faces connected to the boundary vertex
void findBndFacesAtBndVertex(); void findBndFacesAtBndVertex();
//- remove vertices from the faces //- remove vertices from the faces
void removeExcessiveVertices(); void removeExcessiveVertices();
//- find boundary faces which shall be decomposed into triangles //- find boundary faces which shall be decomposed into triangles
label findBndFacesForDecomposition(boolList& decomposeFace); label findBndFacesForDecomposition(boolList& decomposeFace);

View file

@ -52,7 +52,7 @@ checkIrregularSurfaceConnections::checkIrregularSurfaceConnections
checkIrregularSurfaceConnections::~checkIrregularSurfaceConnections() checkIrregularSurfaceConnections::~checkIrregularSurfaceConnections()
{ {
clearMeshEngine(); clearMeshEngine();
mesh_.clearAddressingData(); mesh_.clearAddressingData();
} }
@ -64,41 +64,41 @@ void checkIrregularSurfaceConnections::checkIrregularVertices
) )
{ {
checkAndFixCellGroupsAtBndVertices(badVertices, false); checkAndFixCellGroupsAtBndVertices(badVertices, false);
checkEdgeFaceConnections(badVertices, false); checkEdgeFaceConnections(badVertices, false);
checkFaceGroupsAtBndVertices(badVertices, false); checkFaceGroupsAtBndVertices(badVertices, false);
} }
bool checkIrregularSurfaceConnections::checkAndFixIrregularConnections() bool checkIrregularSurfaceConnections::checkAndFixIrregularConnections()
{ {
Info << "Checking for irregular surface connections" << endl; Info << "Checking for irregular surface connections" << endl;
bool finished; bool finished;
labelHashSet badVertices; labelHashSet badVertices;
do do
{ {
finished = true; finished = true;
while( checkAndFixCellGroupsAtBndVertices(badVertices, true) ) while( checkAndFixCellGroupsAtBndVertices(badVertices, true) )
finished = false; finished = false;
while( checkEdgeFaceConnections(badVertices, true) ) while( checkEdgeFaceConnections(badVertices, true) )
finished = false; finished = false;
if( checkFaceGroupsAtBndVertices(badVertices, true) ) if( checkFaceGroupsAtBndVertices(badVertices, true) )
finished = false; finished = false;
} while( !finished ); } while( !finished );
polyMeshGenModifier(mesh_).removeUnusedVertices(); polyMeshGenModifier(mesh_).removeUnusedVertices();
Info << "Finished checking for irregular surface connections" << endl; Info << "Finished checking for irregular surface connections" << endl;
if( returnReduce(badVertices.size(), sumOp<label>()) != 0 ) if( returnReduce(badVertices.size(), sumOp<label>()) != 0 )
return true; return true;
return false; return false;
} }

View file

@ -54,7 +54,7 @@ class checkIrregularSurfaceConnections
// Private data // Private data
//- Reference to polyMeshGen //- Reference to polyMeshGen
polyMeshGen& mesh_; polyMeshGen& mesh_;
//- pointer to meshSurfaceEngine //- pointer to meshSurfaceEngine
mutable meshSurfaceEngine* meshSurfacePtr_; mutable meshSurfaceEngine* meshSurfacePtr_;
@ -64,16 +64,16 @@ class checkIrregularSurfaceConnections
{ {
if( !meshSurfacePtr_ ) if( !meshSurfacePtr_ )
meshSurfacePtr_ = new meshSurfaceEngine(mesh_); meshSurfacePtr_ = new meshSurfaceEngine(mesh_);
return *meshSurfacePtr_; return *meshSurfacePtr_;
} }
//- clear meshSurfaceEngine. Used in case if the mesh is modified //- clear meshSurfaceEngine. Used in case if the mesh is modified
inline void clearMeshEngine() inline void clearMeshEngine()
{ {
deleteDemandDrivenData(meshSurfacePtr_); deleteDemandDrivenData(meshSurfacePtr_);
} }
//- check if there exist vertices with more than one groups of cells //- check if there exist vertices with more than one groups of cells
//- attached to it //- attached to it
bool checkAndFixCellGroupsAtBndVertices bool checkAndFixCellGroupsAtBndVertices
@ -81,7 +81,7 @@ class checkIrregularSurfaceConnections
labelHashSet& badVertices, labelHashSet& badVertices,
const bool removeConnections = false const bool removeConnections = false
); );
//- check if all boundary edges are connected //- check if all boundary edges are connected
//- to two boundary faces, only! //- to two boundary faces, only!
bool checkEdgeFaceConnections bool checkEdgeFaceConnections
@ -89,7 +89,7 @@ class checkIrregularSurfaceConnections
labelHashSet& badVertices, labelHashSet& badVertices,
const bool removeCells = false const bool removeCells = false
); );
//- check if all boundary face connected to a boundary vertex //- check if all boundary face connected to a boundary vertex
//- are connected into a single group of faces that can be visited //- are connected into a single group of faces that can be visited
//- over edges //- over edges

View file

@ -56,12 +56,12 @@ class checkNonMappableCellConnections
// Private data // Private data
//- Reference to polyMeshGen //- Reference to polyMeshGen
polyMeshGen& mesh_; polyMeshGen& mesh_;
//- type of cell //- type of cell
labelList cellType_; labelList cellType_;
// Enumerations // Enumerations
enum cellTypes_ enum cellTypes_
{ {
NONE = 0, NONE = 0,

View file

@ -52,22 +52,22 @@ class topologicalCleaner
{ {
// Private data // Private data
polyMeshGen& mesh_; polyMeshGen& mesh_;
bool changed_; bool changed_;
boolList decomposeCell_; boolList decomposeCell_;
// Private member functions // Private member functions
//- check and fix incorrectly connected faces //- check and fix incorrectly connected faces
void checkNonConsecutiveBoundaryVertices(); void checkNonConsecutiveBoundaryVertices();
//- check and fix non-mappable faces //- check and fix non-mappable faces
void checkNonMappableFaces(); void checkNonMappableFaces();
//- check and fix non-mappable cells //- check and fix non-mappable cells
void checkNonMappableCells(); void checkNonMappableCells();
//- decompose marked cells //- decompose marked cells
void decomposeCells(); void decomposeCells();
@ -99,7 +99,7 @@ public:
( (
labelHashSet* irregularNodes = NULL labelHashSet* irregularNodes = NULL
); );
//- check and fix vertices where two or more groups of faces meet //- check and fix vertices where two or more groups of faces meet
void checkInvalidConnectionsForVerticesFaces void checkInvalidConnectionsForVerticesFaces
( (

View file

@ -59,17 +59,17 @@ class meshSurfaceCheckInvertedVertices
// Private data // Private data
//- mesh surface partitioner //- mesh surface partitioner
const meshSurfacePartitioner& surfacePartitioner_; const meshSurfacePartitioner& surfacePartitioner_;
//- active surface points //- active surface points
const boolList* activePointsPtr_; const boolList* activePointsPtr_;
//- set of inverted vertices //- set of inverted vertices
labelHashSet invertedVertices_; labelHashSet invertedVertices_;
// Private member functions // Private member functions
//- check vertices by calculating dot products //- check vertices by calculating dot products
void checkVertices(); void checkVertices();
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
meshSurfaceCheckInvertedVertices meshSurfaceCheckInvertedVertices
( (

View file

@ -56,11 +56,11 @@ class meshSurfaceEdgeExtractor
// Private data // Private data
//- mesh //- mesh
polyMeshGen& mesh_; polyMeshGen& mesh_;
label nPoints_; label nPoints_;
boolList boundaryCell_; boolList boundaryCell_;
List<direction> nFacesInCell_; List<direction> nFacesInCell_;
//- reference to the octree //- reference to the octree
@ -72,10 +72,10 @@ class meshSurfaceEdgeExtractor
// Private member functions // Private member functions
//- remove old boundary faces //- remove old boundary faces
void removeOldBoundaryFaces(); void removeOldBoundaryFaces();
//- create vertices on surface edges //- create vertices on surface edges
void createEdgeVertices(); void createEdgeVertices();
//- create new boundary faces //- create new boundary faces
void createBoundaryFaces(); void createBoundaryFaces();

View file

@ -59,7 +59,7 @@ class meshSurfaceEngineModifier
void operator=(const meshSurfaceEngineModifier&); void operator=(const meshSurfaceEngineModifier&);
public: public:
// Constructors // Constructors
//- Construct from reference to meshSurfaceEngine //- Construct from reference to meshSurfaceEngine
@ -73,25 +73,25 @@ public:
~meshSurfaceEngineModifier(); ~meshSurfaceEngineModifier();
// Member Functions // Member Functions
//- relocate the selected boundary vertex //- relocate the selected boundary vertex
void moveBoundaryVertexNoUpdate(const label bpI, const point& newP); void moveBoundaryVertexNoUpdate(const label bpI, const point& newP);
//- relocate the selected boundary vertex and update geometry data //- relocate the selected boundary vertex and update geometry data
void moveBoundaryVertex(const label bpI, const point& newP); void moveBoundaryVertex(const label bpI, const point& newP);
//- update normals of boundary vertices at processor boundaries //- update normals of boundary vertices at processor boundaries
inline void updateVertexNormals() inline void updateVertexNormals()
{ {
if( surfaceEngine_.pointNormalsPtr_ ) if( surfaceEngine_.pointNormalsPtr_ )
surfaceEngine_.updatePointNormalsAtProcBoundaries(); surfaceEngine_.updatePointNormalsAtProcBoundaries();
} }
//- updates faceCentres, face normal, and point normals //- updates faceCentres, face normal, and point normals
//- of the boundary faces attached to the selected boundary points //- of the boundary faces attached to the selected boundary points
void updateGeometry(const labelLongList&); void updateGeometry(const labelLongList&);
void updateGeometry(); void updateGeometry();
//- makes sure that all surface vertices at parallel boundaries //- makes sure that all surface vertices at parallel boundaries
//- have the same coordinates //- have the same coordinates
void syncVerticesAtParallelBoundaries(); void syncVerticesAtParallelBoundaries();

View file

@ -39,7 +39,7 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void meshSurfaceMapper::createMeshSurfacePartitioner() const void meshSurfaceMapper::createMeshSurfacePartitioner() const
@ -51,7 +51,7 @@ void meshSurfaceMapper::createTriSurfacePartitioner() const
{ {
surfPartitionerPtr_ = new triSurfacePartitioner(meshOctree_.surface()); surfPartitionerPtr_ = new triSurfacePartitioner(meshOctree_.surface());
} }
void meshSurfaceMapper::clearOut() void meshSurfaceMapper::clearOut()
{ {
if( deletePartitioner_ ) if( deletePartitioner_ )

View file

@ -56,9 +56,9 @@ class parMapperHelper
scalar movingDist_; scalar movingDist_;
label globalLabel_; label globalLabel_;
label patch_; label patch_;
public: public:
// Constructors // Constructors
explicit inline parMapperHelper() explicit inline parMapperHelper()
: :
@ -67,7 +67,7 @@ class parMapperHelper
globalLabel_(-1), globalLabel_(-1),
patch_(-1) patch_(-1)
{}; {};
explicit inline parMapperHelper explicit inline parMapperHelper
( (
const point& p, const point& p,
@ -81,7 +81,7 @@ class parMapperHelper
globalLabel_(globalLabel), globalLabel_(globalLabel),
patch_(patchLabel) patch_(patchLabel)
{} {}
// Destructor // Destructor
~parMapperHelper() ~parMapperHelper()
{}; {};
@ -92,27 +92,27 @@ class parMapperHelper
{ {
return p_; return p_;
} }
//- return moving distance //- return moving distance
inline const scalar& movingDistance() const inline const scalar& movingDistance() const
{ {
return movingDist_; return movingDist_;
} }
//- return global label //- return global label
inline label globalLabel() const inline label globalLabel() const
{ {
return globalLabel_; return globalLabel_;
} }
//- return patch the point is mapped to //- return patch the point is mapped to
inline label pointPatch() const inline label pointPatch() const
{ {
return patch_; return patch_;
} }
// Operators // Operators
inline void operator=(const parMapperHelper& h) inline void operator=(const parMapperHelper& h)
{ {
p_ = h.p_; p_ = h.p_;
@ -120,15 +120,15 @@ class parMapperHelper
globalLabel_ = h.globalLabel_; globalLabel_ = h.globalLabel_;
patch_ = h.patch_; patch_ = h.patch_;
} }
inline bool operator!=(const parMapperHelper& h) const inline bool operator!=(const parMapperHelper& h) const
{ {
if( globalLabel_ != h.globalLabel_ ) if( globalLabel_ != h.globalLabel_ )
return true; return true;
return false; return false;
} }
// Friend operators // Friend operators
friend Ostream& operator<<(Ostream& os, const parMapperHelper& h) friend Ostream& operator<<(Ostream& os, const parMapperHelper& h)
{ {
@ -142,23 +142,23 @@ class parMapperHelper
os.check("operator<<(Ostream&, const parMapperHelper&"); os.check("operator<<(Ostream&, const parMapperHelper&");
return os; return os;
} }
friend Istream& operator>>(Istream& is, parMapperHelper& h) friend Istream& operator>>(Istream& is, parMapperHelper& h)
{ {
// Read beginning of parMapperHelper // Read beginning of parMapperHelper
is.readBegin("parMapperHelper"); is.readBegin("parMapperHelper");
is >> h.p_; is >> h.p_;
is >> h.movingDist_; is >> h.movingDist_;
is >> h.globalLabel_; is >> h.globalLabel_;
is >> h.patch_; is >> h.patch_;
// Read end of parMapperHelper // Read end of parMapperHelper
is.readEnd("parMapperHelper"); is.readEnd("parMapperHelper");
// Check state of Istream // Check state of Istream
is.check("operator>>(Istream&, parMapperHelper"); is.check("operator>>(Istream&, parMapperHelper");
return is; return is;
} }
}; };

View file

@ -54,14 +54,14 @@ class renameBoundaryPatches
// Private data // Private data
//- mesh //- mesh
polyMeshGen& mesh_; polyMeshGen& mesh_;
//- dictionary containing relevant information //- dictionary containing relevant information
const IOdictionary& meshDict_; const IOdictionary& meshDict_;
// Private member functions // Private member functions
//- calculate new boundary and replace the existing one //- calculate new boundary and replace the existing one
void calculateNewBoundary(); void calculateNewBoundary();
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
renameBoundaryPatches(const renameBoundaryPatches&); renameBoundaryPatches(const renameBoundaryPatches&);

View file

@ -57,18 +57,18 @@ class surfaceMorpherCells
//- number of internal faces //- number of internal faces
label nIntFaces_; label nIntFaces_;
//- true for vertices which are at the boundary //- true for vertices which are at the boundary
boolList boundaryVertex_; boolList boundaryVertex_;
//- true for cells which are at the boundary //- true for cells which are at the boundary
List<direction> cellFlags_; List<direction> cellFlags_;
//- new boundary faces and owner cells //- new boundary faces and owner cells
VRWGraph newBoundaryFaces_; VRWGraph newBoundaryFaces_;
labelLongList newBoundaryOwners_; labelLongList newBoundaryOwners_;
labelLongList newBoundaryPatches_; labelLongList newBoundaryPatches_;
// Private enumerators // Private enumerators
enum cellTypes enum cellTypes
{ {
@ -80,19 +80,19 @@ class surfaceMorpherCells
// Private member functions // Private member functions
//- find surface vertices //- find surface vertices
void findBoundaryVertices(); void findBoundaryVertices();
//- find boundary cells //- find boundary cells
void findBoundaryCells(); void findBoundaryCells();
//- remove cells with all vertices at the boundary //- remove cells with all vertices at the boundary
bool removeCellsWithAllVerticesAtTheBoundary(); bool removeCellsWithAllVerticesAtTheBoundary();
//- morph boundary faces //- morph boundary faces
bool morphBoundaryFaces(); bool morphBoundaryFaces();
//- morph internal faces //- morph internal faces
bool morphInternalFaces(); bool morphInternalFaces();
//- replace the boundary of the mesh with the newly created one //- replace the boundary of the mesh with the newly created one
void replaceMeshBoundary(); void replaceMeshBoundary();

View file

@ -35,9 +35,9 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const meshOctreeCubeCoordinates tetCreatorOctree::edgeCoordinates_[12][4]= const meshOctreeCubeCoordinates tetCreatorOctree::edgeCoordinates_[12][4]=
{ {
{ //- edge 0 { //- edge 0
@ -113,7 +113,7 @@ const meshOctreeCubeCoordinates tetCreatorOctree::edgeCoordinates_[12][4]=
meshOctreeCubeCoordinates(0, 1, 0, 0) meshOctreeCubeCoordinates(0, 1, 0, 0)
} }
}; };
const label tetCreatorOctree::faceCentreHelper_[3][4] = const label tetCreatorOctree::faceCentreHelper_[3][4] =
{ {
{3, 5, 2, 4}, {3, 5, 2, 4},
@ -124,18 +124,18 @@ const label tetCreatorOctree::faceCentreHelper_[3][4] =
void tetCreatorOctree::createTets() void tetCreatorOctree::createTets()
{ {
createPointsAndAddressing(); createPointsAndAddressing();
createTetsFromFacesWithCentreNode(); createTetsFromFacesWithCentreNode();
createTetsAroundSplitEdges(); createTetsAroundSplitEdges();
createTetsAroundEdges(); createTetsAroundEdges();
createTetsFromSplitFaces(); createTetsFromSplitFaces();
clearOut(); clearOut();
sortedLeaves_.setSize(0); sortedLeaves_.setSize(0);
created_ = true; created_ = true;
} }
@ -166,7 +166,7 @@ tetCreatorOctree::tetCreatorOctree
created_(false) created_(false)
{ {
createTets(); createTets();
clearOut(); clearOut();
} }

View file

@ -56,65 +56,65 @@ class tetCreatorOctree
// Private data // Private data
//- helper for searching coordinates of cubes around an edge //- helper for searching coordinates of cubes around an edge
static const meshOctreeCubeCoordinates edgeCoordinates_[12][4]; static const meshOctreeCubeCoordinates edgeCoordinates_[12][4];
//- helper for finding face centres of cubes sharing an edge //- helper for finding face centres of cubes sharing an edge
static const label faceCentreHelper_[3][4]; static const label faceCentreHelper_[3][4];
//- reference to the octree //- reference to the octree
meshOctreeAddressing octreeCheck_; meshOctreeAddressing octreeCheck_;
//- points of the tetrahedrisation //- points of the tetrahedrisation
LongList<point> tetPoints_; LongList<point> tetPoints_;
//- tetrahedra //- tetrahedra
LongList<partTet> tets_; LongList<partTet> tets_;
//- octree leaves sorted according to their level //- octree leaves sorted according to their level
List<labelLongList> sortedLeaves_; List<labelLongList> sortedLeaves_;
//- node labels of vertices created inside split-hex boxes //- node labels of vertices created inside split-hex boxes
VRWGraph* subNodeLabelsPtr_; VRWGraph* subNodeLabelsPtr_;
//- cube centre label //- cube centre label
labelList* cubeLabelPtr_; labelList* cubeLabelPtr_;
//- cube face label //- cube face label
VRWGraph* faceCentreLabelPtr_; VRWGraph* faceCentreLabelPtr_;
//- are tets created or not //- are tets created or not
bool created_; bool created_;
// Private member functions // Private member functions
//- deletes all pointer data //- deletes all pointer data
void clearOut(); void clearOut();
//- find elements which will be used as mesh cells //- find elements which will be used as mesh cells
void selectElements(); void selectElements();
// Private member functions for creating tetrahedra // Private member functions for creating tetrahedra
//- create tetPoints_ and necessary addressing //- create tetPoints_ and necessary addressing
void createPointsAndAddressing(); void createPointsAndAddressing();
//- create faceCentreLabelPtr_ //- create faceCentreLabelPtr_
void createFaceCentreLabels(); void createFaceCentreLabels();
//- create tetrahedra from faces, owner and neighbour //- create tetrahedra from faces, owner and neighbour
void createTetsAroundEdges(); void createTetsAroundEdges();
//- create tetrahedra from split faces //- create tetrahedra from split faces
void createTetsFromSplitFaces(); void createTetsFromSplitFaces();
//- create tetrahedra from faces which share at least one edge //- create tetrahedra from faces which share at least one edge
//- with a refined cube //- with a refined cube
void createTetsFromFacesWithCentreNode(); void createTetsFromFacesWithCentreNode();
//- create tetrahedra from faces with split edges //- create tetrahedra from faces with split edges
void createTetsAroundSplitEdges(); void createTetsAroundSplitEdges();
//- helper funtion which checks validity of a created tet and appends //- helper funtion which checks validity of a created tet and appends
//- it if valid //- it if valid
inline void checkAndAppendTet(const partTet); inline void checkAndAppendTet(const partTet);
//- function containing the workflow //- function containing the workflow
void createTets(); void createTets();
@ -149,10 +149,10 @@ public:
( (
"const LongList<point>& tetPoints() const" "const LongList<point>& tetPoints() const"
) << "Tets are not created!" << exit(FatalError); ) << "Tets are not created!" << exit(FatalError);
return tetPoints_; return tetPoints_;
} }
const LongList<partTet>& tets() const const LongList<partTet>& tets() const
{ {
if( !created_ ) if( !created_ )
@ -160,7 +160,7 @@ public:
( (
"const LongList<point>& tets() const" "const LongList<point>& tets() const"
) << "Tets are not created!" << exit(FatalError); ) << "Tets are not created!" << exit(FatalError);
return tets_; return tets_;
} }
}; };

View file

@ -34,67 +34,67 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void tetCreatorOctree::createTetsFromFacesWithCentreNode() void tetCreatorOctree::createTetsFromFacesWithCentreNode()
{ {
Info << "Creating tets from faces with centre node" << endl; Info << "Creating tets from faces with centre node" << endl;
const labelList& cubeLabel = *cubeLabelPtr_; const labelList& cubeLabel = *cubeLabelPtr_;
const VRWGraph& nodeLabels = octreeCheck_.nodeLabels(); const VRWGraph& nodeLabels = octreeCheck_.nodeLabels();
const VRWGraph& subNodeLabels = *subNodeLabelsPtr_; const VRWGraph& subNodeLabels = *subNodeLabelsPtr_;
const FRWGraph<label, 8>& pointLeaves = octreeCheck_.nodeLeaves(); const FRWGraph<label, 8>& pointLeaves = octreeCheck_.nodeLeaves();
if( !faceCentreLabelPtr_ ) if( !faceCentreLabelPtr_ )
faceCentreLabelPtr_ = new VRWGraph(cubeLabel.size()); faceCentreLabelPtr_ = new VRWGraph(cubeLabel.size());
VRWGraph& faceCentreLabel = *faceCentreLabelPtr_; VRWGraph& faceCentreLabel = *faceCentreLabelPtr_;
//- start creating tets //- start creating tets
forAll(pointLeaves, pointI) forAll(pointLeaves, pointI)
{ {
label pl[8]; label pl[8];
bool create(true); bool create(true);
for(label plI=0;plI<8;++plI) for(label plI=0;plI<8;++plI)
{ {
pl[plI] = pointLeaves(pointI, plI); pl[plI] = pointLeaves(pointI, plI);
if( pl[plI] == -1 ) if( pl[plI] == -1 )
{ {
create = false; create = false;
break; break;
} }
} }
if( !create ) if( !create )
continue; continue;
//- create 6 tets for each possible combination //- create 6 tets for each possible combination
//- there are 12 possible combinations //- there are 12 possible combinations
for(label fI=0;fI<6;++fI) for(label fI=0;fI<6;++fI)
{ {
const label* fEdges = meshOctreeCubeCoordinates::faceEdges_[fI]; const label* fEdges = meshOctreeCubeCoordinates::faceEdges_[fI];
for(label feI=0;feI<2;++feI) for(label feI=0;feI<2;++feI)
{ {
const label feJ = feI + 2; const label feJ = feI + 2;
//- the are two possible combinations of edges for each face //- the are two possible combinations of edges for each face
const label* sEdge = const label* sEdge =
meshOctreeCubeCoordinates::edgeNodes_[fEdges[feI]]; meshOctreeCubeCoordinates::edgeNodes_[fEdges[feI]];
const label* eEdge = const label* eEdge =
meshOctreeCubeCoordinates::edgeNodes_[fEdges[feJ]]; meshOctreeCubeCoordinates::edgeNodes_[fEdges[feJ]];
const label sp = sEdge[0]; const label sp = sEdge[0];
const label ep = eEdge[0]; const label ep = eEdge[0];
if( pl[sp] == pl[ep] ) if( pl[sp] == pl[ep] )
continue; continue;
if( pl[sp] != pl[sEdge[1]] ) if( pl[sp] != pl[sEdge[1]] )
continue; continue;
if( pl[ep] != pl[eEdge[1]] ) if( pl[ep] != pl[eEdge[1]] )
continue; continue;
# ifdef DEBUGTets # ifdef DEBUGTets
Info << "Octree node " << pointI << " has leaves"; Info << "Octree node " << pointI << " has leaves";
for(label plI=0;plI<8;++plI) for(label plI=0;plI<8;++plI)
@ -103,7 +103,7 @@ void tetCreatorOctree::createTetsFromFacesWithCentreNode()
Info << "Searching face " << fI << endl; Info << "Searching face " << fI << endl;
Info << "Searching face edge " << feI << endl; Info << "Searching face edge " << feI << endl;
# endif # endif
//- allocate face centre labels //- allocate face centre labels
if( faceCentreLabel.sizeOfRow(pl[sp]) == 0 ) if( faceCentreLabel.sizeOfRow(pl[sp]) == 0 )
{ {
@ -119,22 +119,22 @@ void tetCreatorOctree::createTetsFromFacesWithCentreNode()
} }
//- create centre labels //- create centre labels
label fs, fe; label fs, fe;
fs = meshOctreeCubeCoordinates::edgeFaces_[fEdges[feJ]][0]; fs = meshOctreeCubeCoordinates::edgeFaces_[fEdges[feJ]][0];
if( fs == fI ) if( fs == fI )
fs = meshOctreeCubeCoordinates::edgeFaces_[fEdges[feJ]][1]; fs = meshOctreeCubeCoordinates::edgeFaces_[fEdges[feJ]][1];
fe = meshOctreeCubeCoordinates::edgeFaces_[fEdges[feI]][0]; fe = meshOctreeCubeCoordinates::edgeFaces_[fEdges[feI]][0];
if( fe == fI ) if( fe == fI )
fe = meshOctreeCubeCoordinates::edgeFaces_[fEdges[feI]][1]; fe = meshOctreeCubeCoordinates::edgeFaces_[fEdges[feI]][1];
# ifdef DEBUGTets # ifdef DEBUGTets
Info << "Face for the cube at edge " << feI << " is " Info << "Face for the cube at edge " << feI << " is "
<< fs << endl; << fs << endl;
Info << "Face for the cube at edge " << feJ << " is " Info << "Face for the cube at edge " << feJ << " is "
<< fe << endl; << fe << endl;
#endif #endif
//- create face centre point //- create face centre point
if( faceCentreLabel(pl[sp], fs) == -1 ) if( faceCentreLabel(pl[sp], fs) == -1 )
{ {
@ -147,7 +147,7 @@ void tetCreatorOctree::createTetsFromFacesWithCentreNode()
p /= 4; p /= 4;
tetPoints_.append(p); tetPoints_.append(p);
} }
//- create tets connecting centroids //- create tets connecting centroids
checkAndAppendTet checkAndAppendTet
( (
@ -169,17 +169,17 @@ void tetCreatorOctree::createTetsFromFacesWithCentreNode()
cubeLabel[pl[sp]] cubeLabel[pl[sp]]
) )
); );
FixedList<label, 4> subNodes; FixedList<label, 4> subNodes;
subNodes[0] = subNodeLabels(pl[sp], 7-sEdge[1]); subNodes[0] = subNodeLabels(pl[sp], 7-sEdge[1]);
subNodes[1] = subNodeLabels(pl[sp], 7-sEdge[0]); subNodes[1] = subNodeLabels(pl[sp], 7-sEdge[0]);
subNodes[2] = subNodeLabels(pl[ep], 7-eEdge[0]); subNodes[2] = subNodeLabels(pl[ep], 7-eEdge[0]);
subNodes[3] = subNodeLabels(pl[ep], 7-eEdge[1]); subNodes[3] = subNodeLabels(pl[ep], 7-eEdge[1]);
# ifdef DEBUGTets # ifdef DEBUGTets
Info << "Sub nodes are " << subNodes << endl; Info << "Sub nodes are " << subNodes << endl;
# endif # endif
forAll(subNodes, nodeI) forAll(subNodes, nodeI)
{ {
checkAndAppendTet checkAndAppendTet

View file

@ -39,11 +39,11 @@ inline void tetCreatorOctree::checkAndAppendTet(const partTet pt)
valid = false; valid = false;
break; break;
} }
if( valid ) if( valid )
{ {
tets_.append(pt); tets_.append(pt);
# ifdef DEBUGTets # ifdef DEBUGTets
Info << "Added tet " << (tets_.size()-1) << " is " Info << "Added tet " << (tets_.size()-1) << " is "
<< tets_[tets_.size()-1] << endl; << tets_[tets_.size()-1] << endl;

View file

@ -34,31 +34,31 @@ Description
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void tetCreatorOctree::createTetsFromSplitFaces() void tetCreatorOctree::createTetsFromSplitFaces()
{ {
Info << "Creating tets from split faces" << endl; Info << "Creating tets from split faces" << endl;
const labelList& cubeLabel = *cubeLabelPtr_; const labelList& cubeLabel = *cubeLabelPtr_;
const VRWGraph& subNodeLabels = *subNodeLabelsPtr_; const VRWGraph& subNodeLabels = *subNodeLabelsPtr_;
const FRWGraph<label, 8>& pLeaves = octreeCheck_.nodeLeaves(); const FRWGraph<label, 8>& pLeaves = octreeCheck_.nodeLeaves();
forAll(pLeaves, pointI) forAll(pLeaves, pointI)
{ {
for(label i=0;i<6;++i) for(label i=0;i<6;++i)
{ {
const label* fNodes = const label* fNodes =
meshOctreeCubeCoordinates::faceNodes_[i]; meshOctreeCubeCoordinates::faceNodes_[i];
const label cLabel = pLeaves(pointI, fNodes[0]); const label cLabel = pLeaves(pointI, fNodes[0]);
if( cLabel < 0 ) if( cLabel < 0 )
continue; continue;
if( cubeLabel[cLabel] < 0 ) if( cubeLabel[cLabel] < 0 )
continue; continue;
if( if(
(cLabel == pLeaves(pointI, fNodes[1])) && (cLabel == pLeaves(pointI, fNodes[1])) &&
(cLabel == pLeaves(pointI, fNodes[2])) && (cLabel == pLeaves(pointI, fNodes[2])) &&

View file

@ -47,7 +47,7 @@ anisotropicSources
scaleY 1; scaleY 1;
scaleZ 0.3; scaleZ 0.3;
} }
/* /*
planeUpper planeUpper
{ {
@ -57,7 +57,7 @@ anisotropicSources
scalingDistance 125; scalingDistance 125;
scalingFactor 0.5; scalingFactor 0.5;
} }
planeLower planeLower
{ {
type plane; type plane;
@ -68,7 +68,7 @@ anisotropicSources
} }
*/ */
} }
boundaryLayers boundaryLayers
{ {
@ -80,7 +80,7 @@ boundaryLayers
thicknessRatio 1.1; thicknessRatio 1.1;
} }
} }
optimiseLayer 1; optimiseLayer 1;
optimisationParameters optimisationParameters

View file

@ -2,7 +2,7 @@ cfMesh Example Case
Date: 02 October 2014 Date: 02 October 2014
Application: cartesianMesh Application: cartesianMesh
Goal: Demonstration of the regular expressions feature available within Goal: Demonstration of the regular expressions feature available within
cfMesh for specifying patch names in the meshDict file. cfMesh for specifying patch names in the meshDict file.
STL File: singleOrifice.stl STL File: singleOrifice.stl

View file

@ -27,7 +27,7 @@ minCellSize 0.50;
anisotropicSources anisotropicSources
{ {
Plane Plane
{ {
type plane; type plane;
origin (0 0 -20); origin (0 0 -20);

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | cfMesh: A library for mesh generation | | \\ / F ield | cfMesh: A library for mesh generation |
| \\ / O peration | | | \\ / O peration | |
| \\ / A nd | Author: Franjo Juretic | | \\ / A nd | Author: Franjo Juretic |
| \\/ M anipulation | E-mail: franjo.juretic@c-fields.com | | \\/ M anipulation | E-mail: franjo.juretic@c-fields.com |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | cfMesh: A library for mesh generation | | \\ / F ield | cfMesh: A library for mesh generation |
| \\ / O peration | | | \\ / O peration | |
| \\ / A nd | Author: Franjo Juretic | | \\ / A nd | Author: Franjo Juretic |
| \\/ M anipulation | E-mail: franjo.juretic@c-fields.com | | \\/ M anipulation | E-mail: franjo.juretic@c-fields.com |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | cfMesh: A library for mesh generation | | \\ / F ield | cfMesh: A library for mesh generation |
| \\ / O peration | | | \\ / O peration | |
| \\ / A nd | Author: Franjo Juretic | | \\ / A nd | Author: Franjo Juretic |
| \\/ M anipulation | E-mail: franjo.juretic@c-fields.com | | \\/ M anipulation | E-mail: franjo.juretic@c-fields.com |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View file

@ -2,7 +2,7 @@ cfMesh Example Case
Date: 08 June 2015 Date: 08 June 2015
Application: pMesh Application: pMesh
Goal: Demonstration of the regular expressions feature available within Goal: Demonstration of the regular expressions feature available within
cfMesh for specifying patch names in the meshDict file. cfMesh for specifying patch names in the meshDict file.
STL File: multipleOrifices.stl STL File: multipleOrifices.stl

View file

@ -1,8 +1,8 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | cfMesh: A library for mesh generation | | \\ / F ield | cfMesh: A library for mesh generation |
| \\ / O peration | | | \\ / O peration | |
| \\ / A nd | Author: Franjo Juretic | | \\ / A nd | Author: Franjo Juretic |
| \\/ M anipulation | E-mail: franjo.juretic@c-fields.com | | \\/ M anipulation | E-mail: franjo.juretic@c-fields.com |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

Some files were not shown because too many files have changed in this diff Show more