ENH: additional methods for OBJstream

- write point fields
- writeLine (takes two points)
- writeFace (takes list of face loop points)
This commit is contained in:
Mark Olesen
2022-07-13 20:16:35 +02:00
parent dea31e9b4a
commit c4d18e97a3
40 changed files with 301 additions and 359 deletions

View File

@ -699,7 +699,7 @@ void Foam::radiation::laserDTRM::calculate()
for (label pointi = 0; pointi < lines.size(); pointi += 2) for (label pointi = 0; pointi < lines.size(); pointi += 2)
{ {
os.write(linePointRef(lines[pointi], lines[pointi+1])); os.writeLine(lines[pointi], lines[pointi+1]);
} }
} }

View File

@ -1397,26 +1397,20 @@ void extrudeGeometricProperties
{ {
Pout<< "Model :" << faceCentres[facei] << endl Pout<< "Model :" << faceCentres[facei] << endl
<< "regionMesh:" << regionMesh.faceCentres()[facei] << endl; << "regionMesh:" << regionMesh.faceCentres()[facei] << endl;
faceStr.write faceStr.writeLine
( (
linePointRef faceCentres[facei],
( regionMesh.faceCentres()[facei]
faceCentres[facei],
regionMesh.faceCentres()[facei]
)
); );
} }
forAll(cellCentres, celli) forAll(cellCentres, celli)
{ {
Pout<< "Model :" << cellCentres[celli] << endl Pout<< "Model :" << cellCentres[celli] << endl
<< "regionMesh:" << regionMesh.cellCentres()[celli] << endl; << "regionMesh:" << regionMesh.cellCentres()[celli] << endl;
cellStr.write cellStr.writeLine
( (
linePointRef cellCentres[celli],
( regionMesh.cellCentres()[celli]
cellCentres[celli],
regionMesh.cellCentres()[celli]
)
); );
} }
} }

View File

@ -1687,7 +1687,7 @@ void Foam::conformalVoronoiMesh::move()
) )
) )
{ {
multipleIntersections.write(linePointRef(ptA, ptB)); multipleIntersections.writeLine(ptA, ptB);
} }
} }
} }

View File

@ -83,7 +83,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward Declarations
class initialPointsMethod; class initialPointsMethod;
class relaxationModel; class relaxationModel;
class faceAreaWeightModel; class faceAreaWeightModel;

View File

@ -1433,18 +1433,15 @@ void Foam::conformalVoronoiMesh::indexDualVertices
// && (mag(snapDir & norm[0]) > 0.5) // && (mag(snapDir & norm[0]) > 0.5)
// ) // )
// { // {
// snapping1.write // snapping1.writeLine
// ( // (
// linePointRef(dual, nearestPointOnTet) // dual,
// nearestPointOnTet
// ); // );
// // snapping2.writeLine
// snapping2.write
// ( // (
// linePointRef // nearestPointOnTet,
// ( // hitInfo.hitPoint()
// nearestPointOnTet,
// hitInfo.hitPoint()
// )
// ); // );
// //
// pts[cit->cellIndex()] = hitInfo.hitPoint(); // pts[cit->cellIndex()] = hitInfo.hitPoint();
@ -1764,9 +1761,10 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
if ((*vcit)->real()) if ((*vcit)->real())
{ {
featurePointDualsStr.write featurePointDualsStr.writeLine
( (
linePointRef(topoint(vit->point()), (*vcit)->dual()) topoint(vit->point()),
(*vcit)->dual()
); );
} }
} }
@ -1867,7 +1865,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
<< " " << vc2->dual() << " " << vc2->dual()
<< endl; << endl;
startCellStr.write(linePointRef(vc1->dual(), vc2->dual())); startCellStr.writeLine(vc1->dual(), vc2->dual());
// Get patch by getting face between cells and the two // Get patch by getting face between cells and the two
// points on the face that are not the feature vertex // points on the face that are not the feature vertex

View File

@ -1395,10 +1395,7 @@ void Foam::conformalVoronoiMesh::writePointPairs
if (ptPairs_.isPointPair(vA, vB)) if (ptPairs_.isPointPair(vA, vB))
{ {
os.write os.writeLine(topoint(vA->point()), topoint(vB->point()));
(
linePointRef(topoint(vA->point()), topoint(vB->point()))
);
} }
} }
} }

View File

@ -76,7 +76,7 @@ void isoFacesToFile
{ {
for (const List<point>& facePts : procFaces) for (const List<point>& facePts : procFaces)
{ {
os.write(face(identity(facePts.size())), facePts); os.writeFace(facePts);
} }
} }
} }
@ -87,7 +87,7 @@ void isoFacesToFile
for (const List<point>& facePts : faces) for (const List<point>& facePts : faces)
{ {
os.write(face(identity(facePts.size())), facePts); os.writeFace(facePts);
} }
} }
} }

View File

@ -81,7 +81,6 @@ Description
#include "triSurfaceSearch.H" #include "triSurfaceSearch.H"
#include "triSurfaceMesh.H" #include "triSurfaceMesh.H"
#include "OFstream.H" #include "OFstream.H"
#include "OBJstream.H"
#include "booleanSurface.H" #include "booleanSurface.H"
#include "edgeIntersections.H" #include "edgeIntersections.H"
#include "meshTools.H" #include "meshTools.H"

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2020-2021 OpenCFD Ltd. Copyright (C) 2020-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -856,12 +856,10 @@ int main(int argc, char *argv[])
if (debug) if (debug)
{ {
OBJstream str(runTime.path()/"isScaledPoint.obj"); OBJstream str(runTime.path()/"isScaledPoint.obj");
forAll(isScaledPoint, pointI)
for (const label pointi : isScaledPoint)
{ {
if (isScaledPoint[pointI]) str.write(initialPoints[meshPoints[pointi]]);
{
str.write(initialPoints[meshPoints[pointI]]);
}
} }
} }

View File

