Commit 00af938b authored by Franjo's avatar Franjo
Browse files

Minor updates

parent 43b2e82b
......@@ -25,6 +25,7 @@ findCellsIntersectingSurface = $(intersectionTools)/findCellsIntersectingSurface
meshOptimizer = utilities/smoothers/geometry/meshOptimizer
tetMeshOptimisation = $(meshOptimizer)/tetMeshOptimisation
symmetryPlaneOptimisation = $(meshOptimizer)/symmetryPlaneOptimisation
simplexSmoother = $(tetMeshOptimisation)/advancedSmoothers/simplexSmoother
knuppMetric = $(tetMeshOptimisation)/advancedSmoothers/knuppMetric
meshUntangler = $(tetMeshOptimisation)/advancedSmoothers/meshUntangler
......
......@@ -164,6 +164,7 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
const face& f1 = bFaces[eFaces(eI, 0)];
const face& f2 = bFaces[eFaces(eI, 1)];
if
(
!help::isSharedEdgeConvex(points, f1, f2) ||
......@@ -216,6 +217,7 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
continue;
const edge& e = edges[beI];
if
(
!is2DMesh_ &&
......@@ -263,6 +265,7 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
{
const label beI =
globalToLocal[receivedData[counter++].pointLabel()];
DynList<label> f(receivedData[counter++].pointLabel());
forAll(f, pI)
{
......@@ -294,6 +297,7 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
}
const face& bf = bFaces[eFaces(beI, 0)];
const label patch0 = boundaryFacePatches[eFaces(beI, 0)];
const label patch1 = otherProcPatches[beI];
......@@ -463,7 +467,8 @@ void boundaryLayers::findPatchesToBeTreatedTogether()
if( usedPatch[patchI] || (boundaries[patchI].patchSize() == 0) )
continue;
Info << "Adding layer subset " << layerI << " for patch " << patchI << endl;
Info << "Adding layer subset " << layerI
<< " for patch " << patchI << endl;
usedPatch[patchI] = true;
subsetId = mesh_.addFaceSubset("layer_"+help::scalarToText(layerI));
++layerI;
......
......@@ -275,7 +275,6 @@ inline void boundaryLayers::createNewCellFromNode
const label p12 = m.find(pr)->second;
//- create the cell and append it
//- F0
cellFaces[0][0] = pointI;
cellFaces[0][1] = p02;
......
......@@ -156,7 +156,7 @@ void refineBoundaryLayers::setNumberOfLayersForPatch
return;
}
labelList matchedIDs = mesh_.findPatches(patchName);
const labelList matchedIDs = mesh_.findPatches(patchName);
forAll(matchedIDs, matchI)
{
......@@ -182,11 +182,12 @@ void refineBoundaryLayers::setThicknessRatioForPatch
return;
}
labelList matchedIDs = mesh_.findPatches(patchName);
const labelList matchedIDs = mesh_.findPatches(patchName);
forAll(matchedIDs, matchI)
{
thicknessRatioForPatch_[mesh_.getPatchName(matchedIDs[matchI])] = thicknessRatio;
const word pName = mesh_.getPatchName(matchedIDs[matchI]);
thicknessRatioForPatch_[pName] = thicknessRatio;
}
}
......@@ -208,21 +209,23 @@ void refineBoundaryLayers::setMaxThicknessOfFirstLayerForPatch
return;
}
labelList matchedIDs = mesh_.findPatches(patchName);
const labelList matchedIDs = mesh_.findPatches(patchName);
forAll(matchedIDs, matchI)
{
maxThicknessForPatch_[mesh_.getPatchName(matchedIDs[matchI])] = maxThickness;
const word pName = mesh_.getPatchName(matchedIDs[matchI]);
maxThicknessForPatch_[pName] = maxThickness;
}
}
void refineBoundaryLayers::setInteruptForPatch(const word& patchName)
{
labelList matchedIDs = mesh_.findPatches(patchName);
const labelList matchedIDs = mesh_.findPatches(patchName);
forAll(matchedIDs, matchI)
{
discontinuousLayersForPatch_.insert(mesh_.getPatchName(matchedIDs[matchI]));
const word pName = mesh_.getPatchName(matchedIDs[matchI]);
discontinuousLayersForPatch_.insert(pName);
}
}
......
......@@ -278,7 +278,7 @@ void partTriMesh::createBufferLayers()
std::make_pair(neiProcs[procI], LongList<parTriFace>())
);
//- lop over triangles and add the ones having vertices at parallel
//- loop over triangles and add the ones having vertices at parallel
//- boundaries for sending
forAll(surf_, triI)
{
......
......@@ -56,8 +56,7 @@ boundaryPatch::boundaryPatch
boundaryPatch::boundaryPatch(const word& name, const dictionary& dict)
:
boundaryPatchBase(name, dict)
{
}
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -80,7 +79,7 @@ void boundaryPatch::write(Ostream& os) const
void boundaryPatch::writeDict(Ostream& os) const
{
this->operator<<(os);
}
Ostream& boundaryPatch::operator<<(Ostream& os) const
......
......@@ -43,7 +43,7 @@ void polyMeshGenFaces::clearOut() const
deleteDemandDrivenData(ownerPtr_);
deleteDemandDrivenData(neighbourPtr_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Constructors
//- Null constructor
......@@ -67,8 +67,7 @@ polyMeshGenFaces::polyMeshGenFaces(const Time& runTime)
nIntFaces_(0),
ownerPtr_(NULL),
neighbourPtr_(NULL)
{
}
{}
//- Construct from components without the boundary
polyMeshGenFaces::polyMeshGenFaces
......@@ -96,8 +95,7 @@ polyMeshGenFaces::polyMeshGenFaces
nIntFaces_(0),
ownerPtr_(NULL),
neighbourPtr_(NULL)
{
}
{}
//- Construct from components with the boundary
polyMeshGenFaces::polyMeshGenFaces
......@@ -119,7 +117,7 @@ polyMeshGenFaces::polyMeshGenFaces
runTime.constant(),
"polyMesh",
runTime
),
),
faces
),
procBoundaries_(),
......@@ -140,7 +138,7 @@ polyMeshGenFaces::polyMeshGenFaces
"const labelList& patchStart,"
"const labelList& nFacesInPatch)"
) << "Cannot do this in parallel!" << exit(FatalError);
boundaries_.setSize(patchNames.size());
forAll(patchNames, patchI)
{
......@@ -157,7 +155,7 @@ polyMeshGenFaces::polyMeshGenFaces
);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Destructor
polyMeshGenFaces::~polyMeshGenFaces()
......@@ -181,7 +179,7 @@ label polyMeshGenFaces::faceIsInProcPatch(const label faceLabel) const
)
)
return -1;
forAllReverse(procBoundaries_, patchI)
if( faceLabel >= procBoundaries_[patchI].patchStart() )
return patchI;
......@@ -194,7 +192,7 @@ label polyMeshGenFaces::faceIsInPatch(const label faceLabel) const
const label i = boundaries_.size() - 1;
if( faceLabel >= (boundaries_[i].patchStart()+boundaries_[i].patchSize()) )
return -1;
forAllReverse(boundaries_, patchI)
if( faceLabel >= boundaries_[patchI].patchStart() )
return patchI;
......@@ -269,7 +267,7 @@ label polyMeshGenFaces::addFaceSubset(const word& setName)
Warning << "Face subset " << setName << " already exists!" << endl;
return id;
}
id = 0;
for
(
......@@ -278,7 +276,7 @@ label polyMeshGenFaces::addFaceSubset(const word& setName)
++it
)
id = Foam::max(id, it->first+1);
faceSubsets_.insert
(
std::make_pair
......@@ -287,7 +285,7 @@ label polyMeshGenFaces::addFaceSubset(const word& setName)
meshSubset(setName, meshSubset::FACESUBSET)
)
);
return id;
}
......@@ -295,7 +293,7 @@ void polyMeshGenFaces::removeFaceSubset(const label setI)
{
if( faceSubsets_.find(setI) == faceSubsets_.end() )
return;
faceSubsets_.erase(setI);
}
......@@ -308,7 +306,7 @@ word polyMeshGenFaces::faceSubsetName(const label setI) const
Warning << "Subset " << setI << " is not a face subset" << endl;
return word();
}
return it->second.name();
}
......@@ -320,14 +318,14 @@ label polyMeshGenFaces::faceSubsetIndex(const word& setName) const
if( it->second.name() == setName )
return it->first;
}
return -1;
}
void polyMeshGenFaces::read()
{
polyMeshGenPoints::read();
faceIOList fcs
(
IOobject
......@@ -340,10 +338,10 @@ void polyMeshGenFaces::read()
)
);
faces_ = fcs;
deleteDemandDrivenData(ownerPtr_);
deleteDemandDrivenData(neighbourPtr_);
ownerPtr_ =
new labelIOList
(
......@@ -356,7 +354,7 @@ void polyMeshGenFaces::read()
IOobject::MUST_READ
)
);
neighbourPtr_ =
new labelIOList
(
......@@ -369,10 +367,10 @@ void polyMeshGenFaces::read()
IOobject::MUST_READ
)
);
if( neighbourPtr_->size() != ownerPtr_->size() )
neighbourPtr_->setSize(ownerPtr_->size(), -1);
//- read boundary information
IOPtrList<boundaryPatchBase> patches
(
......@@ -385,15 +383,15 @@ void polyMeshGenFaces::read()
IOobject::MUST_READ
)
);
label i(0);
forAll(patches, patchI)
if( patches[patchI].type() == "processor" )
++i;
procBoundaries_.setSize(i);
boundaries_.setSize(patches.size()-i);
i=0;
forAll(patches, patchI)
if( patches[patchI].type() != "processor" )
......@@ -411,7 +409,7 @@ void polyMeshGenFaces::read()
);
++i;
}
i = 0;
forAll(patches, patchI)
if( patches[patchI].type() == "processor" )
......@@ -428,7 +426,7 @@ void polyMeshGenFaces::read()
}
nIntFaces_ = boundaries_[0].patchStart();
//- read face subsets
IOobjectList allSets
(
......@@ -436,12 +434,12 @@ void polyMeshGenFaces::read()
runTime_.constant(),
"polyMesh/sets"
);
wordList setNames = allSets.names("faceSet");
forAll(setNames, setI)
{
IOobject* obj = allSets.lookup(setNames[setI]);
faceSet fSet(*obj);
labelList content = fSet.toc();
const label id = addFaceSubset(setNames[setI]);
......@@ -453,22 +451,22 @@ void polyMeshGenFaces::read()
void polyMeshGenFaces::write() const
{
polyMeshGenPoints::write();
faces_.write();
if( !ownerPtr_ || !neighbourPtr_ )
calculateOwnersAndNeighbours();
ownerPtr_->write();
neighbourPtr_->write();
//- write boundary data
PtrList<boundaryPatchBase> ptchs
(
procBoundaries_.size() + boundaries_.size()
);
label i(0);
//- ordinary patches come first
forAll(boundaries_, patchI)
{
......@@ -478,7 +476,7 @@ void polyMeshGenFaces::write() const
dict.add("startFace", boundaries_[patchI].patchStart());
ptchs.set
(
i++,
i++,
boundaryPatchBase::New
(
boundaries_[patchI].patchName(),
......@@ -486,7 +484,7 @@ void polyMeshGenFaces::write() const
)
);
}
//- processor patches are at the end
forAll(procBoundaries_, patchI)
{
......@@ -500,7 +498,7 @@ void polyMeshGenFaces::write() const
)
);
}
IOPtrList<boundaryPatchBase> patches
(
IOobject
......@@ -514,9 +512,9 @@ void polyMeshGenFaces::write() const
),
ptchs
);
patches.write();
//- write face subsets
std::map<label, meshSubset>::const_iterator setIt;
for(setIt=faceSubsets_.begin();setIt!=faceSubsets_.end();++setIt)
......@@ -533,10 +531,10 @@ void polyMeshGenFaces::write() const
IOobject::AUTO_WRITE
)
);
labelLongList containedElements;
setIt->second.containedElements(containedElements);
forAll(containedElements, i)
set.insert(containedElements[i]);
set.write();
......
......@@ -49,46 +49,46 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
class polyMeshGenFaces
: public polyMeshGenPoints
: public polyMeshGenPoints
{
protected:
// Protected data
//- list of faces
faceListPMG faces_;
//- inter-processor boundaries. These faces are located after the other
//- boundary faces in the list of faces. The processor
//- boundaries are internal faces in the end.
PtrList<processorBoundaryPatch> procBoundaries_;
//- boundary data
PtrList<boundaryPatch> boundaries_;
//- face subsets
std::map<label, meshSubset> faceSubsets_;
// Addressing data
//- number of internal faces, owner and neighbour
mutable label nIntFaces_;
mutable labelIOList* ownerPtr_;
mutable labelIOList* neighbourPtr_;
// Private member functions
//- calculate owner and neighbour addressing
virtual void calculateOwnersAndNeighbours() const = 0;
//- clear all pointer data
void clearOut() const;
// Disallow bitwise assignment
void operator=(const polyMeshGenFaces&);
polyMeshGenFaces(const polyMeshGenFaces&);
public:
friend class polyMeshGenModifier;
// Constructors
......@@ -113,33 +113,33 @@ public:
const labelList& patchStart,
const labelList& nFacesInPatch
);
// Destructor
virtual ~polyMeshGenFaces();
// Member functions
//- access to faces
inline const faceListPMG& faces() const;
//- return number of internal faces
inline label nInternalFaces() const;
//- owner and neighbour cells for faces
inline const labelList& owner() const;
inline const labelList& neighbour() const;
// Boundary data
//- inter-processor boundaries
inline const PtrList<processorBoundaryPatch>& procBoundaries() const;
//- return processor patch label for the given face label
label faceIsInProcPatch(const label faceLabel) const;
//- ordinary boundaries
inline const PtrList<boundaryPatch>& boundaries() const;
//- return patch label for the given face label
label faceIsInPatch(const label faceLabel) const;
......@@ -151,13 +151,13 @@ public:
//- return the name of a patch given its ID
word getPatchName(const label patchID) const;
//- return a list of patch indices corresponding to the given
//- return a list of patch indices corresponding to the given
// name, expanding regular expressions
labelList findPatches(const word& patchName) const;
// Subsets
label addFaceSubset(const word&);
void removeFaceSubset(const label);
word faceSubsetName(const label) const;
......@@ -171,10 +171,10 @@ public:
template<class ListType>
inline void updateFaceSubsets(const ListType&);
inline void updateFaceSubsets(const VRWGraph&);
// Read mesh
void read();
// Write mesh
void write() const;
};
......
......@@ -87,9 +87,9 @@ wordList triSurfFacets::patchNames() const
labelList triSurfFacets::findPatches(const word& patchName) const
{
wordList allPatches = patchNames();
const wordList allPatches = patchNames();
labelList patchIDs = findStrings(patchName, allPatches);
const labelList patchIDs = findStrings(patchName, allPatches);
if(patchIDs.empty())
{
......
......@@ -100,8 +100,8 @@ public:
//- return list of patches in the boundary
wordList patchNames() const;
//- return a list of patch indices corresponding to the given
//- return a list of patch indices corresponding to the given
// name, expanding regular expressions
labelList findPatches(const word& patchName) const;
......
......@@ -904,7 +904,11 @@ void meshOctreeAddressing::createOctreeFaces() const
forAll(sum, lfI)
{
if( Pstream::parRun() && octree_.returnLeaf(lfI).procNo() != Pstream::myProcNo() )
if
(
Pstream::parRun() &&
octree_.returnLeaf(lfI).procNo() != Pstream::myProcNo()
)
continue;
if( (boxType[lfI] & MESHCELL) && (mag(sum[lfI]) > SMALL) )
Info << "Leaf " << lfI << " is not closed " << sum[lfI] << endl;
......
......@@ -178,9 +178,11 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
const dictionary& dict = meshDictPtr_->subDict("patchCellSize");