ENH/BUG: featureEdgeMesh/conformalVoronoiMesh.
No longer reading or writing edgeDirections - calculating them on read. Properly initialising data in featureEdgeMesh constructor. Fixing use of extend for treeBoundBox. Removing writeObj from featureEdgeMesh constructor - calling explicitly from surfaceFeatureExtract.
This commit is contained in:
parent
cac2640b93
commit
6f6d5dd39e
@ -278,10 +278,11 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
newSet,
|
||||
runTime,
|
||||
surfFileName.lessExt().name() + ".feMesh",
|
||||
true
|
||||
surfFileName.lessExt().name() + ".featureEdgeMesh"
|
||||
);
|
||||
|
||||
feMesh.writeObj(surfFileName.lessExt().name());
|
||||
|
||||
feMesh.write();
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
@ -109,7 +109,22 @@ Foam::featureEdgeMesh::featureEdgeMesh(const IOobject& io)
|
||||
|
||||
normals_ = vectorField(edgeMeshDict.lookup("normals"));
|
||||
|
||||
edgeDirections_ = vectorField(edgeMeshDict.lookup("edgeDirections"));
|
||||
{
|
||||
// Calculate edgeDirections
|
||||
|
||||
const edgeList& eds(edges());
|
||||
|
||||
const pointField& pts(points());
|
||||
|
||||
edgeDirections_.setSize(eds.size());
|
||||
|
||||
forAll(eds, eI)
|
||||
{
|
||||
edgeDirections_[eI] = eds[eI].vec(pts);
|
||||
}
|
||||
|
||||
edgeDirections_ /= mag(edgeDirections_);
|
||||
}
|
||||
|
||||
edgeNormals_ = labelListList(edgeMeshDict.lookup("edgeNormals"));
|
||||
|
||||
@ -137,23 +152,23 @@ Foam::featureEdgeMesh::featureEdgeMesh(const IOobject& io)
|
||||
Foam::featureEdgeMesh::featureEdgeMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const featureEdgeMesh& em
|
||||
const featureEdgeMesh& fem
|
||||
)
|
||||
:
|
||||
regIOobject(io),
|
||||
edgeMesh(em),
|
||||
concaveStart_(0),
|
||||
mixedStart_(0),
|
||||
nonFeatureStart_(0),
|
||||
internalStart_(0),
|
||||
flatStart_(0),
|
||||
openStart_(0),
|
||||
multipleStart_(0),
|
||||
normals_(0),
|
||||
edgeDirections_(0),
|
||||
edgeNormals_(0),
|
||||
featurePointNormals_(0),
|
||||
regionEdges_(0),
|
||||
edgeMesh(fem),
|
||||
concaveStart_(fem.concaveStart()),
|
||||
mixedStart_(fem.mixedStart()),
|
||||
nonFeatureStart_(fem.nonFeatureStart()),
|
||||
internalStart_(fem.internalStart()),
|
||||
flatStart_(fem.flatStart()),
|
||||
openStart_(fem.openStart()),
|
||||
multipleStart_(fem.multipleStart()),
|
||||
normals_(fem.normals()),
|
||||
edgeDirections_(fem.edgeDirections()),
|
||||
edgeNormals_(fem.edgeNormals()),
|
||||
featurePointNormals_(fem.featurePointNormals()),
|
||||
regionEdges_(fem.regionEdges()),
|
||||
edgeTree_(),
|
||||
edgeTreesByType_()
|
||||
{}
|
||||
@ -189,8 +204,7 @@ Foam::featureEdgeMesh::featureEdgeMesh
|
||||
(
|
||||
const surfaceFeatures& sFeat,
|
||||
const objectRegistry& obr,
|
||||
const fileName& sFeatFileName,
|
||||
bool write
|
||||
const fileName& sFeatFileName
|
||||
)
|
||||
:
|
||||
regIOobject
|
||||
@ -368,8 +382,7 @@ Foam::featureEdgeMesh::featureEdgeMesh
|
||||
"("
|
||||
" const surfaceFeatures& sFeat,"
|
||||
" const objectRegistry& obr,"
|
||||
" const fileName& sFeatFileName,"
|
||||
" bool write"
|
||||
" const fileName& sFeatFileName"
|
||||
")"
|
||||
)
|
||||
<< nl << "classifyEdge returned NONE on edge "
|
||||
@ -446,8 +459,7 @@ Foam::featureEdgeMesh::featureEdgeMesh
|
||||
"("
|
||||
" const surfaceFeatures& sFeat,"
|
||||
" const objectRegistry& obr,"
|
||||
" const fileName& sFeatFileName,"
|
||||
" bool write"
|
||||
" const fileName& sFeatFileName"
|
||||
")"
|
||||
)
|
||||
<< nl << "classifyFeaturePoint returned NONFEATURE on point at "
|
||||
@ -540,12 +552,6 @@ Foam::featureEdgeMesh::featureEdgeMesh
|
||||
}
|
||||
|
||||
featurePointNormals_ = featurePointNormals;
|
||||
|
||||
// Optionally write the edgeMesh to file
|
||||
if (write)
|
||||
{
|
||||
writeObj(sFeatFileName.lessExt());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1032,9 +1038,6 @@ bool Foam::featureEdgeMesh::writeData(Ostream& os) const
|
||||
os.writeKeyword("normals") << normals_ << token::END_STATEMENT
|
||||
<< nl << nl;
|
||||
|
||||
os.writeKeyword("edgeDirections") << edgeDirections_ << token::END_STATEMENT
|
||||
<< nl << nl;
|
||||
|
||||
os.writeKeyword("edgeNormals") << edgeNormals_ << token::END_STATEMENT
|
||||
<< nl << nl;
|
||||
|
||||
|
@ -210,8 +210,7 @@ public:
|
||||
(
|
||||
const surfaceFeatures& sFeat,
|
||||
const objectRegistry& obr,
|
||||
const fileName& sFeatFileName,
|
||||
bool write = false
|
||||
const fileName& sFeatFileName
|
||||
);
|
||||
|
||||
//- Construct from all components
|
||||
@ -353,9 +352,6 @@ public:
|
||||
//- Give precedence to the regIOobject write
|
||||
using regIOobject::write;
|
||||
|
||||
// //- ReadData function required for regIOobject read operation
|
||||
// virtual bool readData(Istream&);
|
||||
|
||||
//- WriteData function required for regIOobject write operation
|
||||
virtual bool writeData(Ostream&) const;
|
||||
};
|
||||
|
@ -248,24 +248,3 @@ inline Foam::featureEdgeMesh::edgeStatus Foam::featureEdgeMesh::getEdgeStatus
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -803,11 +803,13 @@ Foam::conformalVoronoiMesh::featurePointTree() const
|
||||
{
|
||||
if (featurePointTree_.empty())
|
||||
{
|
||||
treeBoundBox overallBb(geometryToConformTo_.bounds());
|
||||
|
||||
Random rndGen(92561);
|
||||
|
||||
overallBb.extend(rndGen, 1E-4);
|
||||
treeBoundBox overallBb
|
||||
(
|
||||
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen, 1E-4)
|
||||
);
|
||||
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
|
@ -624,11 +624,13 @@ void Foam::conformalVoronoiMesh::buildEdgeLocationTree
|
||||
const pointField& existingEdgeLocations
|
||||
) const
|
||||
{
|
||||
treeBoundBox overallBb(geometryToConformTo_.bounds());
|
||||
|
||||
Random rndGen(72953);
|
||||
|
||||
overallBb.extend(rndGen, 1E-4);
|
||||
treeBoundBox overallBb
|
||||
(
|
||||
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen, 1E-4)
|
||||
);
|
||||
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
@ -648,11 +650,13 @@ void Foam::conformalVoronoiMesh::buildEdgeLocationTree
|
||||
|
||||
void Foam::conformalVoronoiMesh::buildSizeAndAlignmentTree() const
|
||||
{
|
||||
treeBoundBox overallBb(geometryToConformTo_.bounds());
|
||||
|
||||
Random rndGen(627391);
|
||||
|
||||
overallBb.extend(rndGen, 1E-4);
|
||||
treeBoundBox overallBb
|
||||
(
|
||||
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen, 1E-4)
|
||||
);
|
||||
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user