@ -34,7 +34,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(OBJstream, 0); defineTypeName(OBJstream);
} }
@ -161,35 +161,45 @@ Foam::Ostream& Foam::OBJstream::writeQuoted
} }
Foam::Ostream& Foam::OBJstream::write(const point& pt) Foam::Ostream& Foam::OBJstream::write(const point& p)
{ {
write("v ") << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl; write('v') << ' ' << p.x() << ' ' << p.y() << ' ' << p.z() << nl;
return *this; return *this;
} }
Foam::Ostream& Foam::OBJstream::write(const point& pt, const vector& n) Foam::Ostream& Foam::OBJstream::write(const point& p, const vector& n)
{ {
write(pt); write(p);
OFstream::write("vn ") << n.x() << ' ' << n.y() << ' ' << n.z() << nl; OFstream::write("vn ") << n.x() << ' ' << n.y() << ' ' << n.z() << nl;
return *this; return *this;
} }
Foam::Ostream& Foam::OBJstream::write(const UList<point>& points)
{
for (const point& p : points)
{
write('v') << ' ' << p.x() << ' ' << p.y() << ' ' << p.z() << nl;
}
return *this;
}
Foam::Ostream& Foam::OBJstream::write(const edge& e, const UList<point>& points) Foam::Ostream& Foam::OBJstream::write(const edge& e, const UList<point>& points)
{ {
write(points[e[0]]); write(points[e.first()]);
write(points[e[1]]); write(points[e.second()]);
write("l ") << nVertices_-1 << ' ' << nVertices_ << nl; write('l') << ' ' << nVertices_-1 << ' ' << nVertices_ << nl;
return *this; return *this;
} }
Foam::Ostream& Foam::OBJstream::write(const linePointRef& ln) Foam::Ostream& Foam::OBJstream::write(const linePointRef& ln)
{ {
write(ln.start()); write(ln.first());
write(ln.end()); write(ln.second());
write("l ") << nVertices_-1 << ' ' << nVertices_ << nl; write('l') << ' ' << nVertices_-1 << ' ' << nVertices_ << nl;
return *this; return *this;
} }
@ -201,9 +211,22 @@ Foam::Ostream& Foam::OBJstream::write
const vector& n1 const vector& n1
) )
{ {
write(ln.start(), n0); write(ln.first(), n0);
write(ln.end(), n1); write(ln.second(), n1);
write("l ") << nVertices_-1 << ' ' << nVertices_ << nl; write('l') << ' ' << nVertices_-1 << ' ' << nVertices_ << nl;
return *this;
}
Foam::Ostream& Foam::OBJstream::writeLine
(
const point& p0,
const point& p1
)
{
write(p0);
write(p1);
write('l') << ' ' << nVertices_-1 << ' ' << nVertices_ << nl;
return *this; return *this;
} }
@ -221,7 +244,7 @@ Foam::Ostream& Foam::OBJstream::write
if (lines) if (lines)
{ {
write('l'); write('l');
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; ++i)
{ {
write(' ') << i+start; write(' ') << i+start;
} }
@ -230,7 +253,39 @@ Foam::Ostream& Foam::OBJstream::write
else else
{ {
write('f'); write('f');
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; ++i)
{
write(' ') << i+start;
}
write('\n');
}
return *this;
}
Foam::Ostream& Foam::OBJstream::writeFace
(
const UList<point>& points,
const bool lines
)
{
const label start = nVertices_+1; // 1-offset for obj included here
write(points);
if (lines)
{
write('l');
forAll(points, i)
{
write(' ') << i+start;
}
write(' ') << start << '\n';
}
else
{
write('f');
forAll(points, i)
{ {
write(' ') << i+start; write(' ') << i+start;
} }
@ -248,9 +303,10 @@ Foam::Ostream& Foam::OBJstream::write
) )
{ {
const label start = nVertices_+1; // 1-offset for obj included here const label start = nVertices_+1; // 1-offset for obj included here
forAll(f, i)
for (const label fp : f)
{ {
write(points[f[i]]); write(points[fp]);
} }
if (lines) if (lines)
{ {
@ -283,35 +339,27 @@ Foam::Ostream& Foam::OBJstream::write
{ {
primitivePatch pp(SubList<face>(faces), points); primitivePatch pp(SubList<face>(faces), points);
const pointField& localPoints = pp.localPoints();
const faceList& localFaces = pp.localFaces();
const label start = nVertices_+1; // 1-offset for obj included here const label start = nVertices_+1; // 1-offset for obj included here
forAll(localPoints, i) write(pp.localPoints());
{
write(localPoints[i]);
}
if (lines) if (lines)
{ {
const edgeList& edges = pp.edges(); for (const edge& e : pp.edges())
forAll(edges, edgeI)
{ {
const edge& e = edges[edgeI]; write('l') << ' '
<< e.first()+start << ' '
write("l ") << e[0]+start << ' ' << e[1]+start << nl; << e.second()+start << nl;
} }
} }
else else
{ {
forAll(localFaces, facei) for (const face& f : pp.localFaces())
{ {
const face& f = localFaces[facei];
write('f'); write('f');
forAll(f, i) for (const label fp : f)
{ {
write(' ') << f[i]+start; write(' ') << fp+start;
} }
write('\n'); write('\n');
} }
@ -335,46 +383,39 @@ Foam::Ostream& Foam::OBJstream::write
label objPointId = nVertices_+1; // 1-offset for obj included here label objPointId = nVertices_+1; // 1-offset for obj included here
Map<label> markedPoints(2*edges.size()); Map<label> markedPoints(2*edges.size());
forAll(edges, edgei)
{
const edge& e = edges[edgei];
if (markedPoints.insert(e[0], objPointId)) for (const edge& e : edges)
{
if (markedPoints.insert(e.first(), objPointId))
{ {
write(points[e[0]]); write(points[e.first()]);
++objPointId; ++objPointId;
} }
if (markedPoints.insert(e[1], objPointId)) if (markedPoints.insert(e.second(), objPointId))
{ {
write(points[e[1]]); write(points[e.second()]);
++objPointId; ++objPointId;
} }
} }
forAll(edges, edgei) for (const edge& e : edges)
{ {
const edge& e = edges[edgei]; write('l') << ' '
<< markedPoints[e.first()] << ' '
write("l ") << markedPoints[e.second()] << nl;
<< markedPoints[e[0]] << ' '
<< markedPoints[e[1]] << nl;
} }
} }
else else
{ {
const label start = nVertices_+1; // 1-offset for obj included here const label start = nVertices_+1; // 1-offset for obj included here
forAll(points, i) write(points);
{
write(points[i]);
}
forAll(edges, edgei) for (const edge& e : edges)
{ {
const edge& e = edges[edgei]; write('l') << ' '
<< e.first()+start << ' '
write("l ") << e.second()+start << nl;
<< e[0]+start << ' ' << e[1]+start << nl;
} }
} }
@ -390,31 +431,25 @@ Foam::Ostream& Foam::OBJstream::write
{ {
const label start = nVertices_+1; // 1-offset for obj included here const label start = nVertices_+1; // 1-offset for obj included here
pointField points(bb.points()); write(bb.points());
forAll(points, i)
{
write(points[i]);
}
if (lines) if (lines)
{ {
forAll(treeBoundBox::edges, edgei) for (const edge& e : treeBoundBox::edges)
{ {
const edge& e = treeBoundBox::edges[edgei]; write('l') << ' '
<< e.first()+start << ' '
write("l ") << e[0]+start << ' ' << e[1]+start << nl; << e.second()+start << nl;
} }
} }
else else
{ {
forAll(treeBoundBox::faces, facei) for (const face& f : treeBoundBox::faces)
{ {
const face& f = treeBoundBox::faces[facei];
write('f'); write('f');
forAll(f, i) for (const label fp : f)
{ {
write(' ') << f[i]+start; write(' ') << fp+start;
} }
write('\n'); write('\n');
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,7 +28,8 @@ Class
Foam::OBJstream Foam::OBJstream
Description Description
OFstream that keeps track of vertices An OFstream that keeps track of vertices and provides convenience
output methods for OBJ files.
SourceFiles SourceFiles
OBJstream.C OBJstream.C
@ -73,8 +74,8 @@ class OBJstream
public: public:
//- Declare type-name (with debug switch) //- Declare type-name (no debug switch)
ClassName("OBJstream"); ClassNameNoDebug("OBJstream");
// Constructors // Constructors
@ -105,13 +106,11 @@ public:
// Member Functions // Member Functions
// Access //- Return the number of vertices written
label nVertices() const noexcept
//- Return the number of vertices written {
label nVertices() const return nVertices_;
{ }
return nVertices_;
}
// Ostream implementation // Ostream implementation
@ -143,12 +142,15 @@ public:
// Direct write functionality // Direct write functionality
//- Write point //- Write point
Ostream& write(const point& pt); Ostream& write(const point& p);
//- Write point and vector normal ('vn') //- Write point and vector normal ('vn')
Ostream& write(const point& pt, const vector& n); Ostream& write(const point& p, const vector& n);
//- Write edge as points and line //- Write multiple points
Ostream& write(const UList<point>& points);
//- Write edge as points with line
Ostream& write(const edge& e, const UList<point>& points); Ostream& write(const edge& e, const UList<point>& points);
//- Write line //- Write line
@ -162,10 +164,20 @@ public:
const vector& n1 const vector& n1
); );
//- Write triangle as points and lines/filled-polygon //- Write line joining two points
Ostream& writeLine(const point& p0, const point& p1);
//- Write triangle as points with lines/filled-polygon
Ostream& write(const triPointRef& f, const bool lines = true); Ostream& write(const triPointRef& f, const bool lines = true);
//- Write face as points and lines/filled-polygon //- Write face loop points with lines/filled-polygon
Ostream& writeFace
(
const UList<point>& points,
const bool lines = true
);
//- Write face as points with lines/filled-polygon
Ostream& write Ostream& write
( (
const face& f, const face& f,
@ -173,7 +185,7 @@ public:
const bool lines = true const bool lines = true
); );
//- Write patch faces as points and lines/filled-polygon //- Write patch faces as points with lines/filled-polygon
Ostream& write Ostream& write
( (
const UList<face>& faces, const UList<face>& faces,
@ -181,7 +193,7 @@ public:
const bool lines = true const bool lines = true
); );
//- Write edges as points and lines. //- Write edges as points with lines.
// Optionally eliminate unused points. // Optionally eliminate unused points.
Ostream& write Ostream& write
( (
@ -190,12 +202,8 @@ public:
const bool compact = false const bool compact = false
); );
//- Write tree-bounding box as lines/filled-polygons //- Write tree-bounding box with lines/filled-polygons
Ostream& write Ostream& write(const treeBoundBox& bb, const bool lines = true);
(
const treeBoundBox& bb,
const bool lines = true
);
}; };

View File

@ -801,7 +801,7 @@ void Foam::averageNeighbourFvGeometryScheme::movePoints()
forAll(cellCentres, celli) forAll(cellCentres, celli)
{ {
const point& cc = cellCentres[celli]; const point& cc = cellCentres[celli];
osPtr().write(linePointRef(cc-correction[celli], cc)); osPtr().writeLine(cc-correction[celli], cc);
} }
const scalarField magCorrection(mag(correction)); const scalarField magCorrection(mag(correction));
@ -871,7 +871,7 @@ void Foam::averageNeighbourFvGeometryScheme::movePoints()
{ {
const point& oldCc = mesh_.cellCentres()[celli]; const point& oldCc = mesh_.cellCentres()[celli];
const point& newCc = cellCentres[celli]; const point& newCc = cellCentres[celli];
str.write(linePointRef(oldCc, newCc)); str.writeLine(oldCc, newCc);
} }
} }
if (debug) if (debug)
@ -885,7 +885,7 @@ void Foam::averageNeighbourFvGeometryScheme::movePoints()
{ {
const point& oldFc = mesh_.faceCentres()[facei]; const point& oldFc = mesh_.faceCentres()[facei];
const point& newFc = faceCentres[facei]; const point& newFc = faceCentres[facei];
str.write(linePointRef(oldFc, newFc)); str.writeLine(oldFc, newFc);
} }
} }

View File

@ -168,7 +168,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
for (const findCellParticle& tp : cloud) for (const findCellParticle& tp : cloud)
{ {
str.write(linePointRef(tp.position(), tp.end())); str.writeLine(tp.position(), tp.end());
} }
} }
@ -232,7 +232,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
const labelList& cData = cellToWalls_[celli]; const labelList& cData = cellToWalls_[celli];
forAll(cData, i) forAll(cData, i)
{ {
str.write(linePointRef(ends[i], start[cData[i]])); str.writeLine(ends[i], start[cData[i]]);
} }
} }
} }

