mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -278,10 +278,11 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
newSet,
|
newSet,
|
||||||
runTime,
|
runTime,
|
||||||
surfFileName.lessExt().name() + ".feMesh",
|
surfFileName.lessExt().name() + ".featureEdgeMesh"
|
||||||
true
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
feMesh.writeObj(surfFileName.lessExt().name());
|
||||||
|
|
||||||
feMesh.write();
|
feMesh.write();
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
Info<< "End\n" << endl;
|
||||||
|
|||||||
@ -109,7 +109,22 @@ Foam::featureEdgeMesh::featureEdgeMesh(const IOobject& io)
|
|||||||
|
|
||||||
normals_ = vectorField(edgeMeshDict.lookup("normals"));
|
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"));
|
edgeNormals_ = labelListList(edgeMeshDict.lookup("edgeNormals"));
|
||||||
|
|
||||||
@ -137,23 +152,23 @@ Foam::featureEdgeMesh::featureEdgeMesh(const IOobject& io)
|
|||||||
Foam::featureEdgeMesh::featureEdgeMesh
|
Foam::featureEdgeMesh::featureEdgeMesh
|
||||||
(
|
(
|
||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const featureEdgeMesh& em
|
const featureEdgeMesh& fem
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
regIOobject(io),
|
regIOobject(io),
|
||||||
edgeMesh(em),
|
edgeMesh(fem),
|
||||||
concaveStart_(0),
|
concaveStart_(fem.concaveStart()),
|
||||||
mixedStart_(0),
|
mixedStart_(fem.mixedStart()),
|
||||||
nonFeatureStart_(0),
|
nonFeatureStart_(fem.nonFeatureStart()),
|
||||||
internalStart_(0),
|
internalStart_(fem.internalStart()),
|
||||||
flatStart_(0),
|
flatStart_(fem.flatStart()),
|
||||||
openStart_(0),
|
openStart_(fem.openStart()),
|
||||||
multipleStart_(0),
|
multipleStart_(fem.multipleStart()),
|
||||||
normals_(0),
|
normals_(fem.normals()),
|
||||||
edgeDirections_(0),
|
edgeDirections_(fem.edgeDirections()),
|
||||||
edgeNormals_(0),
|
edgeNormals_(fem.edgeNormals()),
|
||||||
featurePointNormals_(0),
|
featurePointNormals_(fem.featurePointNormals()),
|
||||||
regionEdges_(0),
|
regionEdges_(fem.regionEdges()),
|
||||||
edgeTree_(),
|
edgeTree_(),
|
||||||
edgeTreesByType_()
|
edgeTreesByType_()
|
||||||
{}
|
{}
|
||||||
@ -189,8 +204,7 @@ Foam::featureEdgeMesh::featureEdgeMesh
|
|||||||
(
|
(
|
||||||
const surfaceFeatures& sFeat,
|
const surfaceFeatures& sFeat,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const fileName& sFeatFileName,
|
const fileName& sFeatFileName
|
||||||
bool write
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
regIOobject
|
regIOobject
|
||||||
@ -368,8 +382,7 @@ Foam::featureEdgeMesh::featureEdgeMesh
|
|||||||
"("
|
"("
|
||||||
" const surfaceFeatures& sFeat,"
|
" const surfaceFeatures& sFeat,"
|
||||||
" const objectRegistry& obr,"
|
" const objectRegistry& obr,"
|
||||||
" const fileName& sFeatFileName,"
|
" const fileName& sFeatFileName"
|
||||||
" bool write"
|
|
||||||
")"
|
")"
|
||||||
)
|
)
|
||||||
<< nl << "classifyEdge returned NONE on edge "
|
<< nl << "classifyEdge returned NONE on edge "
|
||||||
@ -446,8 +459,7 @@ Foam::featureEdgeMesh::featureEdgeMesh
|
|||||||
"("
|
"("
|
||||||
" const surfaceFeatures& sFeat,"
|
" const surfaceFeatures& sFeat,"
|
||||||
" const objectRegistry& obr,"
|
" const objectRegistry& obr,"
|
||||||
" const fileName& sFeatFileName,"
|
" const fileName& sFeatFileName"
|
||||||
" bool write"
|
|
||||||
")"
|
")"
|
||||||
)
|
)
|
||||||
<< nl << "classifyFeaturePoint returned NONFEATURE on point at "
|
<< nl << "classifyFeaturePoint returned NONFEATURE on point at "
|
||||||
@ -540,12 +552,6 @@ Foam::featureEdgeMesh::featureEdgeMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
featurePointNormals_ = featurePointNormals;
|
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
|
os.writeKeyword("normals") << normals_ << token::END_STATEMENT
|
||||||
<< nl << nl;
|
<< nl << nl;
|
||||||
|
|
||||||
os.writeKeyword("edgeDirections") << edgeDirections_ << token::END_STATEMENT
|
|
||||||
<< nl << nl;
|
|
||||||
|
|
||||||
os.writeKeyword("edgeNormals") << edgeNormals_ << token::END_STATEMENT
|
os.writeKeyword("edgeNormals") << edgeNormals_ << token::END_STATEMENT
|
||||||
<< nl << nl;
|
<< nl << nl;
|
||||||
|
|
||||||
|
|||||||
@ -210,8 +210,7 @@ public:
|
|||||||
(
|
(
|
||||||
const surfaceFeatures& sFeat,
|
const surfaceFeatures& sFeat,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const fileName& sFeatFileName,
|
const fileName& sFeatFileName
|
||||||
bool write = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from all components
|
//- Construct from all components
|
||||||
@ -353,9 +352,6 @@ public:
|
|||||||
//- Give precedence to the regIOobject write
|
//- Give precedence to the regIOobject write
|
||||||
using regIOobject::write;
|
using regIOobject::write;
|
||||||
|
|
||||||
// //- ReadData function required for regIOobject read operation
|
|
||||||
// virtual bool readData(Istream&);
|
|
||||||
|
|
||||||
//- WriteData function required for regIOobject write operation
|
//- WriteData function required for regIOobject write operation
|
||||||
virtual bool writeData(Ostream&) const;
|
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())
|
if (featurePointTree_.empty())
|
||||||
{
|
{
|
||||||
treeBoundBox overallBb(geometryToConformTo_.bounds());
|
|
||||||
|
|
||||||
Random rndGen(92561);
|
Random rndGen(92561);
|
||||||
|
|
||||||
overallBb.extend(rndGen, 1E-4);
|
treeBoundBox overallBb
|
||||||
|
(
|
||||||
|
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen, 1E-4)
|
||||||
|
);
|
||||||
|
|
||||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
|
||||||
|
|||||||
@ -624,11 +624,13 @@ void Foam::conformalVoronoiMesh::buildEdgeLocationTree
|
|||||||
const pointField& existingEdgeLocations
|
const pointField& existingEdgeLocations
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
treeBoundBox overallBb(geometryToConformTo_.bounds());
|
|
||||||
|
|
||||||
Random rndGen(72953);
|
Random rndGen(72953);
|
||||||
|
|
||||||
overallBb.extend(rndGen, 1E-4);
|
treeBoundBox overallBb
|
||||||
|
(
|
||||||
|
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen, 1E-4)
|
||||||
|
);
|
||||||
|
|
||||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
|
||||||
@ -648,11 +650,13 @@ void Foam::conformalVoronoiMesh::buildEdgeLocationTree
|
|||||||
|
|
||||||
void Foam::conformalVoronoiMesh::buildSizeAndAlignmentTree() const
|
void Foam::conformalVoronoiMesh::buildSizeAndAlignmentTree() const
|
||||||
{
|
{
|
||||||
treeBoundBox overallBb(geometryToConformTo_.bounds());
|
|
||||||
|
|
||||||
Random rndGen(627391);
|
Random rndGen(627391);
|
||||||
|
|
||||||
overallBb.extend(rndGen, 1E-4);
|
treeBoundBox overallBb
|
||||||
|
(
|
||||||
|
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen, 1E-4)
|
||||||
|
);
|
||||||
|
|
||||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user