Reorganisation and clean-up

This commit is contained in:
Hrvoje Jasak 2017-05-25 14:44:59 +01:00
parent 739cbbfca5
commit 41353e4dac
11 changed files with 221 additions and 211 deletions

View file

@ -166,8 +166,7 @@ public:
);
// Destructor
//- Destructor
virtual ~layerAdditionRemoval();

View file

@ -134,8 +134,7 @@ public:
);
// Destructor
//- Destructor
virtual ~polyMeshModifier();

View file

@ -120,13 +120,4 @@ void Foam::setUpdater::writeDict(Ostream& os) const
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// ************************************************************************* //

View file

@ -25,7 +25,7 @@ Class
Foam::setUpdater
Description
Keeps cell/face/vertex sets uptodate. Both the ones loaded and the ones
Keeps cell/face/vertex sets up-to-date: both the ones loaded and the ones
on disk.
SourceFiles
@ -116,6 +116,7 @@ public:
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "setUpdaterTemplates.C"
#endif

View file

@ -103,6 +103,16 @@ public:
zoneID_(zoneID)
{}
//- Construct Istream
polyAddCell(Istream& is)
:
masterPointID_(readLabel(is)),
masterEdgeID_(readLabel(is)),
masterFaceID_(readLabel(is)),
masterCellID_(readLabel(is)),
zoneID_(readLabel(is))
{}
//- Construct and return a clone
virtual autoPtr<topoAction> clone() const
{
@ -183,6 +193,19 @@ public:
return zoneID_;
}
// IOstream Operators
friend Ostream& operator<<(Ostream& os , const polyAddCell& pac)
{
os << pac.masterPointID_
<< pac.masterEdgeID_
<< pac.masterFaceID_
<< pac.masterCellID_
<< pac.zoneID_;
return os;
}
};

View file