View File

@ -196,7 +196,7 @@ Foam::blockEdges::projectCurveEdge::position(const scalarList& lambdas) const
{ {
forAll(points, i) forAll(points, i)
{ {
debugStr().write(linePointRef(start[i], points[i])); debugStr().writeLine(start[i], points[i]);
} }
} }
} }
@ -257,7 +257,7 @@ Foam::blockEdges::projectCurveEdge::position(const scalarList& lambdas) const
forAll(points, i) forAll(points, i)
{ {
const point predicted(points[i] + residual[i]); const point predicted(points[i] + residual[i]);
debugStr().write(linePointRef(points[i], predicted)); debugStr().writeLine(points[i], predicted);
} }
} }

View File

@ -198,7 +198,7 @@ Foam::blockEdges::projectEdge::position(const scalarList& lambdas) const
{ {
forAll(points, i) forAll(points, i)
{ {
debugStr().write(linePointRef(start[i], points[i])); debugStr().writeLine(start[i], points[i]);
} }
} }
} }
@ -259,7 +259,7 @@ Foam::blockEdges::projectEdge::position(const scalarList& lambdas) const
forAll(points, i) forAll(points, i)
{ {
const point predicted(points[i] + residual[i]); const point predicted(points[i] + residual[i]);
debugStr().write(linePointRef(points[i], predicted)); debugStr().writeLine(points[i], predicted);
} }
} }

View File

