mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-consistency-face-access' into 'develop'
Feature consistency face access See merge request !109
This commit is contained in:
@ -112,6 +112,7 @@ Foam::UList<T> Foam::UList<T>::operator[](const labelRange& range)
|
||||
return UList<T>(&(this->v_[slice.start()]), slice.size()); // SubList
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
const Foam::UList<T> Foam::UList<T>::operator[](const labelRange& range) const
|
||||
{
|
||||
@ -132,6 +133,7 @@ Foam::UList<T> Foam::UList<T>::operator[]
|
||||
return UList<T>(&(this->v_[slice.start()]), slice.size()); // SubList
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
const Foam::UList<T> Foam::UList<T>::operator[]
|
||||
(
|
||||
|
||||
@ -149,7 +149,11 @@ public:
|
||||
|
||||
//- Return true if point label is found in edge.
|
||||
// Always false for a negative label.
|
||||
inline bool found(const label index) const;
|
||||
inline bool found(const label pointLabel) const;
|
||||
|
||||
//- Return local index (0,1) of point label in edge -1 on failure
|
||||
// Always return -1 for a negative label.
|
||||
inline label which(const label pointLabel) const;
|
||||
|
||||
//- Do the edges share a common vertex index?
|
||||
// Negative point labels never connect.
|
||||
|
||||
@ -206,10 +206,28 @@ inline Foam::label Foam::edge::maxVertex() const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::edge::found(const label index) const
|
||||
inline bool Foam::edge::found(const label pointLabel) const
|
||||
{
|
||||
// -1: always false
|
||||
return (index >= 0 && (index == start() || index == end()));
|
||||
return (pointLabel >= 0 && (pointLabel == start() || pointLabel == end()));
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::edge::which(const label pointLabel) const
|
||||
{
|
||||
// -1: always false
|
||||
if (pointLabel >= 0)
|
||||
{
|
||||
if (pointLabel == start())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (pointLabel == end())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -202,7 +202,10 @@ public:
|
||||
|
||||
//- Navigation through face vertices
|
||||
|
||||
//- Which vertex on face (face index given a global index)
|
||||
//- Return true if the global point label is found in face.
|
||||
inline bool found(const label globalIndex) const;
|
||||
|
||||
//- Which local vertex on face given a global index.
|
||||
// returns -1 if not found
|
||||
label which(const label globalIndex) const;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -116,20 +116,24 @@ inline Foam::edge Foam::face::faceEdge(const label n) const
|
||||
}
|
||||
|
||||
|
||||
// Next vertex on face
|
||||
inline bool Foam::face::found(const label globalIndex) const
|
||||
{
|
||||
return which(globalIndex) != -1;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::face::nextLabel(const label i) const
|
||||
{
|
||||
return operator[](fcIndex(i));
|
||||
}
|
||||
|
||||
|
||||
// Previous vertex on face
|
||||
inline Foam::label Foam::face::prevLabel(const label i) const
|
||||
{
|
||||
return operator[](rcIndex(i));
|
||||
}
|
||||
|
||||
// Number of triangles directly known from number of vertices
|
||||
|
||||
inline Foam::label Foam::face::nTriangles() const
|
||||
{
|
||||
return size() - 2;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -21,83 +21,53 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::faceTraits
|
||||
|
||||
Description
|
||||
Traits class for faces
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceTraits_H
|
||||
#define faceTraits_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// A triFace surface only handles triangulated faces
|
||||
template<>
|
||||
inline bool MeshedSurface<triFace>::isTri()
|
||||
// Forward declarations
|
||||
class triFace;
|
||||
class labelledTri;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faceTraits Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class FaceType>
|
||||
class faceTraits
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
|
||||
//- Face-type only handles triangles. Not true in general.
|
||||
inline static bool isTri() { return false; }
|
||||
};
|
||||
|
||||
|
||||
// A labelledTri surface only handles triangulated faces
|
||||
template<>
|
||||
inline bool MeshedSurface<labelledTri>::isTri()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
inline bool faceTraits<triFace>::isTri() { return true; }
|
||||
|
||||
|
||||
// Number of triangles for a triFace surface
|
||||
template<>
|
||||
inline label MeshedSurface<triFace>::nTriangles() const
|
||||
{
|
||||
return ParentType::size();
|
||||
}
|
||||
|
||||
// Number of triangles for a labelledTri surface
|
||||
template<>
|
||||
inline label MeshedSurface<labelledTri>::nTriangles() const
|
||||
{
|
||||
return ParentType::size();
|
||||
}
|
||||
|
||||
|
||||
// Inplace triangulation of triFace surface = no-op
|
||||
template<>
|
||||
inline label MeshedSurface<triFace>::triangulate()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Inplace triangulation of labelledTri surface = no-op
|
||||
template<>
|
||||
inline label MeshedSurface<labelledTri>::triangulate()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Inplace triangulation of triFace surface (with face map) = no-op
|
||||
template<>
|
||||
inline label MeshedSurface<triFace>::triangulate(List<label>& faceMap)
|
||||
{
|
||||
if (notNull(faceMap))
|
||||
{
|
||||
faceMap.clear();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Inplace triangulation of labelledTri surface (with face map) = no-op
|
||||
template<>
|
||||
inline label MeshedSurface<labelledTri>::triangulate(List<label>& faceMap)
|
||||
{
|
||||
if (notNull(faceMap))
|
||||
{
|
||||
faceMap.clear();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
inline bool faceTraits<labelledTri>::isTri() { return true; }
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -137,6 +137,13 @@ public:
|
||||
// The starting points of the original and reverse face are identical.
|
||||
inline triFace reverseFace() const;
|
||||
|
||||
//- Return true if the global point label is found in face.
|
||||
bool found(const label globalIndex) const;
|
||||
|
||||
//- Which local index (0,1,2) on face given a global index.
|
||||
// returns -1 if not found
|
||||
label which(const label globalIndex) const;
|
||||
|
||||
//- Return swept-volume from old-points to new-points
|
||||
inline scalar sweptVol
|
||||
(
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -209,6 +209,21 @@ inline Foam::triFace Foam::triFace::reverseFace() const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::triFace::found(const label globalIndex) const
|
||||
{
|
||||
return which(globalIndex) != -1;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::triFace::which(const label globalIndex) const
|
||||
{
|
||||
if (operator[](0) == globalIndex) return 0;
|
||||
if (operator[](1) == globalIndex) return 1;
|
||||
if (operator[](2) == globalIndex) return 2;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::triFace::sweptVol
|
||||
(
|
||||
const UList<point>& opts,
|
||||
|
||||
@ -98,10 +98,10 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return first vertex
|
||||
//- Return first point
|
||||
inline PointRef start() const;
|
||||
|
||||
//- Return second vertex
|
||||
//- Return second point
|
||||
inline PointRef end() const;
|
||||
|
||||
|
||||
@ -113,9 +113,12 @@ public:
|
||||
//- Return scalar magnitude
|
||||
inline scalar mag() const;
|
||||
|
||||
//- Return start-end vector
|
||||
//- Return start-to-end vector
|
||||
inline Point vec() const;
|
||||
|
||||
//- Return the unit vector (start-to-end)
|
||||
inline Point unitVec() const;
|
||||
|
||||
//- Return nearest distance to line from a given point
|
||||
// If the nearest point is on the line, return a hit
|
||||
PointHit<Point> nearestDist(const Point& p) const;
|
||||
|
||||
@ -90,6 +90,16 @@ inline Point Foam::line<Point, PointRef>::vec() const
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Point Foam::line<Point, PointRef>::unitVec() const
|
||||
{
|
||||
Point v = b_ - a_;
|
||||
v /= ::Foam::mag(v) + VSMALL;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
Foam::PointHit<Point> Foam::line<Point, PointRef>::nearestDist
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,24 +27,13 @@ License
|
||||
#include "error.H"
|
||||
#include "polyMesh.H"
|
||||
#include "cellModeller.H"
|
||||
#include "demandDrivenData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::label Foam::ensightCells::nTypes = 5;
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::ensightCells::elemType,
|
||||
5
|
||||
>::names[] = { "tetra4", "pyramid5", "penta6", "hexa8", "nfaced" };
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::ensightCells::elemType, 5>
|
||||
Foam::ensightCells::elemEnum;
|
||||
const char* Foam::ensightCells::elemNames[5] =
|
||||
{ "tetra4", "pyramid5", "penta6", "hexa8", "nfaced" };
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -63,9 +52,8 @@ void Foam::ensightCells::resizeAll()
|
||||
n = 0;
|
||||
forAll(sizes_, typei)
|
||||
{
|
||||
deleteDemandDrivenData(lists_[typei]);
|
||||
|
||||
lists_[typei] = new SubList<label>(address_, sizes_[typei], n);
|
||||
slices_[typei].setStart(n);
|
||||
slices_[typei].setSize(sizes_[typei]);
|
||||
|
||||
n += sizes_[typei];
|
||||
}
|
||||
@ -78,16 +66,10 @@ Foam::ensightCells::ensightCells(const label partIndex)
|
||||
:
|
||||
index_(partIndex),
|
||||
address_(),
|
||||
sizes_(Zero),
|
||||
lists_()
|
||||
slices_(),
|
||||
sizes_(Zero)
|
||||
{
|
||||
// Ensure sub-lists are properly initialized to nullptr
|
||||
forAll(lists_, typei)
|
||||
{
|
||||
lists_[typei] = nullptr;
|
||||
}
|
||||
|
||||
resizeAll(); // adjust allocation
|
||||
resizeAll(); // adjust allocation/sizing
|
||||
}
|
||||
|
||||
|
||||
@ -95,22 +77,16 @@ Foam::ensightCells::ensightCells(const ensightCells& obj)
|
||||
:
|
||||
index_(obj.index_),
|
||||
address_(obj.address_),
|
||||
sizes_(),
|
||||
lists_()
|
||||
slices_(),
|
||||
sizes_()
|
||||
{
|
||||
// Ensure sub-lists are properly initialized to nullptr
|
||||
forAll(lists_, typei)
|
||||
{
|
||||
lists_[typei] = nullptr;
|
||||
}
|
||||
|
||||
// Total (reduced) sizes
|
||||
// Save the total (reduced) sizes
|
||||
FixedList<label, 5> totSizes = obj.sizes_;
|
||||
|
||||
// Local sizes
|
||||
// Need local sizes for the resize operation
|
||||
this->sizes_ = obj.sizes();
|
||||
|
||||
resizeAll(); // adjust allocation
|
||||
resizeAll(); // adjust allocation/sizing
|
||||
|
||||
// Restore total (reduced) sizes
|
||||
this->sizes_ = totSizes;
|
||||
@ -120,13 +96,7 @@ Foam::ensightCells::ensightCells(const ensightCells& obj)
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightCells::~ensightCells()
|
||||
{
|
||||
forAll(lists_, typei)
|
||||
{
|
||||
deleteDemandDrivenData(lists_[typei]);
|
||||
}
|
||||
address_.clear();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -134,27 +104,15 @@ Foam::ensightCells::~ensightCells()
|
||||
Foam::FixedList<Foam::label, 5> Foam::ensightCells::sizes() const
|
||||
{
|
||||
FixedList<label, 5> count;
|
||||
forAll(lists_, typei)
|
||||
forAll(slices_, typei)
|
||||
{
|
||||
count[typei] = lists_[typei]->size();
|
||||
count[typei] = slices_[typei].size();
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::ensightCells::offset(const enum elemType what) const
|
||||
{
|
||||
label n = 0;
|
||||
for (label typei = 0; typei < label(what); ++typei)
|
||||
{
|
||||
n += lists_[typei]->size();
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::ensightCells::total() const
|
||||
{
|
||||
label n = 0;
|
||||
@ -175,9 +133,10 @@ void Foam::ensightCells::clear()
|
||||
|
||||
void Foam::ensightCells::reduce()
|
||||
{
|
||||
// No listCombineGather, listCombineScatter for FixedList
|
||||
forAll(sizes_, typei)
|
||||
{
|
||||
sizes_[typei] = lists_[typei]->size();
|
||||
sizes_[typei] = slices_[typei].size();
|
||||
Foam::reduce(sizes_[typei], sumOp<label>());
|
||||
}
|
||||
}
|
||||
@ -185,9 +144,13 @@ void Foam::ensightCells::reduce()
|
||||
|
||||
void Foam::ensightCells::sort()
|
||||
{
|
||||
forAll(lists_, typei)
|
||||
forAll(slices_, typei)
|
||||
{
|
||||
Foam::sort(*(lists_[typei]));
|
||||
if (slices_[typei].size())
|
||||
{
|
||||
SubList<label> idLst(address_, slices_[typei]);
|
||||
Foam::sort(idLst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +203,7 @@ void Foam::ensightCells::classify
|
||||
}
|
||||
|
||||
resizeAll(); // adjust allocation
|
||||
sizes_ = Zero; // reset sizes
|
||||
sizes_ = Zero; // reset sizes - use for local indexing here
|
||||
|
||||
// Assign cell-id per shape type
|
||||
for (label listi = 0; listi < sz; ++listi)
|
||||
@ -267,7 +230,10 @@ void Foam::ensightCells::classify
|
||||
}
|
||||
|
||||
// eg, the processor local cellId
|
||||
lists_[what]->operator[](sizes_[what]++) = id;
|
||||
UList<label> slice = address_[slices_[what]];
|
||||
|
||||
slice[sizes_[what]] = id;
|
||||
sizes_[what]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,8 +35,6 @@ Description
|
||||
|
||||
#include "labelList.H"
|
||||
#include "FixedList.H"
|
||||
#include "SubList.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -58,18 +56,18 @@ public:
|
||||
//- Addressable ensight element types
|
||||
enum elemType
|
||||
{
|
||||
TETRA4,
|
||||
PYRAMID5,
|
||||
PENTA6,
|
||||
HEXA8,
|
||||
NFACED
|
||||
TETRA4, //!< "tetra4"
|
||||
PYRAMID5, //!< "pyramid5"
|
||||
PENTA6, //!< "penta6"
|
||||
HEXA8, //!< "hexa8"
|
||||
NFACED //!< "nfaced"
|
||||
};
|
||||
|
||||
//- Number of element types (5)
|
||||
static const label nTypes;
|
||||
|
||||
//- The Ensight names for each element type
|
||||
static const NamedEnum<elemType, 5> elemEnum;
|
||||
//- The ensight element type names
|
||||
static const char* elemNames[5];
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
@ -86,17 +84,16 @@ private:
|
||||
// The ensight part number is typically this value +1.
|
||||
label index_;
|
||||
|
||||
//- Linear list of ids, sub-sectioned per element type via SubLists
|
||||
//- Linear list of ids, sub-sectioned per element type by sub-lists
|
||||
labelList address_;
|
||||
|
||||
//- Slices (sub-lists) of the address ids for each element type.
|
||||
FixedList<labelRange, 5> slices_;
|
||||
|
||||
//- List of global sizes for each element type.
|
||||
// Used temporarily for local sizes when building the element lists.
|
||||
FixedList<label, 5> sizes_;
|
||||
|
||||
//- List of ids for each element type.
|
||||
// Managed via pointers, since a SubList cannot be relocated/resized.
|
||||
FixedList<SubList<label>*, 5> lists_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -115,7 +112,7 @@ public:
|
||||
ensightCells(label partIndex = 0);
|
||||
|
||||
//- Copy constructor. Needed for lists etc.
|
||||
ensightCells(const ensightCells&);
|
||||
ensightCells(const ensightCells& obj);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -135,6 +132,9 @@ public:
|
||||
//- The processor local size of all elements.
|
||||
inline label size() const;
|
||||
|
||||
//- The processor local size of the specified element type.
|
||||
inline label size(const enum elemType) const;
|
||||
|
||||
//- The global number of the specified element type.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
inline label total(const enum elemType) const;
|
||||
@ -151,23 +151,23 @@ public:
|
||||
FixedList<label, 5> sizes() const;
|
||||
|
||||
//- Processor local starting offset of element type.
|
||||
label offset(const enum elemType what) const;
|
||||
inline label offset(const enum elemType what) const;
|
||||
|
||||
//- Return the (local) cell ids of the specified element type
|
||||
inline const labelUList& cellIds(const enum elemType) const;
|
||||
inline const labelUList cellIds(const enum elemType) const;
|
||||
|
||||
//- Return the cell ids of all elements
|
||||
inline const labelUList& cellIds() const;
|
||||
|
||||
|
||||
// Edit
|
||||
// Edit
|
||||
|
||||
//- Classify cell types and set the element lists.
|
||||
// The optional indirect addressing can be used when classifying
|
||||
// groups of cells (eg, from a cellZone etc).
|
||||
void classify
|
||||
(
|
||||
const polyMesh&,
|
||||
const polyMesh& mesh,
|
||||
const labelUList& addressing = labelUList::null()
|
||||
);
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
|
||||
inline const char* Foam::ensightCells::key(const enum elemType what)
|
||||
{
|
||||
return elemEnum[what];
|
||||
return elemNames[what];
|
||||
}
|
||||
|
||||
|
||||
@ -63,20 +63,24 @@ inline Foam::label Foam::ensightCells::total(const enum elemType what) const
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelUList& Foam::ensightCells::cellIds
|
||||
inline Foam::label Foam::ensightCells::size(const enum elemType what) const
|
||||
{
|
||||
return slices_[what].size();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::ensightCells::offset(const enum elemType what) const
|
||||
{
|
||||
return slices_[what].start();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelUList Foam::ensightCells::cellIds
|
||||
(
|
||||
const enum elemType what
|
||||
) const
|
||||
{
|
||||
if (!lists_[what])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Accessing unallocated sublist for elem-type: "
|
||||
<< elemEnum[what]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return *(lists_[what]);
|
||||
return address_[slices_[what]];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,24 +27,13 @@ License
|
||||
#include "error.H"
|
||||
#include "polyMesh.H"
|
||||
#include "ListOps.H"
|
||||
#include "demandDrivenData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::label Foam::ensightFaces::nTypes = 3;
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::ensightFaces::elemType,
|
||||
3
|
||||
>::names[] = { "tria3", "quad4", "nsided" };
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::ensightFaces::elemType, 3>
|
||||
Foam::ensightFaces::elemEnum;
|
||||
const char* Foam::ensightFaces::elemNames[3] =
|
||||
{ "tria3", "quad4", "nsided" };
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -99,9 +88,8 @@ void Foam::ensightFaces::resizeAll()
|
||||
n = 0;
|
||||
forAll(sizes_, typei)
|
||||
{
|
||||
deleteDemandDrivenData(lists_[typei]);
|
||||
|
||||
lists_[typei] = new SubList<label>(address_, sizes_[typei], n);
|
||||
slices_[typei].setStart(n);
|
||||
slices_[typei].setSize(sizes_[typei]);
|
||||
|
||||
n += sizes_[typei];
|
||||
}
|
||||
@ -118,16 +106,10 @@ Foam::ensightFaces::ensightFaces(label partIndex)
|
||||
index_(partIndex),
|
||||
address_(),
|
||||
flipMap_(),
|
||||
sizes_(Zero),
|
||||
lists_()
|
||||
slices_(),
|
||||
sizes_(Zero)
|
||||
{
|
||||
// Ensure sub-lists are properly initialized to nullptr
|
||||
forAll(lists_, typei)
|
||||
{
|
||||
lists_[typei] = nullptr;
|
||||
}
|
||||
|
||||
resizeAll(); // adjust allocation
|
||||
resizeAll(); // adjust allocation/sizing
|
||||
}
|
||||
|
||||
|
||||
@ -136,22 +118,16 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj)
|
||||
index_(obj.index_),
|
||||
address_(obj.address_),
|
||||
flipMap_(obj.flipMap_),
|
||||
sizes_(),
|
||||
lists_()
|
||||
slices_(),
|
||||
sizes_()
|
||||
{
|
||||
// Ensure sub-lists are properly initialized to nullptr
|
||||
forAll(lists_, typei)
|
||||
{
|
||||
lists_[typei] = nullptr;
|
||||
}
|
||||
|
||||
// Total (reduced) sizes
|
||||
// Save the total (reduced) sizes
|
||||
FixedList<label, 3> totSizes = obj.sizes_;
|
||||
|
||||
// Local sizes
|
||||
// Need local sizes for the resize operation
|
||||
this->sizes_ = obj.sizes();
|
||||
|
||||
resizeAll(); // adjust allocation
|
||||
resizeAll(); // adjust allocation/sizing
|
||||
|
||||
// Restore total (reduced) sizes
|
||||
this->sizes_ = totSizes;
|
||||
@ -161,14 +137,7 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj)
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightFaces::~ensightFaces()
|
||||
{
|
||||
forAll(lists_, typei)
|
||||
{
|
||||
deleteDemandDrivenData(lists_[typei]);
|
||||
}
|
||||
address_.clear();
|
||||
flipMap_.clear();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -176,27 +145,15 @@ Foam::ensightFaces::~ensightFaces()
|
||||
Foam::FixedList<Foam::label, 3> Foam::ensightFaces::sizes() const
|
||||
{
|
||||
FixedList<label, 3> count;
|
||||
forAll(lists_, typei)
|
||||
forAll(slices_, typei)
|
||||
{
|
||||
count[typei] = lists_[typei]->size();
|
||||
count[typei] = slices_[typei].size();
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::ensightFaces::offset(const enum elemType what) const
|
||||
{
|
||||
label n = 0;
|
||||
for (label typei = 0; typei < label(what); ++typei)
|
||||
{
|
||||
n += lists_[typei]->size();
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::ensightFaces::total() const
|
||||
{
|
||||
label n = 0;
|
||||
@ -217,9 +174,10 @@ void Foam::ensightFaces::clear()
|
||||
|
||||
void Foam::ensightFaces::reduce()
|
||||
{
|
||||
// No listCombineGather, listCombineScatter for FixedList
|
||||
forAll(sizes_, typei)
|
||||
{
|
||||
sizes_[typei] = lists_[typei]->size();
|
||||
sizes_[typei] = slices_[typei].size();
|
||||
Foam::reduce(sizes_[typei], sumOp<label>());
|
||||
}
|
||||
}
|
||||
@ -229,20 +187,15 @@ void Foam::ensightFaces::sort()
|
||||
{
|
||||
if (flipMap_.size() == address_.size())
|
||||
{
|
||||
// sort flip map too
|
||||
|
||||
// Must sort flip map as well
|
||||
labelList order;
|
||||
label start = 0;
|
||||
|
||||
forAll(lists_, typei)
|
||||
forAll(slices_, typei)
|
||||
{
|
||||
SubList<label>& idLst = *(lists_[typei]);
|
||||
const label sz = idLst.size();
|
||||
|
||||
if (sz)
|
||||
if (slices_[typei].size())
|
||||
{
|
||||
SubList<bool> flip(flipMap_, sz, start);
|
||||
start += sz; // for next sub-list
|
||||
SubList<label> idLst(address_, slices_[typei]);
|
||||
SubList<bool> flip(flipMap_, slices_[typei]);
|
||||
|
||||
Foam::sortedOrder(idLst, order);
|
||||
|
||||
@ -254,11 +207,16 @@ void Foam::ensightFaces::sort()
|
||||
else
|
||||
{
|
||||
// no flip-maps, simpler to sort
|
||||
forAll(lists_, typei)
|
||||
forAll(slices_, typei)
|
||||
{
|
||||
Foam::sort(*(lists_[typei]));
|
||||
if (slices_[typei].size())
|
||||
{
|
||||
SubList<label> idLst(address_, slices_[typei]);
|
||||
Foam::sort(idLst);
|
||||
}
|
||||
}
|
||||
flipMap_.clear(); // for safety
|
||||
|
||||
flipMap_.clear(); // for extra safety
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,7 +236,7 @@ void Foam::ensightFaces::classify(const faceList& faces)
|
||||
}
|
||||
|
||||
resizeAll(); // adjust allocation
|
||||
sizes_ = Zero; // reset sizes
|
||||
sizes_ = Zero; // reset sizes - use for local indexing here
|
||||
|
||||
// Assign face-id per shape type
|
||||
for (label listi = 0; listi < sz; ++listi)
|
||||
@ -318,7 +276,7 @@ void Foam::ensightFaces::classify
|
||||
}
|
||||
|
||||
resizeAll(); // adjust allocation
|
||||
sizes_ = Zero; // reset sizes
|
||||
sizes_ = Zero; // reset sizes - use for local indexing here
|
||||
|
||||
if (useFlip)
|
||||
{
|
||||
@ -330,11 +288,11 @@ void Foam::ensightFaces::classify
|
||||
for (label listi = 0; listi < sz; ++listi)
|
||||
{
|
||||
const label faceId = addressing[listi];
|
||||
const bool flip = useFlip && flipMap[listi];
|
||||
const bool doFlip = useFlip && flipMap[listi];
|
||||
|
||||
if (!exclude[faceId])
|
||||
{
|
||||
add(faces[faceId], faceId, flip);
|
||||
add(faces[faceId], faceId, doFlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,7 +37,6 @@ Description
|
||||
#include "faceList.H"
|
||||
#include "FixedList.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -57,16 +56,16 @@ public:
|
||||
//- Addressable ensight element types
|
||||
enum elemType
|
||||
{
|
||||
TRIA3,
|
||||
QUAD4,
|
||||
NSIDED
|
||||
TRIA3, //!< "tria3"
|
||||
QUAD4, //!< "quad4"
|
||||
NSIDED //!< "nsided"
|
||||
};
|
||||
|
||||
//- Number of element types (3)
|
||||
static const label nTypes;
|
||||
|
||||
//- The Ensight names for each element type
|
||||
static const NamedEnum<elemType, 3> elemEnum;
|
||||
//- The ensight element type names
|
||||
static const char* elemNames[3];
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
@ -83,28 +82,27 @@ private:
|
||||
// The ensight part number is typically this value +1.
|
||||
label index_;
|
||||
|
||||
//- Linear list of ids, sub-sectioned per element type via SubLists
|
||||
//- Linear list of ids, sub-sectioned per element type by sub-lists
|
||||
labelList address_;
|
||||
|
||||
//- Linear list of face-flips
|
||||
boolList flipMap_;
|
||||
|
||||
//- Slices (sub-lists) of the address and flips for each element type.
|
||||
FixedList<labelRange, 3> slices_;
|
||||
|
||||
//- List of global sizes for each element type.
|
||||
// Used temporarily for local sizes when building the element lists.
|
||||
FixedList<label, 3> sizes_;
|
||||
|
||||
//- SubLists of ids for each element type.
|
||||
// Managed via pointers, since a SubList cannot be relocated/resized.
|
||||
FixedList<SubList<label>*, 3> lists_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Simple classifier
|
||||
inline static elemType whatType(const face&);
|
||||
inline static elemType whatType(const face& f);
|
||||
|
||||
//- Low-level internal addition routine
|
||||
inline void add(const face&, const label id, const bool flip = false);
|
||||
inline void add(const face& f, const label id, const bool flip = false);
|
||||
|
||||
//- Use temporarily stored sizes to redimension the element lists
|
||||
void resizeAll();
|
||||
@ -121,7 +119,7 @@ public:
|
||||
ensightFaces(label partIndex = 0);
|
||||
|
||||
//- Copy constructor. Needed for lists etc.
|
||||
ensightFaces(const ensightFaces&);
|
||||
ensightFaces(const ensightFaces& obj);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -141,14 +139,17 @@ public:
|
||||
//- The processor local size of all elements.
|
||||
inline label size() const;
|
||||
|
||||
//- The global number of the specified element type.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
inline label total(const enum elemType) const;
|
||||
//- The processor local size of the specified element type.
|
||||
inline label size(const enum elemType) const;
|
||||
|
||||
//- The global number of all element types.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
label total() const;
|
||||
|
||||
//- The global number of the specified element type.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
inline label total(const enum elemType) const;
|
||||
|
||||
//- The global numbers per element type.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
inline const FixedList<label, 3>& totals() const;
|
||||
@ -157,10 +158,10 @@ public:
|
||||
FixedList<label, 3> sizes() const;
|
||||
|
||||
//- Processor local starting offset of element type.
|
||||
label offset(const enum elemType what) const;
|
||||
inline label offset(const enum elemType what) const;
|
||||
|
||||
//- Return the (local) face ids of the specified element type
|
||||
inline const labelUList& faceIds(const enum elemType) const;
|
||||
inline const labelUList faceIds(const enum elemType) const;
|
||||
|
||||
//- Return the processor local face ids of all elements
|
||||
inline const labelUList& faceIds() const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,7 +29,7 @@ License
|
||||
|
||||
inline const char* Foam::ensightFaces::key(const enum elemType what)
|
||||
{
|
||||
return elemEnum[what];
|
||||
return elemNames[what];
|
||||
}
|
||||
|
||||
|
||||
@ -63,20 +63,24 @@ inline Foam::label Foam::ensightFaces::total(const enum elemType what) const
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelUList& Foam::ensightFaces::faceIds
|
||||
inline Foam::label Foam::ensightFaces::size(const enum elemType what) const
|
||||
{
|
||||
return slices_[what].size();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::ensightFaces::offset(const enum elemType what) const
|
||||
{
|
||||
return slices_[what].start();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelUList Foam::ensightFaces::faceIds
|
||||
(
|
||||
const enum elemType what
|
||||
) const
|
||||
{
|
||||
if (!lists_[what])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Accessing unallocated sublist for elem-type: "
|
||||
<< elemEnum[what]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return *(lists_[what]);
|
||||
return address_[slices_[what]];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -33,24 +33,17 @@ License
|
||||
#include "polyMesh.H"
|
||||
#include "surfMesh.H"
|
||||
#include "primitivePatch.H"
|
||||
#include "faceTraits.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class Face>
|
||||
inline bool Foam::MeshedSurface<Face>::isTri()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class Face>
|
||||
Foam::wordHashSet Foam::MeshedSurface<Face>::readTypes()
|
||||
{
|
||||
return wordHashSet(*fileExtensionConstructorTablePtr_);
|
||||
}
|
||||
|
||||
|
||||
template<class Face>
|
||||
Foam::wordHashSet Foam::MeshedSurface<Face>::writeTypes()
|
||||
{
|
||||
@ -116,25 +109,34 @@ void Foam::MeshedSurface<Face>::write
|
||||
const fileName& name,
|
||||
const MeshedSurface<Face>& surf
|
||||
)
|
||||
{
|
||||
write(name, name.ext(), surf);
|
||||
}
|
||||
|
||||
|
||||
template<class Face>
|
||||
void Foam::MeshedSurface<Face>::write
|
||||
(
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const MeshedSurface<Face>& surf
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << "Writing to " << name << endl;
|
||||
}
|
||||
|
||||
const word ext = name.ext();
|
||||
auto mfIter = writefileExtensionMemberFunctionTablePtr_->find(ext);
|
||||
|
||||
typename writefileExtensionMemberFunctionTable::iterator mfIter =
|
||||
writefileExtensionMemberFunctionTablePtr_->find(ext);
|
||||
|
||||
if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
|
||||
if (!mfIter.found())
|
||||
{
|
||||
// No direct writer, delegate to proxy if possible
|
||||
const wordHashSet& delegate = ProxyType::writeTypes();
|
||||
|
||||
if (delegate.found(ext))
|
||||
{
|
||||
MeshedSurfaceProxy<Face>(surf).write(name);
|
||||
MeshedSurfaceProxy<Face>(surf).write(name, ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -850,6 +852,11 @@ bool Foam::MeshedSurface<Face>::checkFaces
|
||||
template<class Face>
|
||||
Foam::label Foam::MeshedSurface<Face>::nTriangles() const
|
||||
{
|
||||
if (faceTraits<Face>::isTri())
|
||||
{
|
||||
return ParentType::size();
|
||||
}
|
||||
|
||||
return nTriangles
|
||||
(
|
||||
const_cast<List<label>&>(List<label>::null())
|
||||
@ -905,10 +912,18 @@ Foam::label Foam::MeshedSurface<Face>::nTriangles
|
||||
template<class Face>
|
||||
Foam::label Foam::MeshedSurface<Face>::triangulate()
|
||||
{
|
||||
return triangulate
|
||||
(
|
||||
const_cast<List<label>&>(List<label>::null())
|
||||
);
|
||||
if (faceTraits<Face>::isTri())
|
||||
{
|
||||
// Inplace triangulation of triFace/labelledTri surface = no-op
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return triangulate
|
||||
(
|
||||
const_cast<List<label>&>(List<label>::null())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -918,6 +933,17 @@ Foam::label Foam::MeshedSurface<Face>::triangulate
|
||||
List<label>& faceMapOut
|
||||
)
|
||||
{
|
||||
if (faceTraits<Face>::isTri())
|
||||
{
|
||||
// Inplace triangulation of triFace/labelledTri surface = no-op
|
||||
if (notNull(faceMapOut))
|
||||
{
|
||||
faceMapOut.clear();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
label nTri = 0;
|
||||
label maxTri = 0; // the maximum number of triangles for any single face
|
||||
List<Face>& faceLst = this->storedFaces();
|
||||
@ -966,7 +992,7 @@ Foam::label Foam::MeshedSurface<Face>::triangulate
|
||||
{
|
||||
label fp1 = f.fcIndex(fp);
|
||||
|
||||
newFaces[nTri] = triFace(f[0], f[fp], f[fp1]);
|
||||
newFaces[nTri] = Face{f[0], f[fp], f[fp1]};
|
||||
faceMap[nTri] = facei;
|
||||
nTri++;
|
||||
}
|
||||
|
||||
@ -186,9 +186,6 @@ public:
|
||||
|
||||
// Static
|
||||
|
||||
//- Face storage only handles triangulated faces
|
||||
inline static bool isTri();
|
||||
|
||||
//- Can we read this file format?
|
||||
static bool canRead(const fileName&, const bool verbose=false);
|
||||
|
||||
@ -210,36 +207,36 @@ public:
|
||||
//- Construct by transferring components (points, faces, zones).
|
||||
MeshedSurface
|
||||
(
|
||||
const Xfer<pointField>&,
|
||||
const Xfer<List<Face>>&,
|
||||
const Xfer<surfZoneList>&
|
||||
const Xfer<pointField>& pointLst,
|
||||
const Xfer<List<Face>>& faceLst,
|
||||
const Xfer<surfZoneList>& zoneLst
|
||||
);
|
||||
|
||||
//- Construct by transferring components (points, faces).
|
||||
// Use zone information if available
|
||||
MeshedSurface
|
||||
(
|
||||
const Xfer<pointField>&,
|
||||
const Xfer<List<Face>>&,
|
||||
const Xfer<pointField>& pointLst,
|
||||
const Xfer<List<Face>>& faceLst,
|
||||
const labelUList& zoneSizes = labelUList(),
|
||||
const UList<word>& zoneNames = UList<word>()
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
MeshedSurface(const MeshedSurface&);
|
||||
MeshedSurface(const MeshedSurface& surf);
|
||||
|
||||
//- Construct from a UnsortedMeshedSurface
|
||||
MeshedSurface(const UnsortedMeshedSurface<Face>&);
|
||||
MeshedSurface(const UnsortedMeshedSurface<Face>& surf);
|
||||
|
||||
//- Construct from a boundary mesh with local points/faces
|
||||
MeshedSurface
|
||||
(
|
||||
const polyBoundaryMesh&,
|
||||
const polyBoundaryMesh& bMesh,
|
||||
const bool globalPoints=false
|
||||
);
|
||||
|
||||
//- Construct from a surfMesh
|
||||
MeshedSurface(const surfMesh&);
|
||||
MeshedSurface(const surfMesh& mesh);
|
||||
|
||||
//- Construct by transferring the contents from a UnsortedMeshedSurface
|
||||
MeshedSurface(const Xfer<UnsortedMeshedSurface<Face>>&);
|
||||
@ -248,18 +245,18 @@ public:
|
||||
MeshedSurface(const Xfer<MeshedSurface<Face>>&);
|
||||
|
||||
//- Construct from file name (uses extension to determine type)
|
||||
MeshedSurface(const fileName&);
|
||||
MeshedSurface(const fileName& name);
|
||||
|
||||
//- Construct from file name (uses extension to determine type)
|
||||
MeshedSurface(const fileName&, const word& ext);
|
||||
MeshedSurface(const fileName& name, const word& ext);
|
||||
|
||||
//- Construct from Istream
|
||||
MeshedSurface(Istream&);
|
||||
MeshedSurface(Istream& is);
|
||||
|
||||
//- Construct from database
|
||||
MeshedSurface
|
||||
(
|
||||
const Time&,
|
||||
const Time& t,
|
||||
const word& surfName = word::null
|
||||
);
|
||||
|
||||
@ -283,7 +280,7 @@ public:
|
||||
//- Select constructed from filename (explicit extension)
|
||||
static autoPtr<MeshedSurface> New
|
||||
(
|
||||
const fileName&,
|
||||
const fileName& name,
|
||||
const word& ext
|
||||
);
|
||||
|
||||
@ -310,11 +307,19 @@ public:
|
||||
(name, surf)
|
||||
);
|
||||
|
||||
//- Write to file
|
||||
//- Write to file, selecting writer based on its extension
|
||||
static void write
|
||||
(
|
||||
const fileName&,
|
||||
const MeshedSurface<Face>&
|
||||
const fileName& name,
|
||||
const MeshedSurface<Face>& surf
|
||||
);
|
||||
|
||||
//- Write to file, selecting writer based on the given extension
|
||||
static void write
|
||||
(
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const MeshedSurface<Face>& surf
|
||||
);
|
||||
|
||||
|
||||
@ -563,8 +568,6 @@ bool MeshedSurface<labelledTri>::addZonesToFaces();
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "MeshedSurfaceI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "MeshedSurface.C"
|
||||
#endif
|
||||
|
||||
@ -50,7 +50,7 @@ namespace Foam
|
||||
)
|
||||
{
|
||||
// First triangulate
|
||||
// - slightly wasteful for space, but manages adjusts the zones too!
|
||||
// - slightly wasteful for space, but adjusts the zones too!
|
||||
surf.triangulate();
|
||||
this->storedPoints().transfer(surf.storedPoints());
|
||||
this->storedZones().transfer(surf.storedZones());
|
||||
@ -81,12 +81,12 @@ namespace Foam
|
||||
)
|
||||
{
|
||||
// First triangulate
|
||||
// - slightly wasteful for space, but manages adjusts the zones too!
|
||||
// - slightly wasteful for space, but adjusts the zones too!
|
||||
surf.triangulate();
|
||||
this->storedPoints().transfer(surf.storedPoints());
|
||||
this->storedZones().transfer(surf.storedZones());
|
||||
|
||||
// transcribe from face -> triFace
|
||||
// transcribe from face -> labelledTri (via triFace)
|
||||
const List<face>& origFaces = surf.surfFaces();
|
||||
List<labelledTri> newFaces(origFaces.size());
|
||||
forAll(origFaces, facei)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "MeshedSurface.H"
|
||||
#include "boundBox.H"
|
||||
#include "faceTraits.H"
|
||||
#include "Istream.H"
|
||||
#include "Ostream.H"
|
||||
|
||||
@ -58,7 +59,7 @@ template<class Face>
|
||||
void Foam::MeshedSurface<Face>::writeStats(Ostream& os) const
|
||||
{
|
||||
os << "points : " << this->points().size() << nl;
|
||||
if (MeshedSurface<Face>::isTri())
|
||||
if (faceTraits<Face>::isTri())
|
||||
{
|
||||
os << "triangles : " << this->size() << nl;
|
||||
}
|
||||
@ -82,7 +83,7 @@ void Foam::MeshedSurface<Face>::writeStats(Ostream& os) const
|
||||
|
||||
os << "faces : " << this->size()
|
||||
<< " (tri:" << nTri << " quad:" << nQuad
|
||||
<< " poly:" << (this->size() - nTri - nQuad ) << ")" << nl;
|
||||
<< " poly:" << (this->size() - nTri - nQuad) << ")" << nl;
|
||||
}
|
||||
|
||||
os << "boundingBox : " << boundBox(this->points()) << endl;
|
||||
|
||||
@ -38,10 +38,9 @@ Foam::MeshedSurface<Face>::New(const fileName& name, const word& ext)
|
||||
InfoInFunction << "Constructing MeshedSurface" << endl;
|
||||
}
|
||||
|
||||
typename fileExtensionConstructorTable::iterator cstrIter =
|
||||
fileExtensionConstructorTablePtr_->find(ext);
|
||||
auto cstrIter = fileExtensionConstructorTablePtr_->find(ext);
|
||||
|
||||
if (cstrIter == fileExtensionConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
// No direct reader, delegate to friend if possible
|
||||
const wordHashSet& delegate = FriendType::readTypes();
|
||||
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "ListOps.H"
|
||||
#include "surfMesh.H"
|
||||
#include "OFstream.H"
|
||||
#include "faceTraits.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -59,18 +60,27 @@ void Foam::MeshedSurfaceProxy<Face>::write
|
||||
const fileName& name,
|
||||
const MeshedSurfaceProxy& surf
|
||||
)
|
||||
{
|
||||
write(name, name.ext(), surf);
|
||||
}
|
||||
|
||||
|
||||
template<class Face>
|
||||
void Foam::MeshedSurfaceProxy<Face>::write
|
||||
(
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const MeshedSurfaceProxy& surf
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << "Writing to " << name << endl;
|
||||
}
|
||||
|
||||
const word ext = name.ext();
|
||||
auto mfIter = writefileExtensionMemberFunctionTablePtr_->find(ext);
|
||||
|
||||
typename writefileExtensionMemberFunctionTable::iterator mfIter =
|
||||
writefileExtensionMemberFunctionTablePtr_->find(ext);
|
||||
|
||||
if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
|
||||
if (!mfIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown file extension " << ext << nl << nl
|
||||
@ -237,38 +247,24 @@ Foam::MeshedSurfaceProxy<Face>::~MeshedSurfaceProxy()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Number of triangles for a triFace surface
|
||||
template<>
|
||||
inline label MeshedSurfaceProxy<triFace>::nTriangles() const
|
||||
{
|
||||
return this->size();
|
||||
}
|
||||
|
||||
// Number of triangles for a labelledTri surface
|
||||
template<>
|
||||
inline label MeshedSurfaceProxy<labelledTri>::nTriangles() const
|
||||
{
|
||||
return this->size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<class Face>
|
||||
inline Foam::label Foam::MeshedSurfaceProxy<Face>::nTriangles() const
|
||||
{
|
||||
label nTri = 0;
|
||||
const List<Face>& faceLst = this->surfFaces();
|
||||
forAll(faceLst, facei)
|
||||
if (faceTraits<Face>::isTri())
|
||||
{
|
||||
nTri += faceLst[facei].nTriangles();
|
||||
return this->size();
|
||||
}
|
||||
else
|
||||
{
|
||||
label nTri = 0;
|
||||
const List<Face>& faceLst = this->surfFaces();
|
||||
forAll(faceLst, facei)
|
||||
{
|
||||
nTri += faceLst[facei].nTriangles();
|
||||
}
|
||||
|
||||
return nTri;
|
||||
return nTri;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -100,9 +100,9 @@ public:
|
||||
//- Construct from component references
|
||||
MeshedSurfaceProxy
|
||||
(
|
||||
const pointField&,
|
||||
const List<Face>&,
|
||||
const List<surfZone>& = List<surfZone>(),
|
||||
const pointField& pointLst,
|
||||
const List<Face>& faceLst,
|
||||
const List<surfZone>& zoneLst = List<surfZone>(),
|
||||
const List<label>& faceMap = List<label>()
|
||||
);
|
||||
|
||||
@ -126,11 +126,19 @@ public:
|
||||
(name, surf)
|
||||
);
|
||||
|
||||
//- Write to file
|
||||
//- Write to file, selected based on its extension
|
||||
static void write
|
||||
(
|
||||
const fileName&,
|
||||
const MeshedSurfaceProxy<Face>&
|
||||
const fileName& name,
|
||||
const MeshedSurfaceProxy& surf
|
||||
);
|
||||
|
||||
//- Write to file, selected based on given extension
|
||||
static void write
|
||||
(
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const MeshedSurfaceProxy& surf
|
||||
);
|
||||
|
||||
|
||||
@ -188,10 +196,16 @@ public:
|
||||
write(name, *this);
|
||||
}
|
||||
|
||||
//- Generic write routine. Chooses writer based on extension.
|
||||
virtual void write(const fileName& name, const word& ext) const
|
||||
{
|
||||
write(name, ext, *this);
|
||||
}
|
||||
|
||||
//- Write to database
|
||||
virtual void write
|
||||
(
|
||||
const Time&,
|
||||
const Time& t,
|
||||
const word& surfName = word::null
|
||||
) const;
|
||||
};
|
||||
|
||||
@ -113,17 +113,16 @@ void Foam::UnsortedMeshedSurface<Face>::write
|
||||
|
||||
const word ext = name.ext();
|
||||
|
||||
typename writefileExtensionMemberFunctionTable::iterator mfIter =
|
||||
writefileExtensionMemberFunctionTablePtr_->find(ext);
|
||||
auto mfIter = writefileExtensionMemberFunctionTablePtr_->find(ext);
|
||||
|
||||
if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
|
||||
if (!mfIter.found())
|
||||
{
|
||||
// No direct writer, delegate to proxy if possible
|
||||
const wordHashSet& delegate = ProxyType::writeTypes();
|
||||
|
||||
if (delegate.found(ext))
|
||||
{
|
||||
MeshedSurfaceProxy<Face>(surf).write(name);
|
||||
MeshedSurfaceProxy<Face>(surf).write(name, ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -37,10 +37,9 @@ Foam::UnsortedMeshedSurface<Face>::New(const fileName& name, const word& ext)
|
||||
InfoInFunction << "Constructing UnsortedMeshedSurface" << endl;
|
||||
}
|
||||
|
||||
typename fileExtensionConstructorTable::iterator cstrIter =
|
||||
fileExtensionConstructorTablePtr_->find(ext);
|
||||
auto cstrIter = fileExtensionConstructorTablePtr_->find(ext);
|
||||
|
||||
if (cstrIter == fileExtensionConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
// No direct reader, delegate to parent if possible
|
||||
const wordHashSet& delegate = ParentType::readTypes();
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "AC3DsurfaceFormat.H"
|
||||
#include "IStringStream.H"
|
||||
#include "PrimitivePatch.H"
|
||||
#include "faceTraits.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -194,9 +195,9 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
||||
verts[vertI] = parse<int>(line) + vertexOffset;
|
||||
}
|
||||
|
||||
labelUList& f = static_cast<labelUList&>(verts);
|
||||
const labelUList& f = static_cast<const labelUList&>(verts);
|
||||
|
||||
if (MeshedSurface<Face>::isTri() && f.size() > 3)
|
||||
if (faceTraits<Face>::isTri() && f.size() > 3)
|
||||
{
|
||||
// simple face triangulation about f[0]
|
||||
// points may be incomplete
|
||||
@ -204,7 +205,7 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
|
||||
{
|
||||
label fp2 = f.fcIndex(fp1);
|
||||
|
||||
dynFaces.append(triFace(f[0], f[fp1], f[fp2]));
|
||||
dynFaces.append(Face{f[0], f[fp1], f[fp2]});
|
||||
sizes[zoneI]++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,8 +28,8 @@ License
|
||||
#include "clock.H"
|
||||
#include "IFstream.H"
|
||||
#include "IStringStream.H"
|
||||
#include "Ostream.H"
|
||||
#include "OFstream.H"
|
||||
#include "faceTraits.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -187,7 +187,7 @@ bool Foam::fileFormats::GTSsurfaceFormat<Face>::read
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
faceLst[facei] = triFace(e0Far, common01, e1Far);
|
||||
faceLst[facei] = Face{e0Far, common01, e1Far};
|
||||
zoneIds[facei] = zoneI;
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
||||
// check if output triangulation would be required
|
||||
// It is too annoying to triangulate on-the-fly
|
||||
// just issue a warning and get out
|
||||
if (!MeshedSurface<Face>::isTri())
|
||||
if (!faceTraits<Face>::isTri())
|
||||
{
|
||||
label nNonTris = 0;
|
||||
forAll(faceLst, facei)
|
||||
@ -249,7 +249,6 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OFstream os(filename);
|
||||
if (!os.good())
|
||||
{
|
||||
@ -331,7 +330,7 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
||||
// check if output triangulation would be required
|
||||
// It is too annoying to triangulate on-the-fly
|
||||
// just issue a warning and get out
|
||||
if (!MeshedSurface<Face>::isTri())
|
||||
if (!faceTraits<Face>::isTri())
|
||||
{
|
||||
label nNonTris = 0;
|
||||
forAll(faceLst, facei)
|
||||
@ -351,7 +350,6 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OFstream os(filename);
|
||||
if (!os.good())
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "NASsurfaceFormat.H"
|
||||
#include "IFstream.H"
|
||||
#include "IStringStream.H"
|
||||
#include "faceTraits.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -191,12 +192,10 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
||||
|
||||
if (cmd == "CTRIA3")
|
||||
{
|
||||
triFace fTri;
|
||||
|
||||
label groupId = readLabel(IStringStream(line.substr(16,8))());
|
||||
fTri[0] = readLabel(IStringStream(line.substr(24,8))());
|
||||
fTri[1] = readLabel(IStringStream(line.substr(32,8))());
|
||||
fTri[2] = readLabel(IStringStream(line.substr(40,8))());
|
||||
label a = readLabel(IStringStream(line.substr(24,8))());
|
||||
label b = readLabel(IStringStream(line.substr(32,8))());
|
||||
label c = readLabel(IStringStream(line.substr(40,8))());
|
||||
|
||||
// Convert groupID into zoneId
|
||||
Map<label>::const_iterator fnd = lookup.find(groupId);
|
||||
@ -217,20 +216,17 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
||||
// Info<< "zone" << zoneI << " => group " << groupId <<endl;
|
||||
}
|
||||
|
||||
dynFaces.append(fTri);
|
||||
dynFaces.append(Face{a, b, c});
|
||||
dynZones.append(zoneI);
|
||||
dynSizes[zoneI]++;
|
||||
}
|
||||
else if (cmd == "CQUAD4")
|
||||
{
|
||||
face fQuad(4);
|
||||
labelUList& f = static_cast<labelUList&>(fQuad);
|
||||
|
||||
label groupId = readLabel(IStringStream(line.substr(16,8))());
|
||||
fQuad[0] = readLabel(IStringStream(line.substr(24,8))());
|
||||
fQuad[1] = readLabel(IStringStream(line.substr(32,8))());
|
||||
fQuad[2] = readLabel(IStringStream(line.substr(40,8))());
|
||||
fQuad[3] = readLabel(IStringStream(line.substr(48,8))());
|
||||
label a = readLabel(IStringStream(line.substr(24,8))());
|
||||
label b = readLabel(IStringStream(line.substr(32,8))());
|
||||
label c = readLabel(IStringStream(line.substr(40,8))());
|
||||
label d = readLabel(IStringStream(line.substr(48,8))());
|
||||
|
||||
// Convert groupID into zoneId
|
||||
Map<label>::const_iterator fnd = lookup.find(groupId);
|
||||
@ -251,18 +247,17 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read
|
||||
// Info<< "zone" << zoneI << " => group " << groupId <<endl;
|
||||
}
|
||||
|
||||
|
||||
if (MeshedSurface<Face>::isTri())
|
||||
if (faceTraits<Face>::isTri())
|
||||
{
|
||||
dynFaces.append(triFace(f[0], f[1], f[2]));
|
||||
dynFaces.append(triFace(f[0], f[2], f[3]));
|
||||
dynFaces.append(Face{a, b, c});
|
||||
dynFaces.append(Face{c, d, a});
|
||||
dynZones.append(zoneI);
|
||||
dynZones.append(zoneI);
|
||||
dynSizes[zoneI] += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
dynFaces.append(Face(f));
|
||||
dynFaces.append(Face{a,b,c,d});
|
||||
dynZones.append(zoneI);
|
||||
dynSizes[zoneI]++;
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,9 +27,9 @@ License
|
||||
#include "clock.H"
|
||||
#include "IFstream.H"
|
||||
#include "IStringStream.H"
|
||||
#include "Ostream.H"
|
||||
#include "OFstream.H"
|
||||
#include "ListOps.H"
|
||||
#include "faceTraits.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -172,7 +172,7 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
||||
|
||||
labelUList& f = static_cast<labelUList&>(dynVertices);
|
||||
|
||||
if (MeshedSurface<Face>::isTri() && f.size() > 3)
|
||||
if (faceTraits<Face>::isTri() && f.size() > 3)
|
||||
{
|
||||
// simple face triangulation about f[0]
|
||||
// points may be incomplete
|
||||
@ -180,7 +180,7 @@ bool Foam::fileFormats::OBJsurfaceFormat<Face>::read
|
||||
{
|
||||
label fp2 = f.fcIndex(fp1);
|
||||
|
||||
dynFaces.append(triFace(f[0], f[fp1], f[fp2]));
|
||||
dynFaces.append(Face{f[0], f[fp1], f[fp2]});
|
||||
dynZones.append(zoneI);
|
||||
dynSizes[zoneI]++;
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,7 +27,7 @@ License
|
||||
#include "clock.H"
|
||||
#include "IFstream.H"
|
||||
#include "IStringStream.H"
|
||||
#include "Ostream.H"
|
||||
#include "faceTraits.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
@ -113,9 +113,9 @@ bool Foam::fileFormats::OFFsurfaceFormat<Face>::read
|
||||
lineStream >> verts[vertI];
|
||||
}
|
||||
|
||||
labelUList& f = static_cast<labelUList&>(verts);
|
||||
const labelUList& f = static_cast<const labelUList&>(verts);
|
||||
|
||||
if (MeshedSurface<Face>::isTri() && f.size() > 3)
|
||||
if (faceTraits<Face>::isTri() && f.size() > 3)
|
||||
{
|
||||
// simple face triangulation about f[0]
|
||||
// cannot use face::triangulation (points may be incomplete)
|
||||
@ -123,7 +123,7 @@ bool Foam::fileFormats::OFFsurfaceFormat<Face>::read
|
||||
{
|
||||
label fp2 = f.fcIndex(fp1);
|
||||
|
||||
dynFaces.append(triFace(f[0], f[fp1], f[fp2]));
|
||||
dynFaces.append(Face{f[0], f[fp1], f[fp2]});
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "STARCDsurfaceFormat.H"
|
||||
#include "ListOps.H"
|
||||
#include "faceTraits.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -193,7 +194,7 @@ bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
|
||||
}
|
||||
|
||||
SubList<label> vertices(vertexLabels, vertexLabels.size());
|
||||
if (MeshedSurface<Face>::isTri() && nLabels > 3)
|
||||
if (faceTraits<Face>::isTri() && nLabels > 3)
|
||||
{
|
||||
// face needs triangulation
|
||||
face f(vertices);
|
||||
|
||||
@ -146,7 +146,7 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
|
||||
forAll(faceLst, facei)
|
||||
{
|
||||
const label startPt = 3*facei;
|
||||
faceLst[facei] = triFace(startPt, startPt+1, startPt+2);
|
||||
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -160,7 +160,7 @@ bool Foam::fileFormats::STLsurfaceFormat<Face>::read
|
||||
forAll(faceMap, facei)
|
||||
{
|
||||
const label startPt = 3*faceMap[facei];
|
||||
faceLst[facei] = triFace(startPt, startPt+1, startPt+2);
|
||||
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
|
||||
}
|
||||
}
|
||||
zoneIds.clear();
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -97,7 +97,7 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
||||
forAll(faceLst, facei)
|
||||
{
|
||||
const label startPt = 3*facei;
|
||||
faceLst[facei] = triFace(startPt, startPt+1, startPt+2);
|
||||
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -111,7 +111,7 @@ bool Foam::fileFormats::TRIsurfaceFormat<Face>::read
|
||||
forAll(faceMap, facei)
|
||||
{
|
||||
const label startPt = 3*faceMap[facei];
|
||||
faceLst[facei] = triFace(startPt, startPt+1, startPt+2);
|
||||
faceLst[facei] = Face{startPt, startPt+1, startPt+2};
|
||||
}
|
||||
}
|
||||
zoneIds.clear();
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016-2107 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "VTKsurfaceFormat.H"
|
||||
#include "vtkUnstructuredReader.H"
|
||||
#include "scalarIOField.H"
|
||||
#include "faceTraits.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -150,7 +151,7 @@ bool Foam::fileFormats::VTKsurfaceFormat<Face>::read
|
||||
|
||||
// Check if it needs triangulation
|
||||
label nTri = 0;
|
||||
if (MeshedSurface<Face>::isTri())
|
||||
if (faceTraits<Face>::isTri())
|
||||
{
|
||||
forAll(faces, facei)
|
||||
{
|
||||
@ -172,7 +173,7 @@ bool Foam::fileFormats::VTKsurfaceFormat<Face>::read
|
||||
{
|
||||
label fp2 = f.fcIndex(fp1);
|
||||
|
||||
dynFaces.append(triFace(f[0], f[fp1], f[fp2]));
|
||||
dynFaces.append(Face{f[0], f[fp1], f[fp2]});
|
||||
dynZones.append(zones[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user