diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 23f6d32c23..ec16c5c5af 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -223,7 +223,7 @@ snapControls //- Highly experimental and wip: number of feature edge snapping // iterations. Leave out altogether to disable. - //nFeatureSnapIter 10; + //nFeatureSnapIter 20; } // Settings for the layer addition. diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C index 996e6fcb37..256ffa19cd 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C @@ -193,7 +193,7 @@ Foam::label Foam::checkTopology if (nOneCells > 0) { Info<< " <::max (usually VGREAT) + // Use with interpolations: // - cell (cell value) // - cellPatchConstrained (boundary value) // - cellPoint (interpolated boundary value) - type patchCloud; - axis xyz; - points ((0.049 0.099 0.005)(0.051 0.054 0.005)); - patches (".*Wall.*"); + type patchCloud; + axis xyz; + points ((0.049 0.099 0.005)(0.051 0.054 0.005)); + maxDistance 0.1; // maximum distance to search + patches (".*Wall.*"); } ); diff --git a/bin/foamLog b/bin/foamLog old mode 100755 new mode 100644 index c86dce622d..fd3e6c7297 --- a/bin/foamLog +++ b/bin/foamLog @@ -45,6 +45,7 @@ Usage: $Script [OPTIONS] -list lists but does not extract -n create single column files with the extracted data only -quiet quiet operation + -localDB only use the local database file -help print the usage $Script - extracts xy files from OpenFOAM logs. @@ -103,7 +104,7 @@ usage timeName=Time -unset listOpt quietOpt +unset listOpt quietOpt localDB # parse options while [ "$#" -gt 0 ] @@ -125,6 +126,10 @@ do quietOpt=true shift ;; + -localDB) + localDB=true + shift + ;; -*) usage "unknown option: '$*'" ;; @@ -219,7 +224,7 @@ getSolveQueryList() getAllQueries() { #-- All solved for queries from log file - queries=`getSolveQueryList $2` + [ "$localDB" = true ] || queries=`getSolveQueryList $2` #-- Add ones from database, present in log file # Note: just like awk, line selected with regular expression, @@ -369,29 +374,30 @@ AWK_CONTENTS # # Code for extracting solved for quantities # -cat << AWK_CONTENTS >> $AWKFILE -# Extraction of any solved for variable -/Solving for/ { - extract(\$0, "Solving for ", varNameVal) +[ "$localDB" = true ] || + cat << AWK_CONTENTS >> $AWKFILE + # Extraction of any solved for variable + /Solving for/ { + extract(\$0, "Solving for ", varNameVal) - varName=varNameVal[1] - file=varName "_" subIter[varName]++ - file="$outputDir/" file - extract(\$0, "Initial residual = ", val) - print $timeName "\t" val[1] > file + varName=varNameVal[1] + file=varName "_" subIter[varName]++ + file="$outputDir/" file + extract(\$0, "Initial residual = ", val) + print $timeName "\t" val[1] > file - varName=varNameVal[1] "FinalRes" - file=varName "_" subIter[varName]++ - file="$outputDir/" file - extract(\$0, "Final residual = ", val) - print $timeName "\t" val[1] > file + varName=varNameVal[1] "FinalRes" + file=varName "_" subIter[varName]++ + file="$outputDir/" file + extract(\$0, "Final residual = ", val) + print $timeName "\t" val[1] > file - varName=varNameVal[1] "Iters" - file=varName "_" subIter[varName]++ - file="$outputDir/" file - extract(\$0, "No Iterations ", val) - print $timeName "\t" val[1] > file -} + varName=varNameVal[1] "Iters" + file=varName "_" subIter[varName]++ + file="$outputDir/" file + extract(\$0, "No Iterations ", val) + print $timeName "\t" val[1] > file + } AWK_CONTENTS # ---------- @@ -432,7 +438,7 @@ done # Print found #----------------------------- myEcho "Generated XY files for:" -getAllQueries $DBFILE $LOG +[ "$quietOpt" = true ] || getAllQueries $DBFILE $LOG myEcho "End" #------------------------------------------------------------------------------ diff --git a/src/OSspecific/POSIX/fileStat.C b/src/OSspecific/POSIX/fileStat.C index 015c6ce8ab..277ea16d69 100644 --- a/src/OSspecific/POSIX/fileStat.C +++ b/src/OSspecific/POSIX/fileStat.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -98,47 +98,25 @@ bool Foam::fileStat::sameINode(const label iNode) const Foam::Istream& Foam::operator>>(Istream& is, fileStat& fStat) { - // Read beginning of machine info list - is.readBegin("fileStat"); + FixedList stat(is); - label - devMaj, devMin, - ino, mode, uid, gid, - rdevMaj, rdevMin, - size, atime, mtime, ctime; + fStat.isValid_ = stat[0]; - is >> fStat.isValid_ - >> devMaj - >> devMin - >> ino - >> mode - >> uid - >> gid - >> rdevMaj - >> rdevMin - >> size - >> atime - >> mtime - >> ctime; - - dev_t st_dev = makedev(devMaj, devMin); + dev_t st_dev = makedev(stat[1], stat[2]); fStat.status_.st_dev = st_dev; - fStat.status_.st_ino = ino; - fStat.status_.st_mode = mode; - fStat.status_.st_uid = uid; - fStat.status_.st_gid = gid; + fStat.status_.st_ino = stat[3]; + fStat.status_.st_mode = stat[4]; + fStat.status_.st_uid = stat[5]; + fStat.status_.st_gid = stat[6]; - dev_t st_rdev = makedev(rdevMaj, rdevMin); + dev_t st_rdev = makedev(stat[7], stat[8]); fStat.status_.st_rdev = st_rdev; - fStat.status_.st_size = size; - fStat.status_.st_atime = atime; - fStat.status_.st_mtime = mtime; - fStat.status_.st_ctime = ctime; - - // Read end of machine info list - is.readEnd("fileStat"); + fStat.status_.st_size = stat[9]; + fStat.status_.st_atime = stat[10]; + fStat.status_.st_mtime = stat[11]; + fStat.status_.st_ctime = stat[12]; // Check state of Istream is.check("Istream& operator>>(Istream&, fileStat&)"); @@ -149,28 +127,23 @@ Foam::Istream& Foam::operator>>(Istream& is, fileStat& fStat) Foam::Ostream& Foam::operator<<(Ostream& os, const fileStat& fStat) { - // Set precision so 32bit unsigned int can be printed - // int oldPrecision = os.precision(); - int oldPrecision = 0; - os.precision(10); + FixedList stat; - os << token::BEGIN_LIST << fStat.isValid_ - << token::SPACE << label(major(fStat.status_.st_dev)) - << token::SPACE << label(minor(fStat.status_.st_dev)) - << token::SPACE << label(fStat.status_.st_ino) - << token::SPACE << label(fStat.status_.st_mode) - << token::SPACE << label(fStat.status_.st_uid) - << token::SPACE << label(fStat.status_.st_gid) - << token::SPACE << label(major(fStat.status_.st_rdev)) - << token::SPACE << label(minor(fStat.status_.st_rdev)) - << token::SPACE << label(fStat.status_.st_size) - << token::SPACE << label(fStat.status_.st_atime) - << token::SPACE << label(fStat.status_.st_mtime) - << token::SPACE << label(fStat.status_.st_ctime) - << token::END_LIST; + stat[0] = label(fStat.isValid_); + stat[1] = label(major(fStat.status_.st_dev)); + stat[2] = label(minor(fStat.status_.st_dev)); + stat[3] = label(fStat.status_.st_ino); + stat[4] = label(fStat.status_.st_mode); + stat[5] = label(fStat.status_.st_uid); + stat[6] = label(fStat.status_.st_gid); + stat[7] = label(major(fStat.status_.st_rdev)); + stat[8] = label(minor(fStat.status_.st_rdev)); + stat[9] = label(fStat.status_.st_size); + stat[10] = label(fStat.status_.st_atime); + stat[11] = label(fStat.status_.st_mtime); + stat[12] = label(fStat.status_.st_ctime); - os.precision(oldPrecision); - return os; + return os << stat; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshInitMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMeshInitMesh.C index b4485985bf..8e6f4941eb 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshInitMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshInitMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,12 +60,26 @@ void Foam::polyMesh::initMesh() forAll(owner_, facei) { + if (owner_[facei] < 0) + { + FatalErrorIn("polyMesh::initMesh()") + << "Illegal cell label " << owner_[facei] + << " in neighbour addressing for face " << facei + << exit(FatalError); + } nCells = max(nCells, owner_[facei]); } // The neighbour array may or may not be the same length as the owner forAll(neighbour_, facei) { + if (neighbour_[facei] < 0) + { + FatalErrorIn("polyMesh::initMesh()") + << "Illegal cell label " << neighbour_[facei] + << " in neighbour addressing for face " << facei + << exit(FatalError); + } nCells = max(nCells, neighbour_[facei]); } @@ -113,6 +127,14 @@ void Foam::polyMesh::initMesh(cellList& c) forAll(cellfaces, faceI) { + if (cellfaces[faceI] < 0) + { + FatalErrorIn("polyMesh::initMesh(cellList&)") + << "Illegal face label " << cellfaces[faceI] + << " in cell " << cellI + << exit(FatalError); + } + if (!markedFaces[cellfaces[faceI]]) { // First visit: owner diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C index 048e19497f..6c1e1d309a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,9 +35,8 @@ Foam::fanFvPatchField::fanFvPatchField const DimensionedField& iF ) : - jumpCyclicFvPatchField(p, iF), - f_(0), - jump_(this->size(), 0.0) + fixedJumpFvPatchField(p, iF), + f_(0) {} @@ -50,9 +49,8 @@ Foam::fanFvPatchField::fanFvPatchField const fvPatchFieldMapper& mapper ) : - jumpCyclicFvPatchField(ptf, p, iF, mapper), - f_(ptf.f_), - jump_(ptf.jump_, mapper) + fixedJumpFvPatchField(ptf, p, iF, mapper), + f_(ptf.f_) {} @@ -64,9 +62,8 @@ Foam::fanFvPatchField::fanFvPatchField const dictionary& dict ) : - jumpCyclicFvPatchField(p, iF), - f_(), - jump_(this->size(), 0.0) + fixedJumpFvPatchField(p, iF), + f_() { { Istream& is = dict.lookup("f"); @@ -97,9 +94,8 @@ Foam::fanFvPatchField::fanFvPatchField ) : cyclicLduInterfaceField(), - jumpCyclicFvPatchField(ptf), - f_(ptf.f_), - jump_(ptf.jump_) + fixedJumpFvPatchField(ptf), + f_(ptf.f_) {} @@ -110,45 +106,19 @@ Foam::fanFvPatchField::fanFvPatchField const DimensionedField& iF ) : - jumpCyclicFvPatchField(ptf, iF), - f_(ptf.f_), - jump_(ptf.jump_) + fixedJumpFvPatchField(ptf, iF), + f_(ptf.f_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::fanFvPatchField::autoMap -( - const fvPatchFieldMapper& m -) -{ - jumpCyclicFvPatchField::autoMap(m); - jump_.autoMap(m); -} - - -template -void Foam::fanFvPatchField::rmap -( - const fvPatchField& ptf, - const labelList& addr -) -{ - jumpCyclicFvPatchField::rmap(ptf, addr); - - const fanFvPatchField& tiptf = - refCast >(ptf); - jump_.rmap(tiptf.jump_, addr); -} - template void Foam::fanFvPatchField::write(Ostream& os) const { - fvPatchField::write(os); - os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl; + + fixedJumpFvPatchField::write(os); IOstream::streamFormat fmt0 = os.format(IOstream::ASCII); os.writeKeyword("f") << f_ << token::END_STATEMENT << nl; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H index 9be8b5b6d9..aec3f75e55 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ SourceFiles #ifndef fanFvPatchField_H #define fanFvPatchField_H -#include "jumpCyclicFvPatchField.H" +#include "fixedJumpFvPatchField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,16 +49,13 @@ namespace Foam template class fanFvPatchField : - public jumpCyclicFvPatchField + public fixedJumpFvPatchField { // Private data //- Fan pressure rise polynomial coefficients List f_; - //- "jump" field - Field jump_; - public: @@ -137,37 +134,6 @@ public: return f_; } - //- Return the "jump" across the patch. - virtual tmp > jump() const - { - if (this->cyclicPatch().owner()) - { - return jump_; - } - else - { - return refCast > - ( - this->neighbourPatchField() - ).jump(); - } - } - - - // Mapping functions - - //- Map (and resize as needed) from self given a mapping object - virtual void autoMap - ( - const fvPatchFieldMapper& - ); - - //- Reverse map the given fvPatchField onto this fvPatchField - virtual void rmap - ( - const fvPatchField&, - const labelList& - ); // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C new file mode 100644 index 0000000000..59d8bdfb94 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fixedJumpFvPatchField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::fixedJumpFvPatchField::fixedJumpFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + jumpCyclicFvPatchField(p, iF), + jump_(this->size(), pTraits::zero) +{} + + +template +Foam::fixedJumpFvPatchField::fixedJumpFvPatchField +( + const fixedJumpFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + jumpCyclicFvPatchField(ptf, p, iF, mapper), + jump_(ptf.jump_, mapper) +{} + + +template +Foam::fixedJumpFvPatchField::fixedJumpFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + jumpCyclicFvPatchField(p, iF), + jump_("jump", dict, p.size()) +{} + + +template +Foam::fixedJumpFvPatchField::fixedJumpFvPatchField +( + const fixedJumpFvPatchField& ptf +) +: + cyclicLduInterfaceField(), + jumpCyclicFvPatchField(ptf), + jump_(ptf.jump_) +{} + + +template +Foam::fixedJumpFvPatchField::fixedJumpFvPatchField +( + const fixedJumpFvPatchField& ptf, + const DimensionedField& iF +) +: + jumpCyclicFvPatchField(ptf, iF), + jump_(ptf.jump_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::fixedJumpFvPatchField::autoMap +( + const fvPatchFieldMapper& m +) +{ + jumpCyclicFvPatchField::autoMap(m); + jump_.autoMap(m); +} + + +template +void Foam::fixedJumpFvPatchField::rmap +( + const fvPatchField& ptf, + const labelList& addr +) +{ + jumpCyclicFvPatchField::rmap(ptf, addr); + + const fixedJumpFvPatchField& tiptf = + refCast >(ptf); + jump_.rmap(tiptf.jump_, addr); +} + + +template +void Foam::fixedJumpFvPatchField::write(Ostream& os) const +{ + fvPatchField::write(os); + os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl; + jump_.writeEntry("jump", os); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H new file mode 100644 index 0000000000..e192e190b4 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H @@ -0,0 +1,184 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fixedJumpFvPatchField + +Description + Base class for "jump" of a field + +SourceFiles + fixedJumpFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedJumpFvPatchField_H +#define fixedJumpFvPatchField_H + +#include "jumpCyclicFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fixedJumpFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template +class fixedJumpFvPatchField +: + public jumpCyclicFvPatchField +{ + +protected: + + // Protected data + + //- "jump" field + Field jump_; + + +public: + + + // Constructors + + //- Construct from patch and internal field + fixedJumpFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + fixedJumpFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given fixedJumpFvPatchField onto a + // new patch + fixedJumpFvPatchField + ( + const fixedJumpFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fixedJumpFvPatchField + ( + const fixedJumpFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new fixedJumpFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + fixedJumpFvPatchField + ( + const fixedJumpFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new fixedJumpFvPatchField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the "jump" across the patch. + virtual tmp > jump() const + { + if (this->cyclicPatch().owner()) + { + return jump_; + } + else + { + return refCast > + ( + this->neighbourPatchField() + ).jump(); + } + } + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchField&, + const labelList& + ); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "fixedJumpFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C index 44d3cc027b..5982111f15 100644 --- a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -153,240 +153,6 @@ Foam::labelList Foam::decompositionMethod::decompose } -// Return the minimum face between two cells. Only relevant for -// cells with multiple faces inbetween. -Foam::label Foam::decompositionMethod::masterFace -( - const polyMesh& mesh, - const label own, - const label nei -) -{ - label minFaceI = labelMax; - - // Count multiple faces between own and nei only once - const cell& ownFaces = mesh.cells()[own]; - forAll(ownFaces, i) - { - label otherFaceI = ownFaces[i]; - - if (mesh.isInternalFace(otherFaceI)) - { - label nbrCellI = - ( - mesh.faceNeighbour()[otherFaceI] != own - ? mesh.faceNeighbour()[otherFaceI] - : mesh.faceOwner()[otherFaceI] - ); - - if (nbrCellI == nei) - { - minFaceI = min(minFaceI, otherFaceI); - } - } - } - - return minFaceI; -} - - -//void Foam::decompositionMethod::calcCSR -//( -// const polyMesh& mesh, -// List& adjncy, -// List& xadj -//) -//{ -// const polyBoundaryMesh& pbm = mesh.boundaryMesh(); -// -// // Make Metis CSR (Compressed Storage Format) storage -// // adjncy : contains neighbours (= edges in graph) -// // xadj(celli) : start of information in adjncy for celli -// -// -// // Count unique faces between cells -// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// labelList nFacesPerCell(mesh.nCells(), 0); -// -// // Internal faces -// for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) -// { -// label own = mesh.faceOwner()[faceI]; -// label nei = mesh.faceNeighbour()[faceI]; -// -// if (faceI == masterFace(mesh, own, nei)) -// { -// nFacesPerCell[own]++; -// nFacesPerCell[nei]++; -// } -// } -// -// // Coupled faces. Only cyclics done. -// HashSet > cellPair(mesh.nFaces()-mesh.nInternalFaces()); -// -// forAll(pbm, patchI) -// { -// if -// ( -// isA(pbm[patchI]) -// && refCast(pbm[patchI]).owner() -// ) -// { -// const cyclicPolyPatch& cycPatch = refCast -// ( -// pbm[patchI] -// ); -// -// const labelUList& faceCells = cycPatch.faceCells(); -// const labelUList& nbrCells = -// cycPatch.neighbPatch().faceCells(); -// -// forAll(faceCells, facei) -// { -// label own = faceCells[facei]; -// label nei = nbrCells[facei]; -// -// if (cellPair.insert(edge(own, nei))) -// { -// nFacesPerCell[own]++; -// nFacesPerCell[nei]++; -// } -// } -// } -// } -// -// -// // Size tables -// // ~~~~~~~~~~~ -// -// // Sum nFacesPerCell -// xadj.setSize(mesh.nCells()+1); -// -// label nConnections = 0; -// -// for (label cellI = 0; cellI < mesh.nCells(); cellI++) -// { -// xadj[cellI] = nConnections; -// nConnections += nFacesPerCell[cellI]; -// } -// xadj[mesh.nCells()] = nConnections; -// adjncy.setSize(nConnections); -// -// -// -// // Fill tables -// // ~~~~~~~~~~~ -// -// nFacesPerCell = 0; -// -// // Internal faces -// for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) -// { -// label own = mesh.faceOwner()[faceI]; -// label nei = mesh.faceNeighbour()[faceI]; -// -// if (faceI == masterFace(mesh, own, nei)) -// { -// adjncy[xadj[own] + nFacesPerCell[own]++] = nei; -// adjncy[xadj[nei] + nFacesPerCell[nei]++] = own; -// } -// } -// -// // Coupled faces. Only cyclics done. -// cellPair.clear(); -// forAll(pbm, patchI) -// { -// if -// ( -// isA(pbm[patchI]) -// && refCast(pbm[patchI]).owner() -// ) -// { -// const cyclicPolyPatch& cycPatch = refCast -// ( -// pbm[patchI] -// ); -// -// const labelUList& faceCells = cycPatch.faceCells(); -// const labelUList& nbrCells = -// cycPatch.neighbPatch().faceCells(); -// -// forAll(faceCells, facei) -// { -// label own = faceCells[facei]; -// label nei = nbrCells[facei]; -// -// if (cellPair.insert(edge(own, nei))) -// { -// adjncy[xadj[own] + nFacesPerCell[own]++] = nei; -// adjncy[xadj[nei] + nFacesPerCell[nei]++] = own; -// } -// } -// } -// } -//} -// -// -//// From cell-cell connections to Metis format (like CompactListList) -//void Foam::decompositionMethod::calcCSR -//( -// const labelListList& cellCells, -// List& adjncy, -// List& xadj -//) -//{ -// labelHashSet nbrCells; -// -// // Count number of internal faces -// label nConnections = 0; -// -// forAll(cellCells, coarseI) -// { -// nbrCells.clear(); -// -// const labelList& cCells = cellCells[coarseI]; -// -// forAll(cCells, i) -// { -// if (nbrCells.insert(cCells[i])) -// { -// nConnections++; -// } -// } -// } -// -// // Create the adjncy array as twice the size of the total number of -// // internal faces -// adjncy.setSize(nConnections); -// -// xadj.setSize(cellCells.size()+1); -// -// -// // Fill in xadj -// // ~~~~~~~~~~~~ -// label freeAdj = 0; -// -// forAll(cellCells, coarseI) -// { -// xadj[coarseI] = freeAdj; -// -// nbrCells.clear(); -// -// const labelList& cCells = cellCells[coarseI]; -// -// forAll(cCells, i) -// { -// if (nbrCells.insert(cCells[i])) -// { -// adjncy[freeAdj++] = cCells[i]; -// } -// } -// } -// xadj[cellCells.size()] = freeAdj; -//} - - void Foam::decompositionMethod::calcCellCells ( const polyMesh& mesh, @@ -395,25 +161,17 @@ void Foam::decompositionMethod::calcCellCells CompactListList