@ -233,7 +233,7 @@ void Foam::blockFaces::projectFace::project
const point& hitPt = hits[i].hitPoint(); const point& hitPt = hits[i].hitPoint();
if (debugStr) if (debugStr)
{ {
debugStr().write(linePointRef(points[i], hitPt)); debugStr().writeLine(points[i], hitPt);
} }
points[i] = hitPt; points[i] = hitPt;
} }
@ -304,7 +304,7 @@ void Foam::blockFaces::projectFace::project
forAll(points, i) forAll(points, i)
{ {
const point predicted(points[i] + residual[i]); const point predicted(points[i] + residual[i]);
debugStr().write(linePointRef(points[i], predicted)); debugStr().writeLine(points[i], predicted);
} }
} }
@ -356,7 +356,7 @@ void Foam::blockFaces::projectFace::project
forAll(points, i) forAll(points, i)
{ {
const point predicted(points[i] + residual[i]); const point predicted(points[i] + residual[i]);
debugStr().write(linePointRef(points[i], predicted)); debugStr().writeLine(points[i], predicted);
} }
} }

View File

@ -1558,19 +1558,12 @@ void Foam::medialAxisMeshMover::calculateDisplacement
if (str) if (str)
{ {
const point& pt = mesh().points()[pointI]; const point& pt = mesh().points()[pointI];
str().write(linePointRef(pt, pt+patchDisp[patchPointI])); str().writeLine(pt, pt+patchDisp[patchPointI]);
} }
if (medialVecStr) if (medialVecStr)
{ {
const point& pt = mesh().points()[pointI]; const point& pt = mesh().points()[pointI];
medialVecStr().write medialVecStr().writeLine(pt, medialVec_[pointI]);
(
linePointRef
(
pt,
medialVec_[pointI]
)
);
} }
} }
} }

View File

@ -261,12 +261,9 @@ void Foam::meshRefinement::getIntersections
{ {
if (str) if (str)
{ {
str().write(linePointRef(start[i], hit1[i].rawPoint())); str().writeLine(start[i], hit1[i].rawPoint());
str().write str().writeLine(hit1[i].rawPoint(), hit2[i].rawPoint());
( str().writeLine(hit2[i].rawPoint(), end[i]);
linePointRef(hit1[i].rawPoint(), hit2[i].rawPoint())
);
str().write(linePointRef(hit2[i].rawPoint(), end[i]));
} }
// Pick up the patches // Pick up the patches

View File

@ -828,8 +828,8 @@ Foam::label Foam::meshRefinement::markProximityRefinementWave
// max(smallGapDistance[celli], maxDist); // max(smallGapDistance[celli], maxDist);
// //
// //
// str.write(linePointRef(cc, origin[i])); // str.writeLine(cc, origin[i]);
// str.write(linePointRef(cc, origin[j])); // str.writeLine(cc, origin[j]);
// //
// nMulti++; // nMulti++;
//} //}

View File

@ -40,7 +40,6 @@ License
#include "mapDistributePolyMesh.H" #include "mapDistributePolyMesh.H"
#include "Cloud.H" #include "Cloud.H"
//#include "globalIndex.H" //#include "globalIndex.H"
#include "OBJstream.H"
#include "cellSet.H" #include "cellSet.H"
#include "treeDataCell.H" #include "treeDataCell.H"
@ -1797,22 +1796,8 @@ Foam::label Foam::meshRefinement::markProximityRefinement
end.clear(); end.clear();
minLevel.clear(); minLevel.clear();
//// Extract per cell information on the surface with the highest max //// Extract per cell information on the surface with the highest max
//OBJstream str
//(
// mesh_.time().path()
// / "findAllIntersections_"
// + mesh_.time().timeName()
// + ".obj"
//);
//// All intersections
//OBJstream str2
//(
// mesh_.time().path()
// / "findAllIntersections2_"
// + mesh_.time().timeName()
// + ".obj"
//);
forAll(testFaces, i) forAll(testFaces, i)
{ {

View File

@ -89,7 +89,7 @@ void Foam::snappyLayerDriver::dumpDisplacement
forAll(patchDisp, patchPointi) forAll(patchDisp, patchPointi)
{ {
const point& pt = pp.localPoints()[patchPointi]; const point& pt = pp.localPoints()[patchPointi];
dispStr.write(linePointRef(pt, pt + patchDisp[patchPointi])); dispStr.writeLine(pt, pt + patchDisp[patchPointi]);
} }
@ -101,7 +101,7 @@ void Foam::snappyLayerDriver::dumpDisplacement
if (extrudeStatus[patchPointi] != EXTRUDE) if (extrudeStatus[patchPointi] != EXTRUDE)
{ {
const point& pt = pp.localPoints()[patchPointi]; const point& pt = pp.localPoints()[patchPointi];
illStr.write(linePointRef(pt, pt + patchDisp[patchPointi])); illStr.writeLine(pt, pt + patchDisp[patchPointi]);
} }
} }
} }
@ -797,9 +797,7 @@ void Foam::snappyLayerDriver::handleFeatureAngle
if (str) if (str)
{ {
const point& p0 = pp.localPoints()[e[0]]; str().write(e, pp.localPoints());
const point& p1 = pp.localPoints()[e[1]];
str().write(linePointRef(p0, p1));
} }
} }
} }
@ -3572,7 +3570,7 @@ void Foam::snappyLayerDriver::dupFaceZonePoints
if (newMasteri != pointi) if (newMasteri != pointi)
{ {
str.write(linePointRef(p[pointi], p[newMasteri])); str.writeLine(p[pointi], p[newMasteri]);
} }
} }
} }
@ -3626,7 +3624,7 @@ void Foam::snappyLayerDriver::mergeFaceZonePoints
{ {
const point& pt = mesh.points()[pointi]; const point& pt = mesh.points()[pointi];
const point& otherPt = mesh.points()[otherPointi]; const point& otherPt = mesh.points()[otherPointi];
str.write(linePointRef(pt, otherPt)); str.writeLine(pt, otherPt);
} }
} }
} }

View File

@ -1300,11 +1300,11 @@ void Foam::snappySnapDriver::detectNearSurfaces
// { // {
// if (hit1[i].hit()) // if (hit1[i].hit())
// { // {
// str.write(linePointRef(start[i], hit1[i].hitPoint())); // str.writeLine(start[i], hit1[i].hitPoint());
// } // }
// if (hit2[i].hit()) // if (hit2[i].hit())
// { // {
// str.write(linePointRef(start[i], hit2[i].hitPoint())); // str.writeLine(start[i], hit2[i].hitPoint());
// } // }
// } // }
// } // }
@ -1403,7 +1403,7 @@ void Foam::snappySnapDriver::detectNearSurfaces
// //
// if (isCoplanar) // if (isCoplanar)
// { // {
// str.write(linePointRef(surfPointA, surfPointB)); // str.writeLine(surfPointA, surfPointB);
// } // }
// } // }
// } // }
@ -1550,7 +1550,7 @@ void Foam::snappySnapDriver::detectNearSurfaces
if (gapStr) if (gapStr)
{ {
const point& intPt = hit2[pointi].hitPoint(); const point& intPt = hit2[pointi].hitPoint();
gapStr().write(linePointRef(pt, intPt)); gapStr().writeLine(pt, intPt);
} }
// Choose hit2 : nearest to end point (so inside the domain) // Choose hit2 : nearest to end point (so inside the domain)
@ -1692,7 +1692,7 @@ void Foam::snappySnapDriver::detectNearSurfaces
if (gapStr) if (gapStr)
{ {
const point& intPt = hit2[i].hitPoint(); const point& intPt = hit2[i].hitPoint();
gapStr().write(linePointRef(pt, intPt)); gapStr().writeLine(pt, intPt);
} }
disp[pointi] = hit2[i].hitPoint()-pt; disp[pointi] = hit2[i].hitPoint()-pt;