@ -86,6 +86,104 @@ class polyAddFace
bool zoneFlip_;
// Private Member Functions
//- Check
void check() const
{
if (face_.size() < 3)
{
FatalErrorIn("polyAddFace::check()")
<< "Invalid face: less than 3 points. "
<< "This is not allowed.\n"
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
if (min(face_) < 0)
{
FatalErrorIn("polyAddFace::check()")
<< "Face contains invalid vertex ID: " << face_ << ". "
<< "This is not allowed.\n"
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
if (min(owner_, neighbour_) >= 0 && owner_ == neighbour_)
{
FatalErrorIn("polyAddFace::check()")
<< "Face owner and neighbour are identical. "
<< "This is not allowed.\n"
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
if (neighbour_ >= 0 && patchID_ >= 0)
{
FatalErrorIn("polyAddFace::check()")
<< "Patch face has got a neighbour. Patch ID: " << patchID_
<< ". This is not allowed.\n"
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
if (owner_ < 0 && zoneID_ < 0)
{
FatalErrorIn("polyAddFace::check()")
<< "Face has no owner and is not in a zone. "
<< "This is not allowed.\n"
<< "Face: " << face_
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
if (zoneID_ == -1 && zoneFlip_)
{
FatalErrorIn("polyAddFace::check()")
<< "Specified zone flip for a face that does not "
<< "belong to zone. This is not allowed.\n"
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
}
public:
// Static data members
@ -138,174 +236,24 @@ public:
zoneID_(zoneID),
zoneFlip_(zoneFlip)
{
if (face_.size() < 3)
{
FatalErrorIn
(
"polyAddFace\n"
"(\n"
" const face& f,\n"
" const label owner,"
" const label neighbour,\n"
" const label masterPointID,\n"
" const label masterEdgeID,\n"
" const label masterFaceID,\n"
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
")"
) << "Invalid face: less than 3 points. "
<< "This is not allowed.\n"
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
check();
}
if (min(face_) < 0)
//- Construct from Istream
polyAddFace(Istream& is)
:
face_(is),
owner_(readLabel(is)),
neighbour_(readLabel(is)),
masterPointID_(readLabel(is)),
masterEdgeID_(readLabel(is)),
masterFaceID_(readLabel(is)),
flipFaceFlux_(readBool(is)),
patchID_(readLabel(is)),
zoneID_(readLabel(is)),
zoneFlip_(readBool(is))
{
FatalErrorIn
(
"polyAddFace\n"
"(\n"
" const face& f,\n"
" const label owner,"
" const label neighbour,\n"
" const label masterPointID,\n"
" const label masterEdgeID,\n"
" const label masterFaceID,\n"
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
")"
) << "Face contains invalid vertex ID: " << face_ << ". "
<< "This is not allowed.\n"
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
if (min(owner_, neighbour_) >= 0 && owner_ == neighbour_)
{
FatalErrorIn
(
"polyAddFace\n"
"(\n"
" const face& f,\n"
" const label owner,"
" const label neighbour,\n"
" const label masterPointID,\n"
" const label masterEdgeID,\n"
" const label masterFaceID,\n"
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
")"
) << "Face owner and neighbour are identical. "
<< "This is not allowed.\n"
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
if (neighbour_ >= 0 && patchID >= 0)
{
FatalErrorIn
(
"polyAddFace\n"
"(\n"
" const face& f,\n"
" const label owner,"
" const label neighbour,\n"
" const label masterPointID,\n"
" const label masterEdgeID,\n"
" const label masterFaceID,\n"
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
")"
) << "Patch face has got a neighbour. Patch ID: " << patchID
<< ". This is not allowed.\n"
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
if (owner_ < 0 && zoneID < 0)
{
FatalErrorIn
(
"polyAddFace\n"
"(\n"
" const face& f,\n"
" const label owner,"
" const label neighbour,\n"
" const label patchID,\n"
" const label zoneID"
")"
) << "Face has no owner and is not in a zone. "
<< "This is not allowed.\n"
<< "Face: " << face_
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
if (zoneID_ == -1 && zoneFlip)
{
FatalErrorIn
(
"polyAddFace\n"
"(\n"
" const face& f,\n"
" const label owner,"
" const label neighbour,\n"
" const label masterPointID,\n"
" const label masterEdgeID,\n"
" const label masterFaceID,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"
")"
) << "Specified zone flip for a face that does not "
<< "belong to zone. This is not allowed.\n"
<< "Face: " << face_
<< " masterPointID:" << masterPointID_
<< " masterEdgeID:" << masterEdgeID_
<< " masterFaceID:" << masterFaceID_
<< " patchID:" << patchID_
<< " owner:" << owner_
<< " neighbour:" << neighbour_
<< abort(FatalError);
}
check();
}
//- Construct and return a clone
@ -420,6 +368,25 @@ public:
{
return zoneFlip_;
}
// IOstream Operators
friend Ostream& operator<<(Ostream& os , const polyAddFace& paf)
{
os << paf.face_
<< paf.owner_
<< paf.neighbour_
<< paf.masterPointID_
<< paf.masterEdgeID_
<< paf.masterFaceID_
<< paf.flipFaceFlux_
<< paf.patchID_
<< paf.zoneID_
<< paf.zoneFlip_;
return os;
}
};

View file

@ -64,6 +64,32 @@ class polyAddPoint
bool inCell_;
// Private Member Functions
//- Check
void check() const
{
if (zoneID_ < 0 && !inCell_)
{
FatalErrorIn
(
"polyAddPoint\n"
"(\n"
" const point& p,\n"
" const label masterPointID,\n"
" const label zoneID,\n"
" const bool inCell\n"
")"
) << "Point is not in a cell and not in a zone. "
<< "This is not allowed.\n"
<< "point: " << p_
<< " master: " << masterPointID_
<< " zone: " << zoneID_
<< abort(FatalError);
}
}
public:
// Static data members
@ -97,25 +123,18 @@ public:
zoneID_(zoneID),
inCell_(inCell)
{
if (zoneID_ < 0 && !inCell)
{
FatalErrorIn
(
"polyAddPoint\n"
"(\n"
" const point& p,\n"
" const label masterPointID,\n"
" const label zoneID,\n"
" const bool inCell\n"
")"
) << "Point is not in a cell and not in a zone. "
<< "This is not allowed.\n"
<< "point: " << p
<< " master: " << masterPointID_
<< " zone: " << zoneID_
<< abort(FatalError);
check();
}
//- Construct from Istream
polyAddPoint(Istream& is)
:
p_(is),
masterPointID_(readLabel(is)),
zoneID_(readLabel(is)),
inCell_(readBool(is))
{
check();
}
//- Construct and return a clone
@ -165,6 +184,16 @@ public:
{
return inCell_;
}
// IOstream Operators
friend Ostream& operator<<(Ostream& os , const polyAddPoint& pap)
{
os << pap.p_ << pap.masterPointID_ << pap.zoneID_ << pap.inCell_;
return os;
}
};

View file

@ -130,8 +130,7 @@ public:
polyTopoChange(const polyMesh&);
// Destructor
//- Destructor
~polyTopoChange();

View file

@ -124,8 +124,7 @@ public:
explicit polyTopoChanger(polyMesh&);
// Destructor
//- Destructor
virtual ~polyTopoChanger()
{}

View file

@ -417,7 +417,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChanger::changeMesh
if (debug)
{
Pout<< "Added retired points: modified = "
Pout<< " modified = "
<< nNewPoints - debugPointCounter;
debugPointCounter = nNewPoints;

View file

@ -1039,6 +1039,9 @@ void lengthScaleEstimator::calculateLengthScale
// Lookup various field types, and evaluate the gradient
bool invalidObject = true;
// Evaluate using gradient scheme
word gradName("grad(" + field_ + ')');
// Register field under a name that's unique
word registerName("lengthScaleGradient(" + field_ + ')');
@ -1062,7 +1065,7 @@ void lengthScaleEstimator::calculateLengthScale
IOobject::NO_WRITE,
false
),
mag(fvc::grad(field))
mag(fvc::grad(field, gradName))
)
);
@ -1089,7 +1092,7 @@ void lengthScaleEstimator::calculateLengthScale
IOobject::NO_WRITE,
false
),
mag(fvc::grad(field))
mag(fvc::grad(field, gradName))
)
);