diff --git a/applications/solvers/Lagrangian/kinematicParcelFoam/Make/files b/applications/solvers/Lagrangian/kinematicParcelFoam/Make/files index f98171fc93..a63fc64fa7 100644 --- a/applications/solvers/Lagrangian/kinematicParcelFoam/Make/files +++ b/applications/solvers/Lagrangian/kinematicParcelFoam/Make/files @@ -1,3 +1,3 @@ kinematicParcelFoam.C -EXE = $(FOAM_USER_APPBIN)/kinematicParcelFoam +EXE = $(FOAM_APPBIN)/kinematicParcelFoam diff --git a/applications/solvers/Lagrangian/kinematicParcelFoam/kinematicParcelFoam.C b/applications/solvers/Lagrangian/kinematicParcelFoam/kinematicParcelFoam.C index 290480583c..57b3dc5d13 100644 --- a/applications/solvers/Lagrangian/kinematicParcelFoam/kinematicParcelFoam.C +++ b/applications/solvers/Lagrangian/kinematicParcelFoam/kinematicParcelFoam.C @@ -26,7 +26,8 @@ Application kinematicParcelFoam Description - Transient solver a single kinematicCloud. + Transient solver for a single kinematicCloud. Uses precalculated velocity + field to evolve a cloud. \*---------------------------------------------------------------------------*/ diff --git a/applications/solvers/multiphase/interDyMFoam/Make/options b/applications/solvers/multiphase/interDyMFoam/Make/options index 24d71bc7ee..6755d5bc59 100644 --- a/applications/solvers/multiphase/interDyMFoam/Make/options +++ b/applications/solvers/multiphase/interDyMFoam/Make/options @@ -1,4 +1,6 @@ EXE_INC = \ + -I../rasInterFoam \ + -I../interFoam \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ diff --git a/applications/solvers/multiphase/interDyMFoam/UEqn.H b/applications/solvers/multiphase/interDyMFoam/UEqn.H deleted file mode 100644 index 4c14afe1a6..0000000000 --- a/applications/solvers/multiphase/interDyMFoam/UEqn.H +++ /dev/null @@ -1,34 +0,0 @@ -surfaceScalarField muEff -( - "muEff", - twoPhaseProperties.muf() - + fvc::interpolate(rho*turbulence->nut()) -); - -fvVectorMatrix UEqn -( - fvm::ddt(rho, U) - + fvm::div(rhoPhi, U) - - fvm::laplacian(muEff, U) - - (fvc::grad(U) & fvc::grad(muEff)) -//- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf())) -); - -UEqn.relax(); - -if (momentumPredictor) -{ - solve - ( - UEqn - == - fvc::reconstruct - ( - ( - fvc::interpolate(interface.sigmaK())*fvc::snGrad(gamma) - - ghf*fvc::snGrad(rho) - - fvc::snGrad(pd) - )*mesh.magSf() - ) - ); -} diff --git a/applications/solvers/multiphase/interDyMFoam/gammaEqn.H b/applications/solvers/multiphase/interDyMFoam/gammaEqn.H deleted file mode 100644 index 8978d1d293..0000000000 --- a/applications/solvers/multiphase/interDyMFoam/gammaEqn.H +++ /dev/null @@ -1,35 +0,0 @@ -{ - word gammaScheme("div(phi,gamma)"); - word gammarScheme("div(phirb,gamma)"); - - surfaceScalarField phic = mag(phi/mesh.magSf()); - phic = min(interface.cGamma()*phic, max(phic)); - surfaceScalarField phir = phic*interface.nHatf(); - - for (int gCorr=0; gCorr 1) -{ - dimensionedScalar totalDeltaT = runTime.deltaT(); - surfaceScalarField rhoPhiSum = 0.0*rhoPhi; - - for - ( - subCycle gammaSubCycle(gamma, nGammaSubCycles); - !(++gammaSubCycle).end(); - ) - { -# include "gammaEqn.H" - rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi; - } - - rhoPhi = rhoPhiSum; -} -else -{ -# include "gammaEqn.H" -} - -interface.correct(); - -rho == gamma*rho1 + (scalar(1) - gamma)*rho2; diff --git a/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C index a126edaa92..915fee9a97 100644 --- a/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interDyMFoam/interDyMFoam.C @@ -41,7 +41,6 @@ Description #include "twoPhaseMixture.H" #include "incompressible/RASModel/RASModel.H" #include "probes.H" -#include "EulerDdtScheme.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L index f0c8e0a6c4..a8cb5dbb98 100644 --- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L @@ -697,7 +697,7 @@ endOfSection {space}")"{space} /* ------ Ignore remaining space and \n s. ------ */ -<*>{some_space}|\n { +<*>{some_space}|\n|\r { } diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/writeSurfFields.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/writeSurfFields.C index 5e40ed5871..58107bc776 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/writeSurfFields.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/writeSurfFields.C @@ -28,7 +28,7 @@ License #include "OFstream.H" #include "floatScalar.H" #include "writeFuns.H" -#include "emptyFvPatchFields.H" +#include "emptyFvsPatchFields.H" #include "fvsPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -100,7 +100,7 @@ void writeSurfFields const fvPatch& pp = mesh.boundary()[patchI]; - if (isA(pf)) + if (isA(pf)) { // Note: loop over polypatch size, not fvpatch size. forAll(pp.patch(), i) diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C index cf0771d260..aa30790b5c 100644 --- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C +++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.C @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) indexedOctree selectTree ( treeDataTriSurface(selectSurf), - bb.extend(rndGen, 1E-3), // slightly randomize bb + bb.extend(rndGen, 1E-4), // slightly randomize bb 8, // maxLevel 10, // leafsize 3.0 // duplicity diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc index 56cdd8aacf..b8da8ba698 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/apps/paraview3/bashrc @@ -45,9 +45,9 @@ export ParaView_INST_DIR=$WM_THIRD_PARTY_DIR/ParaView$ParaView_VERSION export ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER if [ "$PYTHONPATH" ]; then - export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/Utilities/VTKPythonWrapping + export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3 else - export PYTHONPATH=$ParaView_DIR/Utilities/VTKPythonWrapping + export PYTHONPATH=$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3 fi diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index c9fd98f4a2..636b10eb75 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -45,9 +45,9 @@ setenv ParaView_INST_DIR $WM_THIRD_PARTY_DIR/ParaView$ParaView_VERSION setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER if ($?PYTHONPATH) then - setenv PYTHONPATH ${PYTHONPATH}:$ParaView_DIR/bin:$ParaView_DIR/Utilities/VTKPythonWrapping + setenv PYTHONPATH ${PYTHONPATH}:$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3 else - setenv PYTHONPATH $ParaView_DIR/bin:$ParaView_DIR/Utilities/VTKPythonWrapping + setenv PYTHONPATH $ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3 endif if ( -r $ParaView_INST_DIR ) then diff --git a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C new file mode 100644 index 0000000000..b5c199e9be --- /dev/null +++ b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#ifndef HashSet_C +#define HashSet_C + +#include "HashSet.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template +bool HashSet::operator==(const HashSet& ht) const +{ + const HashTable& a = *this; + + // Are all my elements in ht? + for + ( + typename HashTable::const_iterator iter = a.begin(); + iter != a.end(); + ++iter + ) + { + if (!ht.found(iter.key())) + { + return false; + } + } + + // Are all ht elements in me? + for + ( + typename HashTable::const_iterator iter = ht.begin(); + iter != ht.end(); + ++iter + ) + { + if (!found(iter.key())) + { + return false; + } + } + return true; +} + + +template +bool HashSet::operator!=(const HashSet& ht) const +{ + return !(operator==(ht)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H index 654b743add..3985e574fb 100644 --- a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H +++ b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H @@ -100,6 +100,17 @@ public: { return HashTable::insert(key, empty()); } + + + // Member Operators + + //- Equality. Two hashtables are equal if all contents of first are + // also in second and vice versa. So does not depend on table size or + // order! + bool operator==(const HashSet&) const; + + //- The opposite of the equality operation. + bool operator!=(const HashSet&) const; }; @@ -112,6 +123,12 @@ typedef HashSet<> wordHashSet; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "HashSet.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C index ed38924cf7..249d1fcf2b 100644 --- a/src/OpenFOAM/containers/Lists/List/List.C +++ b/src/OpenFOAM/containers/Lists/List/List.C @@ -321,7 +321,7 @@ List::List(const BiIndirectList& idl) template List::~List() { - if (this->size_) delete[] this->v_; + if (this->v_) delete[] this->v_; } @@ -367,9 +367,8 @@ void List::setSize(const label newSize) register T* av = &nv[i]; while (i--) *--av = *--vv; } - - delete[] this->v_; } + if (this->v_) delete[] this->v_; this->size_ = newSize; this->v_ = nv; @@ -400,7 +399,7 @@ void List::setSize(const label newSize, const T& a) template void List::clear() { - if (this->size_) delete[] this->v_; + if (this->v_) delete[] this->v_; this->size_ = 0; this->v_ = 0; } @@ -411,7 +410,7 @@ void List::clear() template void List::transfer(List& a) { - if (this->size_) delete[] this->v_; + if (this->v_) delete[] this->v_; this->size_ = a.size_; this->v_ = a.v_; @@ -457,7 +456,8 @@ void List::operator=(const UList& a) { if (a.size_ != this->size_) { - if (this->size_) delete[] this->v_; + if (this->v_) delete[] this->v_; + this->v_ = 0; this->size_ = a.size_; if (this->size_) this->v_ = new T[this->size_]; } @@ -503,7 +503,8 @@ void List::operator=(const SLList& sll) { if (sll.size() != this->size_) { - if (this->size_) delete[] this->v_; + if (this->v_) delete[] this->v_; + this->v_ = 0; this->size_ = sll.size(); if (this->size_) this->v_ = new T[this->size_]; } @@ -530,7 +531,8 @@ void List::operator=(const IndirectList& idl) { if (idl.size() != this->size_) { - if (this->size_) delete[] this->v_; + if (this->v_) delete[] this->v_; + this->v_ = 0; this->size_ = idl.size(); if (this->size_) this->v_ = new T[this->size_]; } @@ -551,7 +553,8 @@ void List::operator=(const BiIndirectList& idl) { if (idl.size() != this->size_) { - if (this->size_) delete[] this->v_; + if (this->v_) delete[] this->v_; + this->v_ = 0; this->size_ = idl.size(); if (this->size_) this->v_ = new T[this->size_]; } diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H index 02130ce706..3ee814a0f6 100644 --- a/src/OpenFOAM/containers/Lists/List/List.H +++ b/src/OpenFOAM/containers/Lists/List/List.H @@ -137,6 +137,9 @@ public: //- Return a null List static const List& null(); + //- Return the number of elements in the UList. + inline label size() const; + // Edit @@ -156,6 +159,10 @@ public: //- Return subscript-checked element of UList. inline T& newElmt(const label); + //- Override size to be inconsistent with allocated storage. + // Use with care. + inline label& size(); + // Member operators diff --git a/src/OpenFOAM/containers/Lists/List/ListI.H b/src/OpenFOAM/containers/Lists/List/ListI.H index a7a9ffa4cf..d39b19f884 100644 --- a/src/OpenFOAM/containers/Lists/List/ListI.H +++ b/src/OpenFOAM/containers/Lists/List/ListI.H @@ -52,6 +52,20 @@ inline T& Foam::List::newElmt(const label i) } +template +inline Foam::label Foam::List::size() const +{ + return UList::size_; +} + + +template +inline Foam::label& Foam::List::size() +{ + return UList::size_; +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index c74b674389..4299d05b5e 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -86,13 +86,6 @@ void Foam::Time::readDict() purgeWrite_ = 0; } - - if (writeControl_ != wcTimeStep && purgeWrite_ > 0) - { - FatalIOErrorIn("Time::readDict()", controlDict_) - << "writeControl must be set to timeStep for purgeWrite " - << exit(FatalIOError); - } } if (controlDict_.found("timeFormat")) diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.C b/src/OpenFOAM/meshes/boundBox/boundBox.C index c368e1a662..c87e552c85 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.C +++ b/src/OpenFOAM/meshes/boundBox/boundBox.C @@ -87,9 +87,47 @@ boundBox::boundBox(Istream& is) // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // -Ostream& operator<<(Ostream& os, const boundBox& b) +Ostream& operator<<(Ostream& os, const boundBox& bb) { - return os << b.min() << token::SPACE << b.max(); + if (os.format() == IOstream::ASCII) + { + os << bb.min_ << token::SPACE << bb.max_; + } + else + { + os.write + ( + reinterpret_cast(&bb.min_), + sizeof(boundBox) + ); + } + + // Check state of Ostream + os.check("Ostream& operator<<(Ostream&, const boundBox&)"); + + return os; +} + + +Istream& operator>>(Istream& is, boundBox& bb) +{ + if (is.format() == IOstream::ASCII) + { + return is >> bb.min_ >> bb.max_; + } + else + { + is.read + ( + reinterpret_cast(&bb.min_), + sizeof(boundBox) + ); + } + + // Check state of Istream + is.check("Istream& operator>>(Istream&, boundBox&)"); + + return is; } diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.H b/src/OpenFOAM/meshes/boundBox/boundBox.H index 40287e53eb..1493c0fe2f 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.H +++ b/src/OpenFOAM/meshes/boundBox/boundBox.H @@ -153,12 +153,31 @@ public: } - // Ostream operator + // Friend Operators - friend Ostream& operator<<(Ostream& os, const boundBox& b); + friend bool operator==(const boundBox& a, const boundBox& b) + { + return (a.min_ == b.min_) && (a.max_ == b.max_); + } + + friend bool operator!=(const boundBox& a, const boundBox& b) + { + return !(a == b); + } + + + // IOstream operator + + friend Istream& operator>>(Istream& is, boundBox&); + friend Ostream& operator<<(Ostream& os, const boundBox&); }; +//- Specify data associated with boundBox type is contiguous +template<> +inline bool contiguous() {return contiguous();} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C index 59f67a08f5..18ebdeba95 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C @@ -282,8 +282,7 @@ const Foam::labelList& Foam::polyPatch::meshEdges() const primitivePatch::meshEdges ( boundaryMesh().mesh().edges(), - boundaryMesh().mesh().cellEdges(), - faceCells() + boundaryMesh().mesh().pointEdges() ) ); } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C index 0ce9de38a8..acc3b0dcf9 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C @@ -362,16 +362,27 @@ const Foam::labelList& Foam::faceZone::meshEdges() const { if (!mePtr_) { - labelList faceCells(size()); - - const labelList& own = zoneMesh().mesh().faceOwner(); - - const labelList& faceLabels = *this; - - forAll (faceCells, faceI) - { - faceCells[faceI] = own[faceLabels[faceI]]; - } + //labelList faceCells(size()); + // + //const labelList& own = zoneMesh().mesh().faceOwner(); + // + //const labelList& faceLabels = *this; + // + //forAll (faceCells, faceI) + //{ + // faceCells[faceI] = own[faceLabels[faceI]]; + //} + // + //mePtr_ = + // new labelList + // ( + // operator()().meshEdges + // ( + // zoneMesh().mesh().edges(), + // zoneMesh().mesh().cellEdges(), + // faceCells + // ) + // ); mePtr_ = new labelList @@ -379,8 +390,7 @@ const Foam::labelList& Foam::faceZone::meshEdges() const operator()().meshEdges ( zoneMesh().mesh().edges(), - zoneMesh().mesh().cellEdges(), - faceCells + zoneMesh().mesh().pointEdges() ) ); } diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H index 49b3be8260..e7d4a410fa 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H @@ -348,7 +348,8 @@ public: // index in the edge list. If the edge is not found, return -1 label whichEdge(const edge& e) const; - //- Return labels of patch edges in the global edge list + //- Return labels of patch edges in the global edge list using + // cell addressing labelList meshEdges ( const edgeList& allEdges, @@ -356,6 +357,14 @@ public: const labelList& faceCells ) const; + //- Return labels of patch edges in the global edge list using + // basic edge addressing. + labelList meshEdges + ( + const edgeList& allEdges, + const labelListList& pointEdges + ) const; + //- Return face normals for patch const Field& faceNormals() const; diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C index be5c6adb9e..96c017fbdc 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchMeshEdges.C @@ -111,6 +111,60 @@ labelList PrimitivePatch::meshEdges } +template +< + class Face, + template class FaceList, + class PointField, + class PointType +> + +labelList PrimitivePatch::meshEdges +( + const edgeList& allEdges, + const labelListList& pointEdges +) const +{ + if (debug) + { + Info<< "labelList PrimitivePatch" + << "::meshEdges() : " + << "calculating labels of patch edges in mesh edge list" + << endl; + } + + // get reference to the list of edges on the patch + const edgeList& PatchEdges = edges(); + + // create the storage + labelList meshEdges(PatchEdges.size()); + + // get reference to the points on the patch + const labelList& pp = meshPoints(); + + // WARNING: Remember that local edges address into local point list; + // local-to-global point label translation is necessary + forAll (PatchEdges, edgeI) + { + const label globalPointI = pp[PatchEdges[edgeI].start()]; + const edge curEdge(globalPointI, pp[PatchEdges[edgeI].end()]); + + const labelList& pe = pointEdges[globalPointI]; + + forAll (pe, i) + { + if (allEdges[pe[i]] == curEdge) + { + meshEdges[edgeI] = pe[i]; + break; + } + } + } + + return meshEdges; +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C index dcbf6d0b16..8c21017269 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C @@ -66,6 +66,9 @@ primitiveMesh::primitiveMesh() ppPtr_(NULL), cpPtr_(NULL), + allocSize_(0), + labels_(0), + cellCentresPtr_(NULL), faceCentresPtr_(NULL), cellVolumesPtr_(NULL), @@ -106,6 +109,9 @@ primitiveMesh::primitiveMesh ppPtr_(NULL), cpPtr_(NULL), + allocSize_(0), + labels_(0), + cellCentresPtr_(NULL), faceCentresPtr_(NULL), cellVolumesPtr_(NULL), diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H index 0609c453d3..3868ba2b25 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H @@ -155,6 +155,17 @@ class primitiveMesh mutable labelListList* cpPtr_; + // On-the-fly edge addresing storage + + //- Temporary storage for addressing. allocSize is the real size + // of the labelList. + mutable label allocSize_; + mutable labelList labels_; + + //- Temporary storage for addressing + mutable labelHashSet labelSet_; + + // Geometric data //- Cell centres @@ -209,8 +220,14 @@ class primitiveMesh ( List >&, DynamicList&, - const label pA, - const label pB + const label, + const label + ); + //- For on-the-fly addressing calculation + static label findFirstCommonElementFromSortedLists + ( + const labelList&, + const labelList& ); @@ -667,6 +684,55 @@ public: //- Print a list of all the currently allocated mesh data void printAllocated() const; + // Per storage whether allocated + inline bool hasCellShapes() const; + inline bool hasEdges() const; + inline bool hasCellCells() const; + inline bool hasEdgeCells() const; + inline bool hasPointCells() const; + inline bool hasCells() const; + inline bool hasEdgeFaces() const; + inline bool hasPointFaces() const; + inline bool hasCellEdges() const; + inline bool hasFaceEdges() const; + inline bool hasPointEdges() const; + inline bool hasPointPoints() const; + inline bool hasCellPoints() const; + inline bool hasCellCentres() const; + inline bool hasFaceCentres() const; + inline bool hasCellVolumes() const; + inline bool hasFaceAreas() const; + + // On-the-fly addressing calculation. These functions return either + // a reference to the full addressing (if already calculated) or + // a reference to member data labels_ so be careful when not storing + // result. + + //- cellCells using cells + const labelList& cellCells(const label cellI) const; + + //- cellPoints using cells + const labelList& cellPoints(const label cellI) const; + + //- pointCells using pointFaces + const labelList& pointCells(const label pointI) const; + + //- pointPoints using edges, pointEdges + const labelList& pointPoints(const label pointI) const; + + //- faceEdges using pointFaces, edges, pointEdges + const labelList& faceEdges(const label faceI) const; + + //- edgeFaces using pointFaces, edges, pointEdges + const labelList& edgeFaces(const label edgeI) const; + + //- edgeCells using pointFaces, edges, pointEdges + const labelList& edgeCells(const label edgeI) const; + + //- cellEdges using cells, pointFaces, edges, pointEdges + const labelList& cellEdges(const label cellI) const; + + //- Clear geometry void clearGeom(); diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C index d17228c7bd..3c8f896bbe 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C @@ -105,6 +105,53 @@ const labelListList& primitiveMesh::cellCells() const } +const labelList& primitiveMesh::cellCells(const label cellI) const +{ + if (hasCellCells()) + { + return cellCells()[cellI]; + } + else + { + const labelList& own = faceOwner(); + const labelList& nei = faceNeighbour(); + const cell& cFaces = cells()[cellI]; + + labels_.size() = allocSize_; + + if (cFaces.size() > allocSize_) + { + labels_.clear(); + allocSize_ = cFaces.size(); + labels_.setSize(allocSize_); + } + + label n = 0; + + forAll(cFaces, i) + { + label faceI = cFaces[i]; + + if (faceI < nInternalFaces()) + { + if (own[faceI] == cellI) + { + labels_[n++] = nei[faceI]; + } + else + { + labels_[n++] = own[faceI]; + } + } + } + + labels_.size() = n; + + return labels_; + } +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C index 542952019b..c8f63e1eef 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C @@ -53,6 +53,52 @@ const labelListList& primitiveMesh::cellPoints() const } +const labelList& primitiveMesh::cellPoints(const label cellI) const +{ + if (hasCellPoints()) + { + return cellPoints()[cellI]; + } + else + { + const faceList& fcs = faces(); + const labelList& cFaces = cells()[cellI]; + + labelSet_.clear(); + + forAll(cFaces, i) + { + const labelList& f = fcs[cFaces[i]]; + + forAll(f, fp) + { + labelSet_.insert(f[fp]); + } + } + + labels_.size() = allocSize_; + + if (labelSet_.size() > allocSize_) + { + labels_.clear(); + allocSize_ = labelSet_.size(); + labels_.setSize(allocSize_); + } + + label n = 0; + + forAllConstIter(labelHashSet, labelSet_, iter) + { + labels_[n++] = iter.key(); + } + + labels_.size() = n; + + return labels_; + } +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C index fd56846ebb..47360d4cf1 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C @@ -771,11 +771,12 @@ bool primitiveMesh::checkPoints } } - const labelListList& pc = pointCells(); - forAll (pc, pointI) + forAll (pf, pointI) { - if (pc[pointI].size() == 0) + const labelList& pc = pointCells(pointI); + + if (pc.size() == 0) { if (setPtr) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C index 46173628d8..6a2f309dd3 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C @@ -51,6 +51,86 @@ const labelListList& primitiveMesh::edgeCells() const } +const labelList& primitiveMesh::edgeCells(const label edgeI) const +{ + if (hasEdgeCells()) + { + return edgeCells()[edgeI]; + } + else + { + const labelList& own = faceOwner(); + const labelList& nei = faceNeighbour(); + + // edge faces can either return labels_ or reference in edgeLabels. + labelList labelsCopy; + if (!hasEdgeFaces()) + { + labelsCopy = edgeFaces(edgeI); + } + + const labelList& eFaces = + ( + hasEdgeFaces() + ? edgeFaces()[edgeI] + : labelsCopy + ); + + labels_.size() = allocSize_; + + // labels_ should certainly be big enough for edge cells. + label n = 0; + + // Do quadratic insertion. + forAll(eFaces, i) + { + label faceI = eFaces[i]; + + { + label ownCellI = own[faceI]; + + // Check if not already in labels_ + for (label j = 0; j < n; j++) + { + if (labels_[j] == ownCellI) + { + ownCellI = -1; + break; + } + } + + if (ownCellI != -1) + { + labels_[n++] = ownCellI; + } + } + + if (isInternalFace(faceI)) + { + label neiCellI = nei[faceI]; + + for (label j = 0; j < n; j++) + { + if (labels_[j] == neiCellI) + { + neiCellI = -1; + break; + } + } + + if (neiCellI != -1) + { + labels_[n++] = neiCellI; + } + } + } + + labels_.size() = n; + + return labels_; + } +} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C index 30390ce4eb..99536bcd33 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C @@ -51,6 +51,59 @@ const labelListList& primitiveMesh::edgeFaces() const return *efPtr_; } + +const labelList& primitiveMesh::edgeFaces(const label edgeI) const +{ + if (hasEdgeFaces()) + { + return edgeFaces()[edgeI]; + } + else + { + // Use the fact that pointEdges are sorted in incrementing edge order + const edge& e = edges()[edgeI]; + const labelList& pFaces0 = pointFaces()[e[0]]; + const labelList& pFaces1 = pointFaces()[e[1]]; + + label i0 = 0; + label i1 = 0; + label n = 0; + + labels_.size() = allocSize_; + + while (i0 < pFaces0.size() && i1 < pFaces1.size()) + { + if (pFaces0[i0] < pFaces1[i1]) + { + ++i0; + } + else if (pFaces0[i0] > pFaces1[i1]) + { + ++i1; + } + else + { + // Equal. Append. + if (n == allocSize_) + { + // Have setSize copy contents so far + labels_.size() = n; + allocSize_ = allocSize_*2 + 1; + labels_.setSize(allocSize_); + } + labels_[n++] = pFaces0[i0]; + ++i0; + ++i1; + } + } + + labels_.size() = n; + + return labels_; + } +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C index 6b3039ff30..b60b366079 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C @@ -461,6 +461,46 @@ void primitiveMesh::calcEdges(const bool doFaceEdges) const } +label primitiveMesh::findFirstCommonElementFromSortedLists +( + const labelList& list1, + const labelList& list2 +) +{ + label result = -1; + + labelList::const_iterator iter1 = list1.begin(); + labelList::const_iterator iter2 = list2.begin(); + + while (iter1 != list1.end() && iter2 != list2.end()) + { + if( *iter1 < *iter2) + { + ++iter1; + } + else if (*iter1 > *iter2) + { + ++iter2; + } + else + { + result = *iter1; + break; + } + } + if (result == -1) + { + FatalErrorIn + ( + "primitiveMesh::findFirstCommonElementFromSortedLists" + "(const labelList&, const labelList&)" + ) << "No common elements in lists " << list1 << " and " << list2 + << abort(FatalError); + } + return result; +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // const edgeList& primitiveMesh::edges() const @@ -542,6 +582,91 @@ void primitiveMesh::clearOutEdges() deleteDemandDrivenData(edgesPtr_); deleteDemandDrivenData(pePtr_); deleteDemandDrivenData(fePtr_); + labels_.clear(); + allocSize_ = 0; +} + + +const labelList& primitiveMesh::faceEdges(const label faceI) const +{ + if (hasFaceEdges()) + { + return faceEdges()[faceI]; + } + else + { + const labelListList& pointEs = pointEdges(); + const face& f = faces()[faceI]; + + labels_.size() = allocSize_; + + if (f.size() > allocSize_) + { + labels_.clear(); + allocSize_ = f.size(); + labels_.setSize(allocSize_); + } + + label n = 0; + + forAll(f, fp) + { + labels_[n++] = findFirstCommonElementFromSortedLists + ( + pointEs[f[fp]], + pointEs[f.nextLabel(fp)] + ); + } + + labels_.size() = n; + + return labels_; + } +} + + +const labelList& primitiveMesh::cellEdges(const label cellI) const +{ + if (hasCellEdges()) + { + return cellEdges()[cellI]; + } + else + { + const labelList& cFaces = cells()[cellI]; + + labelSet_.clear(); + + forAll(cFaces, i) + { + const labelList& fe = faceEdges(cFaces[i]); + + forAll(fe, feI) + { + labelSet_.insert(fe[feI]); + } + } + + labels_.size() = allocSize_; + + if (labelSet_.size() > allocSize_) + { + labels_.clear(); + allocSize_ = labelSet_.size(); + labels_.setSize(allocSize_); + } + + label n =0; + + forAllConstIter(labelHashSet, labelSet_, iter) + { + labels_[n++] = iter.key(); + } + + labels_.size() = n; + + return labels_; + } } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshI.H b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshI.H index fdaea6d1fc..98b32af1fc 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshI.H +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshI.H @@ -104,6 +104,108 @@ inline bool primitiveMesh::isInternalFace(const label faceIndex) const } +inline bool primitiveMesh::hasCellShapes() const +{ + return cellShapesPtr_; +} + + +inline bool primitiveMesh::hasEdges() const +{ + return edgesPtr_; +} + + +inline bool primitiveMesh::hasCellCells() const +{ + return ccPtr_; +} + + +inline bool primitiveMesh::hasEdgeCells() const +{ + return ecPtr_; +} + + +inline bool primitiveMesh::hasPointCells() const +{ + return pcPtr_; +} + + +inline bool primitiveMesh::hasCells() const +{ + return cfPtr_; +} + + +inline bool primitiveMesh::hasEdgeFaces() const +{ + return efPtr_; +} + + +inline bool primitiveMesh::hasPointFaces() const +{ + return pfPtr_; +} + + +inline bool primitiveMesh::hasCellEdges() const +{ + return cePtr_; +} + + +inline bool primitiveMesh::hasFaceEdges() const +{ + return fePtr_; +} + + +inline bool primitiveMesh::hasPointEdges() const +{ + return pePtr_; +} + + +inline bool primitiveMesh::hasPointPoints() const +{ + return ppPtr_; +} + + +inline bool primitiveMesh::hasCellPoints() const +{ + return cpPtr_; +} + + +inline bool primitiveMesh::hasCellCentres() const +{ + return cellCentresPtr_; +} + + +inline bool primitiveMesh::hasFaceCentres() const +{ + return faceCentresPtr_; +} + + +inline bool primitiveMesh::hasCellVolumes() const +{ + return cellVolumesPtr_; +} + + +inline bool primitiveMesh::hasFaceAreas() const +{ + return faceAreasPtr_; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointCells.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointCells.C index 55d877902a..6d7af72e0b 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointCells.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointCells.C @@ -114,6 +114,70 @@ const labelListList& primitiveMesh::pointCells() const } +const labelList& primitiveMesh::pointCells(const label pointI) const +{ + if (hasPointCells()) + { + return pointCells()[pointI]; + } + else + { + const labelList& own = faceOwner(); + const labelList& nei = faceNeighbour(); + const labelList& pFaces = pointFaces()[pointI]; + + labels_.size() = allocSize_; + + label n = 0; + + forAll(pFaces, i) + { + const label faceI = pFaces[i]; + + // Append owner + if (n == allocSize_) + { + labels_.size() = n; + allocSize_ = allocSize_*2 + 1; + labels_.setSize(allocSize_); + } + labels_[n++] = own[faceI]; + + // Append neighbour + if (faceI < nInternalFaces()) + { + if (n == allocSize_) + { + labels_.size() = n; + allocSize_ = allocSize_*2 + 1; + labels_.setSize(allocSize_); + } + labels_[n++] = nei[faceI]; + } + } + labels_.size() = n; + + + // Filter duplicates + sort(labels_); + + n = 1; + + for (label i = 1; i < labels_.size(); i++) + { + if (labels_[i] != labels_[i-1]) + { + labels_[n++] = labels_[i]; + } + } + + labels_.size() = n; + + return labels_; + } +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointPoints.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointPoints.C index c5df74a4fa..099e266941 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointPoints.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshPointPoints.C @@ -97,6 +97,40 @@ const labelListList& primitiveMesh::pointPoints() const } +const labelList& primitiveMesh::pointPoints(const label pointI) const +{ + if (hasPointPoints()) + { + return pointPoints()[pointI]; + } + else + { + const edgeList& edges = this->edges(); + const labelList& pEdges = pointEdges()[pointI]; + + labels_.size() = allocSize_; + + if (pEdges.size() > allocSize_) + { + // Set size() so memory allocation behaves as normal. + labels_.clear(); + allocSize_ = pEdges.size(); + labels_.setSize(allocSize_); + } + + label n = 0; + + forAll(pEdges, i) + { + labels_[n++] = edges[pEdges[i]].otherVertex(pointI); + } + + labels_.size() = n; + + return labels_; + } +} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C b/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C index fe64ea81c3..1a577acecb 100644 --- a/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C +++ b/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C @@ -30,6 +30,7 @@ License #include "triSurfaceMesh.H" #include "refinementSurfaces.H" #include "searchableSurfaces.H" +#include "orientedSurface.H" #include "pointIndexHit.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -211,7 +212,27 @@ void Foam::shellSurfaces::orient() refCast(s) ); - refinementSurfaces::orientSurface(outsidePt, shell); + // Flip surface so outsidePt is outside. + bool anyFlipped = orientedSurface::orient + ( + shell, + outsidePt, + true + ); + + if (anyFlipped) + { + // orientedSurface will have done a clearOut of the surface. + // we could do a clearout of the triSurfaceMeshes::trees() + // but these aren't affected by orientation + // (except for cached + // sideness which should not be set at this point. + // !!Should check!) + + Info<< "shellSurfaces : Flipped orientation of surface " + << s.name() + << " so point " << outsidePt << " is outside." << endl; + } } } } diff --git a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C index 6d97285d73..f3918578cd 100644 --- a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C +++ b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C @@ -29,8 +29,8 @@ License #include "matchPoints.H" #include "indirectPrimitivePatch.H" #include "meshTools.H" -#include "octreeDataFace.H" -#include "octree.H" +#include "treeDataFace.H" +#include "indexedOctree.H" #include "OFstream.H" #include "IndirectList.H" @@ -1011,19 +1011,29 @@ void Foam::faceCoupleInfo::findSlavesCoveringMaster ) { // Construct octree from all mesh0 boundary faces - octreeDataFace shapes(mesh0); + labelList bndFaces(mesh0.nFaces()-mesh0.nInternalFaces()); + forAll(bndFaces, i) + { + bndFaces[i] = mesh0.nInternalFaces() + i; + } treeBoundBox overallBb(mesh0.points()); - octree tree - ( - overallBb, // overall search domain - shapes, // all information needed to do checks on cells - 1, // min levels - 20.0, // maximum ratio of cubes v.s. cells - 10.0 - ); + Random rndGen(123456); + indexedOctree tree + ( + treeDataFace // all information needed to search faces + ( + false, // do not cache bb + mesh0, + bndFaces // boundary faces only + ), + overallBb.extend(rndGen, 1E-4), // overall search domain + 8, // maxLevel + 10, // leafsize + 3.0 // duplicity + ); if (debug) { @@ -1048,17 +1058,11 @@ void Foam::faceCoupleInfo::findSlavesCoveringMaster // Generate face centre (prevent cellCentres() reconstruction) point fc(f1.centre(mesh1.points())); - // Search in bounding box of face only. - treeBoundBox tightest(static_cast(f1.points(mesh1.points()))); + pointIndexHit nearInfo = tree.findNearest(fc, Foam::sqr(absTol)); - scalar tightestDist = GREAT; - - label index = tree.findNearest(fc, tightest, tightestDist); - - - if (index != -1) + if (nearInfo.hit()) { - label mesh0FaceI = shapes.meshFaces()[index]; + label mesh0FaceI = tree.shapes().faceLabels()[nearInfo.index()]; // Check if points of f1 actually lie on top of mesh0 face // This is the bit that might fail since if f0 is severely warped diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C index 1b3bf6e19b..0c567ee312 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C @@ -62,6 +62,7 @@ namespace Foam }; } + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::hexRef8::reorder @@ -80,7 +81,7 @@ void Foam::hexRef8::reorder if (newI >= len) { - FatalErrorIn("hexRef8::reorder") << abort(FatalError); + FatalErrorIn("hexRef8::reorder(..)") << abort(FatalError); } if (newI >= 0) @@ -557,22 +558,11 @@ Foam::label Foam::hexRef8::getAnchorCell } // Problem. - - // Pick up points of the cell - const labelList cPoints(cellPoints(cellI)); - - Perr<< "cell:" << cellI << " points:" << endl; - forAll(cPoints, i) - { - label pointI = cPoints[i]; - - Perr<< " " << pointI << " coord:" << mesh_.points()[pointI] - << nl; - } + dumpCell(cellI); Perr<< "cell:" << cellI << " anchorPoints:" << cellAnchorPoints[cellI] << endl; - FatalErrorIn("hexRef8::getAnchorCell") + FatalErrorIn("hexRef8::getAnchorCell(..)") << "Could not find point " << pointI << " in the anchorPoints for cell " << cellI << endl << "Does your original mesh obey the 2:1 constraint and" @@ -690,9 +680,50 @@ Foam::label Foam::hexRef8::countAnchors } +void Foam::hexRef8::dumpCell(const label cellI) const +{ + OFstream str(mesh_.time().path()/"cell_" + Foam::name(cellI) + ".obj"); + Pout<< "hexRef8 : Dumping cell as obj to " << str.name() << endl; + + const cell& cFaces = mesh_.cells()[cellI]; + + Map