View File

@ -1255,11 +1255,11 @@ void Foam::snappySnapDriver::featureAttractionUsingReconstruction
if (feStr && patchConstraints[pointi].first() == 2) if (feStr && patchConstraints[pointi].first() == 2)
{ {
feStr().write(linePointRef(pt, pt+patchAttraction[pointi])); feStr().writeLine(pt, pt+patchAttraction[pointi]);
} }
else if (fpStr && patchConstraints[pointi].first() == 3) else if (fpStr && patchConstraints[pointi].first() == 3)
{ {
fpStr().write(linePointRef(pt, pt+patchAttraction[pointi])); fpStr().writeLine(pt, pt+patchAttraction[pointi]);
} }
} }
} }
@ -2516,9 +2516,10 @@ void Foam::snappySnapDriver::determineFeatures
// Dump // Dump
if (featureEdgeStr) if (featureEdgeStr)
{ {
featureEdgeStr().write featureEdgeStr().writeLine
( (
linePointRef(pt, info.hitPoint()) pt,
info.hitPoint()
); );
} }
} }
@ -2526,9 +2527,10 @@ void Foam::snappySnapDriver::determineFeatures
{ {
if (missedEdgeStr) if (missedEdgeStr)
{ {
missedEdgeStr().write missedEdgeStr().writeLine
( (
linePointRef(pt, multiPatchPt.hitPoint()) pt,
multiPatchPt.hitPoint()
); );
} }
} }
@ -2582,10 +2584,7 @@ void Foam::snappySnapDriver::determineFeatures
// Debug: dump missed feature point // Debug: dump missed feature point
if (missedMP0Str && !nearInfo.second().hit()) if (missedMP0Str && !nearInfo.second().hit())
{ {
missedMP0Str().write missedMP0Str().writeLine(pt, estimatedPt);
(
linePointRef(pt, estimatedPt)
);
} }
} }
else else
@ -2647,10 +2646,7 @@ void Foam::snappySnapDriver::determineFeatures
// Debug: dump missed feature point // Debug: dump missed feature point
if (missedMP1Str && !nearInfo.second().hit()) if (missedMP1Str && !nearInfo.second().hit())
{ {
missedMP1Str().write missedMP1Str().writeLine(pt, estimatedPt);
(
linePointRef(pt, estimatedPt)
);
} }
} }
} }
@ -2689,10 +2685,7 @@ void Foam::snappySnapDriver::determineFeatures
&& patchConstraints[pointi].first() == 3 && patchConstraints[pointi].first() == 3
) )
{ {
featurePointStr().write featurePointStr().writeLine(pt, info.hitPoint());
(
linePointRef(pt, info.hitPoint())
);
} }
else if else if
( (
@ -2700,20 +2693,14 @@ void Foam::snappySnapDriver::determineFeatures
&& patchConstraints[pointi].first() == 2 && patchConstraints[pointi].first() == 2
) )
{ {
featureEdgeStr().write featureEdgeStr().writeLine(pt, info.hitPoint());
(
linePointRef(pt, info.hitPoint())
);
} }
} }
else else
{ {
if (missedEdgeStr) if (missedEdgeStr)
{ {
missedEdgeStr().write missedEdgeStr().writeLine(pt, estimatedPt);
(
linePointRef(pt, estimatedPt)
);
} }
} }
} }
@ -2806,10 +2793,7 @@ void Foam::snappySnapDriver::determineFeatures
const pointIndexHit& info = nearInfo.second(); const pointIndexHit& info = nearInfo.second();
if (featurePointStr && info.hit()) if (featurePointStr && info.hit())
{ {
featurePointStr().write featurePointStr().writeLine(pt, info.hitPoint());
(
linePointRef(pt, info.hitPoint())
);
} }
} }
} }
@ -2931,9 +2915,7 @@ void Foam::snappySnapDriver::determineBaffleFeatures
if (baffleEdgeStr) if (baffleEdgeStr)
{ {
const point& p0 = pp.localPoints()[e[0]]; baffleEdgeStr().write(e, pp.localPoints());
const point& p1 = pp.localPoints()[e[1]];
baffleEdgeStr().write(linePointRef(p0, p1));
} }
} }
} }
@ -3640,11 +3622,11 @@ void Foam::snappySnapDriver::featureAttractionUsingFeatureEdges
if (patchConstraints[pointi].first() == 2) if (patchConstraints[pointi].first() == 2)
{ {
featureEdgeStr.write(linePointRef(pt, pt+attr)); featureEdgeStr.writeLine(pt, pt+attr);
} }
else if (patchConstraints[pointi].first() == 3) else if (patchConstraints[pointi].first() == 3)
{ {
featurePointStr.write(linePointRef(pt, pt+attr)); featurePointStr.writeLine(pt, pt+attr);
} }
} }
} }
@ -3827,10 +3809,7 @@ void Foam::snappySnapDriver::preventFaceSqueeze
if (strPtr) if (strPtr)
{ {
strPtr().write strPtr().writeLine(pt, pt+patchAttraction[pointi]);
(
linePointRef(pt, pt+patchAttraction[pointi])
);
} }
} }
} }

View File

