mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: namespace qualifier to primitiveShapes
ENH: add constructors from UList<Point> + FixedList<label,..> - simplifies construction from edge,triFace etc.
This commit is contained in:
@ -38,6 +38,8 @@ SourceFiles
|
||||
#include "vector.H"
|
||||
#include "PointHit.H"
|
||||
#include "point2D.H"
|
||||
#include "FixedList.H"
|
||||
#include "UList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -80,6 +82,14 @@ public:
|
||||
//- Construct from two points
|
||||
inline line(const Point& start, const Point& end);
|
||||
|
||||
//- Construct from two points in the list of points
|
||||
// The indices could be from edge etc.
|
||||
inline line
|
||||
(
|
||||
const UList<Point>&,
|
||||
const FixedList<label, 2>& indices
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
inline line(Istream&);
|
||||
|
||||
|
||||
@ -25,15 +25,10 @@ License
|
||||
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline line<Point, PointRef>::line(const Point& start, const Point& end)
|
||||
inline Foam::line<Point, PointRef>::line(const Point& start, const Point& end)
|
||||
:
|
||||
a_(start),
|
||||
b_(end)
|
||||
@ -41,59 +36,65 @@ inline line<Point, PointRef>::line(const Point& start, const Point& end)
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline line<Point, PointRef>::line(Istream& is)
|
||||
inline Foam::line<Point, PointRef>::line
|
||||
(
|
||||
const UList<Point>& points,
|
||||
const FixedList<label, 2>& indices
|
||||
)
|
||||
:
|
||||
a_(points[indices[0]]),
|
||||
b_(points[indices[1]])
|
||||
{}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::line<Point, PointRef>::line(Istream& is)
|
||||
{
|
||||
// Read beginning of line point pair
|
||||
is.readBegin("line");
|
||||
|
||||
is >> a_ >> b_;
|
||||
|
||||
// Read end of line point pair
|
||||
is.readEnd("line");
|
||||
|
||||
// Check state of Istream
|
||||
is.check("line::line(Istream& is)");
|
||||
is >> *this;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline PointRef line<Point, PointRef>::start() const
|
||||
inline PointRef Foam::line<Point, PointRef>::start() const
|
||||
{
|
||||
return a_;
|
||||
}
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline PointRef line<Point, PointRef>::end() const
|
||||
inline PointRef Foam::line<Point, PointRef>::end() const
|
||||
{
|
||||
return b_;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Point line<Point, PointRef>::centre() const
|
||||
inline Point Foam::line<Point, PointRef>::centre() const
|
||||
{
|
||||
return 0.5*(a_ + b_);
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline scalar line<Point, PointRef>::mag() const
|
||||
inline Foam::scalar Foam::line<Point, PointRef>::mag() const
|
||||
{
|
||||
return ::Foam::mag(vec());
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Point line<Point, PointRef>::vec() const
|
||||
inline Point Foam::line<Point, PointRef>::vec() const
|
||||
{
|
||||
return b_ - a_;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
PointHit<Point> line<Point, PointRef>::nearestDist(const Point& p) const
|
||||
Foam::PointHit<Point> Foam::line<Point, PointRef>::nearestDist
|
||||
(
|
||||
const Point& p
|
||||
) const
|
||||
{
|
||||
Point v = vec();
|
||||
|
||||
@ -122,7 +123,7 @@ PointHit<Point> line<Point, PointRef>::nearestDist(const Point& p) const
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
scalar line<Point, PointRef>::nearestDist
|
||||
Foam::scalar Foam::line<Point, PointRef>::nearestDist
|
||||
(
|
||||
const line<Point, const Point&>& edge,
|
||||
Point& thisPt,
|
||||
@ -259,33 +260,34 @@ scalar line<Point, PointRef>::nearestDist
|
||||
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Istream& operator>>(Istream& is, line<Point, PointRef>& l)
|
||||
inline Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
line<Point, PointRef>& l
|
||||
)
|
||||
{
|
||||
// Read beginning of line point pair
|
||||
is.readBegin("line");
|
||||
|
||||
is >> l.a_ >> l.b_;
|
||||
|
||||
// Read end of line point pair
|
||||
is >> l.a_ >> l.b_;
|
||||
is.readEnd("line");
|
||||
|
||||
// Check state of Ostream
|
||||
is.check("Istream& operator>>(Istream&, line&)");
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Ostream& operator<<(Ostream& os, const line<Point, PointRef>& l)
|
||||
inline Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const line<Point, PointRef>& l
|
||||
)
|
||||
{
|
||||
os << token::BEGIN_LIST << l.a_ << token::SPACE << l.b_ << token::END_LIST;
|
||||
os << token::BEGIN_LIST
|
||||
<< l.a_ << token::SPACE
|
||||
<< l.b_
|
||||
<< token::END_LIST;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -27,15 +27,10 @@ Description
|
||||
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Point, class PointRef, class polygonRef>
|
||||
inline pyramid<Point, PointRef, polygonRef>::pyramid
|
||||
inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid
|
||||
(
|
||||
polygonRef base,
|
||||
const Point& apex
|
||||
@ -47,30 +42,30 @@ inline pyramid<Point, PointRef, polygonRef>::pyramid
|
||||
|
||||
|
||||
template<class Point, class PointRef, class polygonRef>
|
||||
inline pyramid<Point, PointRef, polygonRef>::pyramid(Istream& is)
|
||||
inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid(Istream& is)
|
||||
{
|
||||
is >> base_ >> apex_;
|
||||
is.check("pyramid::pyramid(Istream& is)");
|
||||
is.check("pyramid::pyramid(Istream&)");
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Point, class PointRef, class polygonRef>
|
||||
inline const Point& pyramid<Point, PointRef, polygonRef>::apex() const
|
||||
inline const Point& Foam::pyramid<Point, PointRef, polygonRef>::apex() const
|
||||
{
|
||||
return apex_;
|
||||
}
|
||||
|
||||
template<class Point, class PointRef, class polygonRef>
|
||||
inline polygonRef pyramid<Point, PointRef, polygonRef>::base() const
|
||||
inline polygonRef Foam::pyramid<Point, PointRef, polygonRef>::base() const
|
||||
{
|
||||
return base_;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef, class polygonRef>
|
||||
inline Point pyramid<Point, PointRef, polygonRef>::centre
|
||||
inline Point Foam::pyramid<Point, PointRef, polygonRef>::centre
|
||||
(
|
||||
const pointField& points
|
||||
) const
|
||||
@ -80,7 +75,7 @@ inline Point pyramid<Point, PointRef, polygonRef>::centre
|
||||
|
||||
|
||||
template<class Point, class PointRef, class polygonRef>
|
||||
inline vector pyramid<Point, PointRef, polygonRef>::height
|
||||
inline Foam::vector Foam::pyramid<Point, PointRef, polygonRef>::height
|
||||
(
|
||||
const pointField& points
|
||||
) const
|
||||
@ -91,7 +86,7 @@ inline vector pyramid<Point, PointRef, polygonRef>::height
|
||||
|
||||
|
||||
template<class Point, class PointRef, class polygonRef>
|
||||
inline scalar pyramid<Point, PointRef, polygonRef>::mag
|
||||
inline Foam::scalar Foam::pyramid<Point, PointRef, polygonRef>::mag
|
||||
(
|
||||
const pointField& points
|
||||
) const
|
||||
@ -103,32 +98,28 @@ inline scalar pyramid<Point, PointRef, polygonRef>::mag
|
||||
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Point, class PointRef, class polygonRef>
|
||||
inline Istream& operator>>
|
||||
inline Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
pyramid<Point, PointRef, polygonRef>& p
|
||||
)
|
||||
{
|
||||
is >> p.base_ >> p.apex_;
|
||||
is >> p.base_ >> p.apex_;
|
||||
is.check("Istream& operator>>(Istream&, pyramid&)");
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef, class polygonRef>
|
||||
inline Ostream& operator<<
|
||||
inline Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const pyramid<Point, PointRef, polygonRef>& p
|
||||
)
|
||||
{
|
||||
os << p.base_ << tab << p.apex_ << nl;
|
||||
os << p.base_ << tab << p.apex_ << nl;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -43,6 +43,8 @@ SourceFiles
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "pointHit.H"
|
||||
#include "Random.H"
|
||||
#include "FixedList.H"
|
||||
#include "UList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -105,6 +107,13 @@ public:
|
||||
const Point& d
|
||||
);
|
||||
|
||||
//- Construct from four points in the list of points
|
||||
inline tetrahedron
|
||||
(
|
||||
const UList<Point>&,
|
||||
const FixedList<label, 4>& indices
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
inline tetrahedron(Istream&);
|
||||
|
||||
|
||||
@ -21,22 +21,15 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "triangle.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline tetrahedron<Point, PointRef>::tetrahedron
|
||||
inline Foam::tetrahedron<Point, PointRef>::tetrahedron
|
||||
(
|
||||
const Point& a,
|
||||
const Point& b,
|
||||
@ -52,95 +45,100 @@ inline tetrahedron<Point, PointRef>::tetrahedron
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline tetrahedron<Point, PointRef>::tetrahedron(Istream& is)
|
||||
inline Foam::tetrahedron<Point, PointRef>::tetrahedron
|
||||
(
|
||||
const UList<Point>& points,
|
||||
const FixedList<label, 4>& indices
|
||||
)
|
||||
:
|
||||
a_(points[indices[0]]),
|
||||
b_(points[indices[1]]),
|
||||
c_(points[indices[2]]),
|
||||
d_(points[indices[3]])
|
||||
{}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::tetrahedron<Point, PointRef>::tetrahedron(Istream& is)
|
||||
{
|
||||
// Read beginning of tetrahedron point pair
|
||||
is.readBegin("tetrahedron");
|
||||
|
||||
is >> a_ >> b_ >> c_ >> d_;
|
||||
|
||||
// Read end of tetrahedron point pair
|
||||
is.readEnd("tetrahedron");
|
||||
|
||||
// Check state of Istream
|
||||
is.check("tetrahedron::tetrahedron(Istream& is)");
|
||||
is >> *this;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline const Point& tetrahedron<Point, PointRef>::a() const
|
||||
inline const Point& Foam::tetrahedron<Point, PointRef>::a() const
|
||||
{
|
||||
return a_;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline const Point& tetrahedron<Point, PointRef>::b() const
|
||||
inline const Point& Foam::tetrahedron<Point, PointRef>::b() const
|
||||
{
|
||||
return b_;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline const Point& tetrahedron<Point, PointRef>::c() const
|
||||
inline const Point& Foam::tetrahedron<Point, PointRef>::c() const
|
||||
{
|
||||
return c_;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline const Point& tetrahedron<Point, PointRef>::d() const
|
||||
inline const Point& Foam::tetrahedron<Point, PointRef>::d() const
|
||||
{
|
||||
return d_;
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline vector tetrahedron<Point, PointRef>::Sa() const
|
||||
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sa() const
|
||||
{
|
||||
return triangle<Point, PointRef>(b_, c_, d_).normal();
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline vector tetrahedron<Point, PointRef>::Sb() const
|
||||
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sb() const
|
||||
{
|
||||
return triangle<Point, PointRef>(a_, d_, c_).normal();
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline vector tetrahedron<Point, PointRef>::Sc() const
|
||||
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sc() const
|
||||
{
|
||||
return triangle<Point, PointRef>(a_, b_, d_).normal();
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline vector tetrahedron<Point, PointRef>::Sd() const
|
||||
inline Foam::vector Foam::tetrahedron<Point, PointRef>::Sd() const
|
||||
{
|
||||
return triangle<Point, PointRef>(a_, c_, b_).normal();
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Point tetrahedron<Point, PointRef>::centre() const
|
||||
inline Point Foam::tetrahedron<Point, PointRef>::centre() const
|
||||
{
|
||||
return 0.25*(a_ + b_ + c_ + d_);
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline scalar tetrahedron<Point, PointRef>::mag() const
|
||||
inline Foam::scalar Foam::tetrahedron<Point, PointRef>::mag() const
|
||||
{
|
||||
return (1.0/6.0)*(((b_ - a_) ^ (c_ - a_)) & (d_ - a_));
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Point tetrahedron<Point, PointRef>::circumCentre() const
|
||||
inline Point Foam::tetrahedron<Point, PointRef>::circumCentre() const
|
||||
{
|
||||
vector a = b_ - a_;
|
||||
vector b = c_ - a_;
|
||||
@ -157,14 +155,14 @@ inline Point tetrahedron<Point, PointRef>::circumCentre() const
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline scalar tetrahedron<Point, PointRef>::circumRadius() const
|
||||
inline Foam::scalar Foam::tetrahedron<Point, PointRef>::circumRadius() const
|
||||
{
|
||||
return Foam::mag(a_ - circumCentre());
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline scalar tetrahedron<Point, PointRef>::quality() const
|
||||
inline Foam::scalar Foam::tetrahedron<Point, PointRef>::quality() const
|
||||
{
|
||||
// Note: 8/(9*sqrt(3)) = 0.5132002393
|
||||
|
||||
@ -173,7 +171,10 @@ inline scalar tetrahedron<Point, PointRef>::quality() const
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Point tetrahedron<Point, PointRef>::randomPoint(Random& rndGen) const
|
||||
inline Point Foam::tetrahedron<Point, PointRef>::randomPoint
|
||||
(
|
||||
Random& rndGen
|
||||
) const
|
||||
{
|
||||
// Adapted from
|
||||
// http://vcg.isti.cnr.it/activities/geometryegraphics/pointintetraedro.html
|
||||
@ -206,7 +207,7 @@ inline Point tetrahedron<Point, PointRef>::randomPoint(Random& rndGen) const
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
scalar tetrahedron<Point, PointRef>::barycentric
|
||||
Foam::scalar Foam::tetrahedron<Point, PointRef>::barycentric
|
||||
(
|
||||
const point& pt,
|
||||
List<scalar>& bary
|
||||
@ -259,7 +260,7 @@ scalar tetrahedron<Point, PointRef>::barycentric
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline pointHit tetrahedron<Point, PointRef>::nearestPoint
|
||||
inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
|
||||
(
|
||||
const point& p
|
||||
) const
|
||||
@ -355,18 +356,17 @@ inline pointHit tetrahedron<Point, PointRef>::nearestPoint
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class point, class pointRef>
|
||||
inline Istream& operator>>(Istream& is, tetrahedron<point, pointRef>& t)
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
tetrahedron<Point, PointRef>& t
|
||||
)
|
||||
{
|
||||
// Read beginning of tetrahedron point pair
|
||||
is.readBegin("tetrahedron");
|
||||
|
||||
is >> t.a_ >> t.b_ >> t.c_ >> t.d_;
|
||||
|
||||
// Read end of tetrahedron point pair
|
||||
is >> t.a_ >> t.b_ >> t.c_ >> t.d_;
|
||||
is.readEnd("tetrahedron");
|
||||
|
||||
// Check state of Ostream
|
||||
is.check("Istream& operator>>(Istream&, tetrahedron&)");
|
||||
|
||||
return is;
|
||||
@ -374,20 +374,22 @@ inline Istream& operator>>(Istream& is, tetrahedron<point, pointRef>& t)
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Ostream& operator<<(Ostream& os, const tetrahedron<Point, PointRef>& t)
|
||||
inline Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const tetrahedron<Point, PointRef>& t
|
||||
)
|
||||
{
|
||||
os << nl
|
||||
<< token::BEGIN_LIST
|
||||
<< t.a_ << token::SPACE << t.b_
|
||||
<< token::SPACE << t.c_ << token::SPACE << t.d_
|
||||
<< t.a_ << token::SPACE
|
||||
<< t.b_ << token::SPACE
|
||||
<< t.c_ << token::SPACE
|
||||
<< t.d_
|
||||
<< token::END_LIST;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -40,6 +40,8 @@ SourceFiles
|
||||
#include "tensor.H"
|
||||
#include "pointHit.H"
|
||||
#include "Random.H"
|
||||
#include "FixedList.H"
|
||||
#include "UList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -96,6 +98,14 @@ public:
|
||||
//- Construct from three points
|
||||
inline triangle(const Point& a, const Point& b, const Point& c);
|
||||
|
||||
//- Construct from three points in the list of points
|
||||
// The indices could be from triFace etc.
|
||||
inline triangle
|
||||
(
|
||||
const UList<Point>&,
|
||||
const FixedList<label, 3>& indices
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
inline triangle(Istream&);
|
||||
|
||||
|
||||
@ -43,19 +43,24 @@ inline Foam::triangle<Point, PointRef>::triangle
|
||||
{}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::triangle<Point, PointRef>::triangle
|
||||
(
|
||||
const UList<Point>& points,
|
||||
const FixedList<label, 3>& indices
|
||||
)
|
||||
:
|
||||
a_(points[indices[0]]),
|
||||
b_(points[indices[1]]),
|
||||
c_(points[indices[2]])
|
||||
{}
|
||||
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::triangle<Point, PointRef>::triangle(Istream& is)
|
||||
{
|
||||
// Read beginning of triangle point pair
|
||||
is.readBegin("triangle");
|
||||
|
||||
is >> a_ >> b_ >> c_;
|
||||
|
||||
// Read end of triangle point pair
|
||||
is.readEnd("triangle");
|
||||
|
||||
// Check state of Istream
|
||||
is.check("triangle::triangle(Istream& is)");
|
||||
is >> *this;
|
||||
}
|
||||
|
||||
|
||||
@ -620,23 +625,18 @@ inline bool Foam::triangle<Point, PointRef>::classify
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class point, class pointRef>
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is, triangle<point, pointRef>& t
|
||||
Istream& is,
|
||||
triangle<Point, PointRef>& t
|
||||
)
|
||||
{
|
||||
// Read beginning of triangle point pair
|
||||
is.readBegin("triangle");
|
||||
|
||||
is >> t.a_ >> t.b_ >> t.c_;
|
||||
|
||||
// Read end of triangle point pair
|
||||
is >> t.a_ >> t.b_ >> t.c_;
|
||||
is.readEnd("triangle");
|
||||
|
||||
// Check state of Ostream
|
||||
is.check("Istream& operator>>(Istream&, triangle&)");
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
@ -650,7 +650,9 @@ inline Foam::Ostream& Foam::operator<<
|
||||
{
|
||||
os << nl
|
||||
<< token::BEGIN_LIST
|
||||
<< t.a_ << token::SPACE << t.b_ << token::SPACE << t.c_
|
||||
<< t.a_ << token::SPACE
|
||||
<< t.b_ << token::SPACE
|
||||
<< t.c_
|
||||
<< token::END_LIST;
|
||||
|
||||
return os;
|
||||
|
||||
Reference in New Issue
Block a user