mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Read Delaunay Mesh
This commit is contained in:
@ -70,47 +70,48 @@ Foam::DelaunayMesh<Triangulation>::DelaunayMesh
|
||||
)
|
||||
);
|
||||
|
||||
labelIOField types
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"types",
|
||||
runTime.timeName(),
|
||||
meshName,
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
labelIOField indices
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"indices",
|
||||
runTime.timeName(),
|
||||
meshName,
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
labelIOField processorIndices
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"processorIndices",
|
||||
runTime.timeName(),
|
||||
meshName,
|
||||
runTime,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
if (pts.headerOk())
|
||||
{
|
||||
labelIOField types
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"types",
|
||||
runTime.timeName(),
|
||||
meshName,
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
// Do not read in indices
|
||||
// labelIOField indices
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "indices",
|
||||
// runTime.timeName(),
|
||||
// meshName,
|
||||
// runTime,
|
||||
// IOobject::MUST_READ,
|
||||
// IOobject::NO_WRITE
|
||||
// )
|
||||
// );
|
||||
|
||||
labelIOField processorIndices
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"processorIndices",
|
||||
runTime.timeName(),
|
||||
meshName,
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
List<Vb> pointsToInsert(pts.size());
|
||||
|
||||
forAll(pointsToInsert, pI)
|
||||
@ -119,17 +120,9 @@ Foam::DelaunayMesh<Triangulation>::DelaunayMesh
|
||||
Vb
|
||||
(
|
||||
toPoint(pts[pI]),
|
||||
(indices.headerOk() ? indices[pI] : -1),
|
||||
(
|
||||
types.headerOk()
|
||||
? static_cast<indexedVertexEnum::vertexType>(types[pI])
|
||||
: Vb::vtInternal
|
||||
),
|
||||
(
|
||||
processorIndices.headerOk()
|
||||
? processorIndices[pI]
|
||||
: Pstream::myProcNo()
|
||||
)
|
||||
pI,
|
||||
static_cast<indexedVertexEnum::vertexType>(types[pI]),
|
||||
processorIndices[pI]
|
||||
);
|
||||
}
|
||||
|
||||
@ -140,6 +133,8 @@ Foam::DelaunayMesh<Triangulation>::DelaunayMesh
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
vertexCount_ = Triangulation::number_of_vertices();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -361,19 +361,19 @@ Foam::DelaunayMesh<Triangulation>::createMesh
|
||||
// Calculate pts and a map of point index to location in pts.
|
||||
label vertI = 0;
|
||||
|
||||
labelIOField indices
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"indices",
|
||||
time().timeName(),
|
||||
name,
|
||||
time(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
Triangulation::number_of_vertices()
|
||||
);
|
||||
// labelIOField indices
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "indices",
|
||||
// time().timeName(),
|
||||
// name,
|
||||
// time(),
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// Triangulation::number_of_vertices()
|
||||
// );
|
||||
|
||||
labelIOField types
|
||||
(
|
||||
@ -414,7 +414,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh
|
||||
{
|
||||
vertexMap(labelPair(vit->index(), vit->procIndex())) = vertI;
|
||||
points[vertI] = topoint(vit->point());
|
||||
indices[vertI] = vit->index();
|
||||
// indices[vertI] = vit->index();
|
||||
types[vertI] = static_cast<label>(vit->type());
|
||||
processorIndices[vertI] = vit->procIndex();
|
||||
vertI++;
|
||||
@ -422,7 +422,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh
|
||||
}
|
||||
|
||||
points.setSize(vertI);
|
||||
indices.setSize(vertI);
|
||||
// indices.setSize(vertI);
|
||||
types.setSize(vertI);
|
||||
processorIndices.setSize(vertI);
|
||||
|
||||
@ -637,7 +637,7 @@ Foam::DelaunayMesh<Triangulation>::createMesh
|
||||
|
||||
if (writeDelaunayData)
|
||||
{
|
||||
indices.write();
|
||||
// indices.write();
|
||||
types.write();
|
||||
processorIndices.write();
|
||||
}
|
||||
|
||||
@ -451,155 +451,6 @@ Foam::cellShapeControlMesh::cellShapeControlMesh(const Time& runTime)
|
||||
}
|
||||
|
||||
|
||||
//Foam::triangulatedMesh::triangulatedMesh
|
||||
//(
|
||||
// const Time& runTime,
|
||||
// const fileName& pointsFile,
|
||||
// const fileName& sizesFile,
|
||||
// const fileName& alignmentsFile,
|
||||
// const scalar& defaultCellSize
|
||||
//)
|
||||
//:
|
||||
// defaultCellSize_(defaultCellSize)
|
||||
//{
|
||||
// Info<< " Reading points from file : " << pointsFile << endl;
|
||||
//
|
||||
// pointIOField points
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// pointsFile,
|
||||
// runTime.constant(),
|
||||
// runTime,
|
||||
// IOobject::MUST_READ,
|
||||
// IOobject::NO_WRITE
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// Info<< " Reading sizes from file : " << sizesFile << endl;
|
||||
//
|
||||
// scalarIOField sizes
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// sizesFile,
|
||||
// runTime.constant(),
|
||||
// runTime,
|
||||
// IOobject::MUST_READ,
|
||||
// IOobject::NO_WRITE
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// Info<< " Reading alignments from file : " << alignmentsFile << endl;
|
||||
//
|
||||
// tensorIOField alignments
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// alignmentsFile,
|
||||
// runTime.constant(),
|
||||
// runTime,
|
||||
// IOobject::MUST_READ,
|
||||
// IOobject::NO_WRITE
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// Info<< " Number of points : " << points.size() << endl;
|
||||
// Info<< " Minimum size : " << min(sizes) << endl;
|
||||
// Info<< " Average size : " << average(sizes) << endl;
|
||||
// Info<< " Maximum size : " << max(sizes) << endl;
|
||||
//
|
||||
// forAll(points, pI)
|
||||
// {
|
||||
// size_t nVert = number_of_vertices();
|
||||
//
|
||||
// Vertex_handle v = insert
|
||||
// (
|
||||
// Point(points[pI].x(), points[pI].y(), points[pI].z())
|
||||
// );
|
||||
//
|
||||
// if (number_of_vertices() == nVert)
|
||||
// {
|
||||
// Info<< " Failed to insert point : " << points[pI] << endl;
|
||||
// }
|
||||
//
|
||||
// v->targetCellSize() = sizes[pI];
|
||||
//
|
||||
// const tensor& alignment = alignments[pI];
|
||||
//
|
||||
//
|
||||
//
|
||||
// v->alignment() = alignment;
|
||||
// }
|
||||
//
|
||||
//// scalar factor = 1.0;
|
||||
//// label maxIteration = 1;
|
||||
////
|
||||
//// for (label iteration = 0; iteration < maxIteration; ++iteration)
|
||||
//// {
|
||||
//// Info<< "Iteration : " << iteration << endl;
|
||||
////
|
||||
//// label nRefined = refineTriangulation(factor);
|
||||
////
|
||||
//// Info<< " Number of cells refined in refinement iteration : "
|
||||
//// << nRefined << nl << endl;
|
||||
////
|
||||
//// if (nRefined <= 0 && iteration != 0)
|
||||
//// {
|
||||
//// break;
|
||||
//// }
|
||||
////
|
||||
//// factor *= 1.5;
|
||||
//// }
|
||||
//
|
||||
// //writeRefinementTriangulation();
|
||||
//}
|
||||
|
||||
|
||||
//Foam::triangulatedMesh::triangulatedMesh
|
||||
//(
|
||||
// const Time& runTime,
|
||||
// const DynamicList<Foam::point>& points,
|
||||
// const DynamicList<scalar>& sizes,
|
||||
// const DynamicList<tensor>& alignments,
|
||||
// const scalar& defaultCellSize
|
||||
//)
|
||||
//:
|
||||
// defaultCellSize_(defaultCellSize)
|
||||
//{
|
||||
// forAll(points, pI)
|
||||
// {
|
||||
// size_t nVert = number_of_vertices();
|
||||
//
|
||||
// Vertex_handle v = insert
|
||||
// (
|
||||
// Point(points[pI].x(), points[pI].y(), points[pI].z())
|
||||
// );
|
||||
//
|
||||
// if (number_of_vertices() == nVert)
|
||||
// {
|
||||
// Info<< "Failed to insert point : " << points[pI] << endl;
|
||||
// }
|
||||
//
|
||||
// v->targetCellSize() = sizes[pI];
|
||||
//
|
||||
// v->alignment() = alignments[pI];
|
||||
// }
|
||||
//
|
||||
// //writeRefinementTriangulation();
|
||||
//
|
||||
// Info<< nl << "Refinement triangulation information: " << endl;
|
||||
// Info<< " Number of vertices: " << label(number_of_vertices()) << endl;
|
||||
// Info<< " Number of cells : "
|
||||
// << label(number_of_finite_cells()) << endl;
|
||||
// Info<< " Number of faces : "
|
||||
// << label(number_of_finite_facets()) << endl;
|
||||
// Info<< " Number of edges : "
|
||||
// << label(number_of_finite_edges()) << endl;
|
||||
// Info<< " Dimensionality : " << label(dimension()) << nl << endl;
|
||||
//}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellShapeControlMesh::~cellShapeControlMesh()
|
||||
|
||||
@ -528,7 +528,7 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
||||
<< (cellSizeMesh.is_valid() ? "valid" : "not valid!" )
|
||||
<< endl;
|
||||
|
||||
if (!Pstream::parRun() && foamyHexMeshControls().objOutput())
|
||||
if (foamyHexMeshControls().writeCellShapeControlMesh())
|
||||
{
|
||||
//cellSizeMesh.writeTriangulation();
|
||||
cellSizeMesh.write();
|
||||
|
||||
Reference in New Issue
Block a user