@ -63,9 +63,8 @@ namespace Foam
// Write out triangulated surfaces as OBJ files // Write out triangulated surfaces as OBJ files
OBJstream srcTriObj("srcTris_" + Foam::name(nAMI) + ".obj"); OBJstream srcTriObj("srcTris_" + Foam::name(nAMI) + ".obj");
const pointField& srcPts = src.points(); const pointField& srcPts = src.points();
forAll(srcTris_, facei) for (const DynamicList<face>& faces : srcTris_)
{ {
const DynamicList<face>& faces = srcTris_[facei];
for (const face& f : faces) for (const face& f : faces)
{ {
srcTriObj.write srcTriObj.write
@ -77,9 +76,8 @@ namespace Foam
OBJstream tgtTriObj("tgtTris_" + Foam::name(nAMI) + ".obj"); OBJstream tgtTriObj("tgtTris_" + Foam::name(nAMI) + ".obj");
const pointField& tgtPts = tgt.points(); const pointField& tgtPts = tgt.points();
forAll(tgtTris_, facei) for (const DynamicList<face>& faces : tgtTris_)
{ {
const DynamicList<face>& faces = tgtTris_[facei];
for (const face& f : faces) for (const face& f : faces)
{ {
tgtTriObj.write tgtTriObj.write

View File

@ -27,7 +27,6 @@ License
#include "faceAreaWeightAMI2D.H" #include "faceAreaWeightAMI2D.H"
#include "profiling.H" #include "profiling.H"
#include "OBJstream.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "triangle2D.H" #include "triangle2D.H"

View File

@ -44,6 +44,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class OBJstream; class OBJstream;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\

View File

@ -1900,7 +1900,7 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
Info<< "Writing " << concaveStart_ Info<< "Writing " << concaveStart_
<< " convex feature points to " << convexFtPtStr.name() << endl; << " convex feature points to " << convexFtPtStr.name() << endl;
for(label i = 0; i < concaveStart_; i++) for (label i = 0; i < concaveStart_; i++)
{ {
convexFtPtStr.write(points()[i]); convexFtPtStr.write(points()[i]);
} }
@ -1912,7 +1912,7 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
<< " concave feature points to " << " concave feature points to "
<< concaveFtPtStr.name() << endl; << concaveFtPtStr.name() << endl;
for(label i = concaveStart_; i < mixedStart_; i++) for (label i = concaveStart_; i < mixedStart_; i++)
{ {
concaveFtPtStr.write(points()[i]); concaveFtPtStr.write(points()[i]);
} }
@ -1923,7 +1923,7 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
Info<< "Writing " << nonFeatureStart_-mixedStart_ Info<< "Writing " << nonFeatureStart_-mixedStart_
<< " mixed feature points to " << mixedFtPtStr.name() << endl; << " mixed feature points to " << mixedFtPtStr.name() << endl;
for(label i = mixedStart_; i < nonFeatureStart_; i++) for (label i = mixedStart_; i < nonFeatureStart_; i++)
{ {
mixedFtPtStr.write(points()[i]); mixedFtPtStr.write(points()[i]);
} }
@ -1936,18 +1936,14 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
<< " mixed feature point structure to " << " mixed feature point structure to "
<< mixedFtPtStructureStr.name() << endl; << mixedFtPtStructureStr.name() << endl;
for(label i = mixedStart_; i < nonFeatureStart_; i++) for (label i = mixedStart_; i < nonFeatureStart_; i++)
{ {
const labelList& ptEds = pointEdges()[i]; const labelList& ptEds = pointEdges()[i];
forAll(ptEds, j) for (const label edgei : ptEds)
{ {
const edge& e = edges()[ptEds[j]]; const edge& e = edges()[edgei];
mixedFtPtStructureStr.write mixedFtPtStructureStr.write(e, points());
(
linePointRef(points()[e[0]],
points()[e[1]])
);
} }
} }
} }
@ -1960,7 +1956,7 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
for (label i = externalStart_; i < internalStart_; i++) for (label i = externalStart_; i < internalStart_; i++)
{ {
const edge& e = edges()[i]; const edge& e = edges()[i];
externalStr.write(linePointRef(points()[e[0]], points()[e[1]])); externalStr.write(e, points());
} }
} }
@ -1972,7 +1968,7 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
for (label i = internalStart_; i < flatStart_; i++) for (label i = internalStart_; i < flatStart_; i++)
{ {
const edge& e = edges()[i]; const edge& e = edges()[i];
internalStr.write(linePointRef(points()[e[0]], points()[e[1]])); internalStr.write(e, points());
} }
} }
@ -1984,7 +1980,7 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
for (label i = flatStart_; i < openStart_; i++) for (label i = flatStart_; i < openStart_; i++)
{ {
const edge& e = edges()[i]; const edge& e = edges()[i];
flatStr.write(linePointRef(points()[e[0]], points()[e[1]])); flatStr.write(e, points());
} }
} }
@ -1996,7 +1992,7 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
for (label i = openStart_; i < multipleStart_; i++) for (label i = openStart_; i < multipleStart_; i++)
{ {
const edge& e = edges()[i]; const edge& e = edges()[i];
openStr.write(linePointRef(points()[e[0]], points()[e[1]])); openStr.write(e, points());
} }
} }
@ -2008,7 +2004,7 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
for (label i = multipleStart_; i < edges().size(); i++) for (label i = multipleStart_; i < edges().size(); i++)
{ {
const edge& e = edges()[i]; const edge& e = edges()[i];
multipleStr.write(linePointRef(points()[e[0]], points()[e[1]])); multipleStr.write(e, points());
} }
} }
@ -2017,10 +2013,10 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
Info<< "Writing " << regionEdges_.size() Info<< "Writing " << regionEdges_.size()
<< " region edges to " << regionStr.name() << endl; << " region edges to " << regionStr.name() << endl;
forAll(regionEdges_, i) for (const label edgei : regionEdges_)
{ {
const edge& e = edges()[regionEdges_[i]]; const edge& e = edges()[edgei];
regionStr.write(linePointRef(points()[e[0]], points()[e[1]])); regionStr.write(e, points());
} }
} }
@ -2034,9 +2030,10 @@ void Foam::extendedEdgeMesh::writeObj(const fileName& prefix) const
const vector& eVec = edgeDirections_[i]; const vector& eVec = edgeDirections_[i];
const edge& e = edges()[i]; const edge& e = edges()[i];
edgeDirsStr.write edgeDirsStr.writeLine
( (
linePointRef(points()[e.start()], eVec + points()[e.start()]) points()[e.start()],
points()[e.start()] + eVec
); );
} }
} }

View File

@ -35,36 +35,36 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(edgeSurface, 0);
// file-scope defineTypeNameAndDebug(edgeSurface, 0);
// Write points in obj format
static void writeObjPoints(const UList<point>& pts, Ostream& os) } // End namespace Foam
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
namespace Foam
{ {
forAll(pts, i)
{
const point& pt = pts[i];
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
}
}
// Write whole pointField and selected edges to stream // Write whole pointField and selected edges to stream
void writeObjEdges static void writeObjEdges
( (
const UList<point>& points, const UList<point>& points,
const edgeList& edges, const edgeList& edges,
const labelList& edgeLabels, const labelUList& edgeLabels,
Ostream& os Ostream& os
) )
{ {
writeObjPoints(points, os); for (const point& p : points)
forAll(edgeLabels, i)
{ {
const edge& e = edges[edgeLabels[i]]; os << "v " << p.x() << ' ' << p.y() << ' ' << p.z() << nl;
}
os << "l " << e.start()+1 << ' ' << e.end()+1 << endl; for (const label edgei : edgeLabels)
{
const edge& e = edges[edgei];
os << "l " << e.start()+1 << ' ' << e.end()+1 << nl;
} }
} }

View File

@ -195,8 +195,8 @@ void Foam::pointToPointPlanarInterpolation::calcWeights
forAll(destPoints, i) forAll(destPoints, i)
{ {
label v0 = nearestVertex_[i][0]; const label v0 = nearestVertex_[i][0];
str.write(linePointRef(destPoints[i], sourcePoints[v0])); str.writeLine(destPoints[i], sourcePoints[v0]);
} }
} }
} }
@ -245,10 +245,7 @@ void Foam::pointToPointPlanarInterpolation::calcWeights
Pout<< "pointToPointPlanarInterpolation::calcWeights :" Pout<< "pointToPointPlanarInterpolation::calcWeights :"
<< " Dumping face centres to " << str.name() << endl; << " Dumping face centres to " << str.name() << endl;
forAll(localFaceCentres, i) str.write(localFaceCentres);
{
str.write(localFaceCentres[i]);
}
} }
// Determine interpolation onto face centres. // Determine interpolation onto face centres.
@ -275,9 +272,9 @@ void Foam::pointToPointPlanarInterpolation::calcWeights
forAll(destPoints, i) forAll(destPoints, i)
{ {
label v0 = nearestVertex_[i][0]; const label v0 = nearestVertex_[i][0];
label v1 = nearestVertex_[i][1]; const label v1 = nearestVertex_[i][1];
label v2 = nearestVertex_[i][2]; const label v2 = nearestVertex_[i][2];
Pout<< "For location " << destPoints[i] Pout<< "For location " << destPoints[i]
<< " 2d:" << localFaceCentres[i] << " 2d:" << localFaceCentres[i]
@ -286,21 +283,21 @@ void Foam::pointToPointPlanarInterpolation::calcWeights
<< " at:" << sourcePoints[v0] << " at:" << sourcePoints[v0]
<< " weight:" << nearestVertexWeight_[i][0] << nl; << " weight:" << nearestVertexWeight_[i][0] << nl;
str.write(linePointRef(destPoints[i], sourcePoints[v0])); str.writeLine(destPoints[i], sourcePoints[v0]);
if (v1 != -1) if (v1 != -1)
{ {
Pout<< " " << v1 Pout<< " " << v1
<< " at:" << sourcePoints[v1] << " at:" << sourcePoints[v1]
<< " weight:" << nearestVertexWeight_[i][1] << nl; << " weight:" << nearestVertexWeight_[i][1] << nl;
str.write(linePointRef(destPoints[i], sourcePoints[v1])); str.writeLine(destPoints[i], sourcePoints[v1]);
} }
if (v2 != -1) if (v2 != -1)
{ {
Pout<< " " << v2 Pout<< " " << v2
<< " at:" << sourcePoints[v2] << " at:" << sourcePoints[v2]
<< " weight:" << nearestVertexWeight_[i][2] << nl; << " weight:" << nearestVertexWeight_[i][2] << nl;
str.write(linePointRef(destPoints[i], sourcePoints[v2])); str.writeLine(destPoints[i], sourcePoints[v2]);
} }
Pout<< endl; Pout<< endl;

View File

@ -1251,7 +1251,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
const point& donorCc = cc[slots[i]]; const point& donorCc = cc[slots[i]];
const point& accCc = mesh_.cellCentres()[cellI]; const point& accCc = mesh_.cellCentres()[cellI];
str.write(linePointRef(accCc, 0.1*accCc+0.9*donorCc)); str.writeLine(accCc, 0.1*accCc+0.9*donorCc);
} }
} }
} }

View File

@ -2168,7 +2168,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
forAll(slots, i) forAll(slots, i)
{ {
const point& donorCc = cc[slots[i]]; const point& donorCc = cc[slots[i]];
str.write(linePointRef(accCc, 0.1*accCc+0.9*donorCc)); str.writeLine(accCc, 0.1*accCc+0.9*donorCc);
} }
} }
} }
@ -2264,7 +2264,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
forAll(slots, i) forAll(slots, i)
{ {
const point& donorCc = cc[slots[i]]; const point& donorCc = cc[slots[i]];
str.write(linePointRef(accCc, 0.1*accCc+0.9*donorCc)); str.writeLine(accCc, 0.1*accCc+0.9*donorCc);
} }
} }
} }

View File

@ -1000,7 +1000,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
forAll(slots, i) forAll(slots, i)
{ {
const point& donorCc = cc[slots[i]]; const point& donorCc = cc[slots[i]];
str.write(linePointRef(accCc, 0.1*accCc+0.9*donorCc)); str.writeLine(accCc, 0.1*accCc+0.9*donorCc);
} }
} }
} }
@ -1065,7 +1065,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
forAll(slots, i) forAll(slots, i)
{ {
const point& donorCc = cc[slots[i]]; const point& donorCc = cc[slots[i]];
str.write(linePointRef(accCc, 0.1*accCc+0.9*donorCc)); str.writeLine(accCc, 0.1*accCc+0.9*donorCc);
} }
} }
} }

View File

@ -171,7 +171,7 @@ void Foam::voxelMeshSearch::writeGrid
{ {
point p1(bb.min()+point((i-1)*s[0], j*s[1], k*s[2])); point p1(bb.min()+point((i-1)*s[0], j*s[1], k*s[2]));
point p2(bb.min()+point(i*s[0], j*s[1], k*s[2])); point p2(bb.min()+point(i*s[0], j*s[1], k*s[2]));
os.write(linePointRef(p1, p2)); os.writeLine(p1, p2);
} }
} }
} }
@ -183,7 +183,7 @@ void Foam::voxelMeshSearch::writeGrid
{ {
point p1(bb.min()+point(i*s[0], (j-1)*s[1], k*s[2])); point p1(bb.min()+point(i*s[0], (j-1)*s[1], k*s[2]));
point p2(bb.min()+point(i*s[0], j*s[1], k*s[2])); point p2(bb.min()+point(i*s[0], j*s[1], k*s[2]));
os.write(linePointRef(p1, p2)); os.writeLine(p1, p2);
} }
} }
} }
@ -195,7 +195,7 @@ void Foam::voxelMeshSearch::writeGrid
{ {
point p1(bb.min()+point(i*s[0], j*s[1], (k-1)*s[2])); point p1(bb.min()+point(i*s[0], j*s[1], (k-1)*s[2]));
point p2(bb.min()+point(i*s[0], j*s[1], k*s[2])); point p2(bb.min()+point(i*s[0], j*s[1], k*s[2]));
os.write(linePointRef(p1, p2)); os.writeLine(p1, p2);
} }
} }
} }

View File

@ -45,11 +45,11 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators // Forward Declarations
class polyMesh; class polyMesh;
class fvMesh;
class OBJstream; class OBJstream;
class IOobject; class IOobject;
class fvMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class voxelMeshSearch Declaration Class voxelMeshSearch Declaration
@ -57,7 +57,7 @@ class fvMesh;
class voxelMeshSearch class voxelMeshSearch
{ {
// Private data // Private Data
const polyMesh& mesh_; const polyMesh& mesh_;

View File

@ -4979,13 +4979,10 @@ void Foam::distributedTriSurfaceMesh::distribute
/searchableSurface::name() + "_after.obj" /searchableSurface::name() + "_after.obj"
); );
Info<< "Writing local bounding box to " << str.name() << endl; Info<< "Writing local bounding box to " << str.name() << endl;
const List<treeBoundBox>& myBbs = procBb_[Pstream::myProcNo()];
for (const treeBoundBox& bb : myBbs)
{ {
pointField pts(bb.points()); for (const treeBoundBox& bb : procBb_[Pstream::myProcNo()])
for (const edge& e : treeBoundBox::edges)
{ {
str.write(linePointRef(pts[e[0]], pts[e[1]])); str.write(bb, true); // lines
} }
} }
} }
@ -5001,11 +4998,7 @@ void Foam::distributedTriSurfaceMesh::distribute
{ {
for (const treeBoundBox& bb : myBbs) for (const treeBoundBox& bb : myBbs)
{ {
pointField pts(bb.points()); str.write(bb, true); // lines
for (const edge& e : treeBoundBox::edges)
{
str.write(linePointRef(pts[e[0]], pts[e[1]]));
}
} }
} }
} }

View File

@ -189,12 +189,12 @@ bool Foam::patchDistMethods::exact::correct
if (debug) if (debug)
{ {
OBJstream str(mesh_.time().timePath()/"wallPoint.obj"); OBJstream str(mesh_.time().timePath()/"wallPoint.obj");
Info<< type() << ": dumping nearest wall point to " << str.name() Info<< type() << ": dumping nearest wall point to "
<< endl; << str.name() << endl;
forAll(mesh_.cellCentres(), cellI) forAll(mesh_.cellCentres(), celli)
{ {
const point& cc = mesh_.cellCentres()[cellI]; const point& cc = mesh_.cellCentres()[celli];
str.write(linePointRef(cc, info[cellI].hitPoint())); str.writeLine(cc, info[celli].hitPoint());
} }
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -1064,10 +1064,7 @@ void Foam::shortestPathSet::genSamples
/"isLeakCell" + Foam::name(iter) + ".obj" /"isLeakCell" + Foam::name(iter) + ".obj"
); );
Pout<< "Writing new isLeakCell to " << str.name() << endl; Pout<< "Writing new isLeakCell to " << str.name() << endl;
forAll(leakCcs, i) str.write(leakCcs);
{
str.write(leakCcs[i]);
}
} }
if (debug & 2) if (debug & 2)
{ {
@ -1090,13 +1087,10 @@ void Foam::shortestPathSet::genSamples
<< " distance:" << samplingCurveDist[samplei] << " distance:" << samplingCurveDist[samplei]
<< endl; << endl;
str.write str.writeLine
( (
linePointRef samplingPts[samplei-1],
( samplingPts[samplei]
samplingPts[samplei-1],
samplingPts[samplei]
)
); );
} }
} }
@ -1121,9 +1115,9 @@ void Foam::shortestPathSet::genSamples
fm, fm,
dimensionedScalar(dimless, Zero) dimensionedScalar(dimless, Zero)
); );
forAll(isLeakCell, celli) for (const label celli : isLeakCell)
{ {
fld[celli] = isLeakCell[celli]; fld[celli] = scalar(1);
} }
fld.correctBoundaryConditions(); fld.correctBoundaryConditions();
fld.write(); fld.write();
@ -1193,8 +1187,8 @@ void Foam::shortestPathSet::genSamples
{ {
str.write(mesh.points()[pointi]); str.write(mesh.points()[pointi]);
} }
Pout<< "Writing " << str.nVertices() << " points to " << str.name() Pout<< "Writing " << str.nVertices()
<< endl; << " points to " << str.name() << endl;
} }
} }
@ -1266,8 +1260,8 @@ void Foam::shortestPathSet::genSamples
mkDir(mesh.time().timePath()); mkDir(mesh.time().timePath());
OBJstream str(mesh.time().timePath()/"isLeakFace.obj"); OBJstream str(mesh.time().timePath()/"isLeakFace.obj");
str.write(leakFaces, mesh.points(), false); str.write(leakFaces, mesh.points(), false);
Pout<< "Writing " << leakFaces.size() << " faces to " << str.name() Pout<< "Writing " << leakFaces.size()
<< endl; << " faces to " << str.name() << endl;
} }

View File

@ -54,9 +54,9 @@ void Foam::faceShading::writeRays
Pout<< "Dumping rays to " << os.name() << endl; Pout<< "Dumping rays to " << os.name() << endl;
forAll(myFc, faceI) forAll(myFc, facei)
{ {
os.write(linePointRef(myFc[faceI], endCf[faceI])); os.writeLine(myFc[facei], endCf[facei]);
} }
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2020,2022 OpenCFD Ltd Copyright (C) 2016-2022 OpenCFD Ltd
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -115,17 +115,10 @@ bool Foam::dynamicMotionSolverTopoFvMesh::update()
if (debug) if (debug)
{ {
OBJstream osOld("oldPts_" + time().timeName() + ".obj"); OBJstream osOld("oldPts_" + time().timeName() + ".obj");
const pointField& oldPts = oldPoints(); osOld.write(oldPoints());
forAll(oldPts, i)
{
osOld.write(oldPts[i]);
}
OBJstream osNew("newPts_" + time().timeName() + ".obj"); OBJstream osNew("newPts_" + time().timeName() + ".obj");
forAll(points(), i) osNew.write(points());
{
osNew.write(points()[i]);
}
} }
} }
else else

View File

@ -695,20 +695,15 @@ void Foam::isoAdvection::writeIsoFaces
Info<< nl << "isoAdvection: writing iso faces to file: " Info<< nl << "isoAdvection: writing iso faces to file: "
<< os.name() << nl << endl; << os.name() << nl << endl;
face f; for
forAll(allProcFaces, proci) (
const DynamicList<List<point>>& procFacePts
: allProcFaces
)
{ {
const DynamicList<List<point>>& procFacePts =
allProcFaces[proci];
for (const List<point>& facePts : procFacePts) for (const List<point>& facePts : procFacePts)
{ {
if (facePts.size() != f.size()) os.writeFace(facePts, false);
{
f = face(identity(facePts.size()));
}
os.write(f, facePts, false);
} }
} }
} }
@ -720,15 +715,9 @@ void Foam::isoAdvection::writeIsoFaces
Info<< nl << "isoAdvection: writing iso faces to file: " Info<< nl << "isoAdvection: writing iso faces to file: "
<< os.name() << nl << endl; << os.name() << nl << endl;
face f;
for (const List<point>& facePts : faces) for (const List<point>& facePts : faces)
{ {
if (facePts.size() != f.size()) os.writeFace(facePts, false);
{
f = face(identity(facePts.size()));
}
os.write(f, facePts, false);
} }
} }
} }