STYLE: cv2DMesh: Moved inline function definitions into separate header files.

This commit is contained in:
laurence 2011-12-12 14:37:38 +00:00
parent e20b4b5c5e
commit 40fda4f99d
4 changed files with 470 additions and 201 deletions

View File

@ -46,7 +46,7 @@ namespace CGAL
\*---------------------------------------------------------------------------*/
template<class Gt, class Fb=CGAL::Triangulation_face_base_2<Gt> >
class indexedFace
class indexedFace
:
public Fb
{
@ -78,61 +78,45 @@ public:
};
indexedFace()
:
Fb(),
index_(CHANGED)
{}
// Constructors
indexedFace(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2)
:
Fb(v0, v1, v2),
index_(CHANGED)
{}
inline indexedFace();
indexedFace
(
Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2,
Face_handle n0,
Face_handle n1,
Face_handle n2
)
:
Fb(v0, v1, v2, n0, n1, n2),
index_(CHANGED)
{}
inline indexedFace
(
Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2
);
inline indexedFace
(
Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2,
Face_handle n0,
Face_handle n1,
Face_handle n2
);
void set_vertex(int i, Vertex_handle v)
{
index_ = CHANGED;
Fb::set_vertex(i, v);
}
// Member Functions
void set_vertices()
{
index_ = CHANGED;
Fb::set_vertices();
}
inline void set_vertex(int i, Vertex_handle v);
void set_vertices(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2)
{
index_ = CHANGED;
Fb::set_vertices(v0, v1, v2);
}
inline void set_vertices();
inline void set_vertices
(
Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2
);
int& faceIndex()
{
return index_;
}
inline int& faceIndex();
inline int faceIndex() const;
int faceIndex() const
{
return index_;
}
};
@ -142,6 +126,10 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "indexedFaceI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Gt, class Fb>
inline CGAL::indexedFace<Gt, Fb>::indexedFace()
:
Fb(),
index_(CHANGED)
{}
template<class Gt, class Fb>
inline CGAL::indexedFace<Gt, Fb>::indexedFace
(
Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2
)
:
Fb(v0, v1, v2),
index_(CHANGED)
{}
template<class Gt, class Fb>
inline CGAL::indexedFace<Gt, Fb>::indexedFace
(
Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2,
Face_handle n0,
Face_handle n1,
Face_handle n2
)
:
Fb(v0, v1, v2, n0, n1, n2),
index_(CHANGED)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Gt, class Fb>
inline void CGAL::indexedFace<Gt, Fb>::set_vertex(int i, Vertex_handle v)
{
index_ = CHANGED;
Fb::set_vertex(i, v);
}
template<class Gt, class Fb>
inline void CGAL::indexedFace<Gt, Fb>::set_vertices()
{
index_ = CHANGED;
Fb::set_vertices();
}
template<class Gt, class Fb>
inline void CGAL::indexedFace<Gt, Fb>::set_vertices
(
Vertex_handle v0,
Vertex_handle v1,
Vertex_handle v2
)
{
index_ = CHANGED;
Fb::set_vertices(v0, v1, v2);
}
template<class Gt, class Fb>
inline int& CGAL::indexedFace<Gt, Fb>::faceIndex()
{
return index_;
}
template<class Gt, class Fb>
inline int CGAL::indexedFace<Gt, Fb>::faceIndex() const
{
return index_;
}

View File

@ -40,6 +40,34 @@ Description
namespace CGAL
{
// Forward declaration of friend functions and operators
template<class Gt, class Vb>
class indexedVertex;
template<class Gt, class Vb>
bool pointPair
(
const indexedVertex<Gt, Vb>& v0,
const indexedVertex<Gt, Vb>& v1
);
template<class Gt, class Vb>
bool boundaryTriangle
(
const indexedVertex<Gt, Vb>& v0,
const indexedVertex<Gt, Vb>& v1,
const indexedVertex<Gt, Vb>& v2
);
template<class Gt, class Vb>
bool outsideTriangle
(
const indexedVertex<Gt, Vb>& v0,
const indexedVertex<Gt, Vb>& v1,
const indexedVertex<Gt, Vb>& v2
);
/*---------------------------------------------------------------------------*\
Class indexedVertex Declaration
\*---------------------------------------------------------------------------*/
@ -85,173 +113,85 @@ public:
};
indexedVertex()
:
Vb(),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT)
{}
// Constructors
indexedVertex(const Point& p)
:
Vb(p),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT)
{}
inline indexedVertex();
indexedVertex(const Point& p, const int index, const int& type)
:
Vb(p),
index_(index),
type_(type)
{}
inline indexedVertex(const Point& p);
indexedVertex(const Point& p, Face_handle f)
:
Vb(f, p),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT)
{}
inline indexedVertex(const Point& p, const int index, const int& type);
indexedVertex(Face_handle f)
:
Vb(f),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT)
{}
inline indexedVertex(const Point& p, Face_handle f);
inline indexedVertex(Face_handle f);
int& index()
{
return index_;
}
// Member Functions
int index() const
{
return index_;
}
inline int& index();
inline int index() const;
inline int& type();
inline int type() const;
//- Is point a far-point
inline bool farPoint() const;
//- Is point internal, i.e. not on boundary
inline bool internalPoint() const;
//- Is point internal and near the boundary
inline bool nearBoundary() const;
//- Set the point to be near the boundary
inline void setNearBoundary();
//- Is point a mirror point
inline bool mirrorPoint() const;
//- Either master or slave of pointPair.
inline bool pairPoint() const;
//- Master of a pointPair is the lowest numbered one.
inline bool ppMaster() const;
//- Slave of a pointPair is the highest numbered one.
inline bool ppSlave() const;
//- Either original internal point or master of pointPair.
inline bool internalOrBoundaryPoint() const;
//- Is point near the boundary or part of the boundary definition
inline bool nearOrOnBoundary() const;
int& type()
{
return type_;
}
// Friend Functions
int type() const
{
return type_;
}
//- Do the two given vertices consitute a boundary point-pair
friend bool pointPair <Gt, Vb>
(
const indexedVertex<Gt, Vb>& v0,
const indexedVertex<Gt, Vb>& v1
);
//- Do the three given vertices consitute a boundary triangle
friend bool boundaryTriangle <Gt, Vb>
(
const indexedVertex<Gt, Vb>& v0,
const indexedVertex<Gt, Vb>& v1,
const indexedVertex<Gt, Vb>& v2
);
//- Is point a far-point
inline bool farPoint() const
{
return type_ == FAR_POINT;
}
//- Do the three given vertices consitute an outside triangle
friend bool outsideTriangle <Gt, Vb>
(
const indexedVertex<Gt, Vb>& v0,
const indexedVertex<Gt, Vb>& v1,
const indexedVertex<Gt, Vb>& v2
);
//- Is point internal, i.e. not on boundary
inline bool internalPoint() const
{
return type_ <= INTERNAL_POINT;
}
//- Is point internal and near the boundary
inline bool nearBoundary() const
{
return type_ == NEAR_BOUNDARY_POINT;
}
//- Set the point to be near the boundary
inline void setNearBoundary()
{
type_ = NEAR_BOUNDARY_POINT;
}
//- Is point a mirror point
inline bool mirrorPoint() const
{
return type_ == MIRROR_POINT;
}
//- Either master or slave of pointPair.
inline bool pairPoint() const
{
return type_ >= 0;
}
//- Master of a pointPair is the lowest numbered one.
inline bool ppMaster() const
{
if (type_ > index_)
{
return true;
}
else
{
return false;
}
}
//- Slave of a pointPair is the highest numbered one.
inline bool ppSlave() const
{
if (type_ >= 0 && type_ < index_)
{
return true;
}
else
{
return false;
}
}
//- Either original internal point or master of pointPair.
inline bool internalOrBoundaryPoint() const
{
return internalPoint() || ppMaster();
}
//- Is point near the boundary or part of the boundary definition
inline bool nearOrOnBoundary() const
{
return pairPoint() || mirrorPoint() || nearBoundary();
}
//- Do the two given vertices consitute a boundary point-pair
inline friend bool pointPair
(
const indexedVertex& v0,
const indexedVertex& v1
)
{
return v0.index_ == v1.type_ || v1.index_ == v0.type_;
}
//- Do the three given vertices consitute a boundary triangle
inline friend bool boundaryTriangle
(
const indexedVertex& v0,
const indexedVertex& v1,
const indexedVertex& v2
)
{
return (v0.pairPoint() && pointPair(v1, v2))
|| (v1.pairPoint() && pointPair(v2, v0))
|| (v2.pairPoint() && pointPair(v0, v1));
}
//- Do the three given vertices consitute an outside triangle
inline friend bool outsideTriangle
(
const indexedVertex& v0,
const indexedVertex& v1,
const indexedVertex& v2
)
{
return (v0.farPoint() || v0.ppSlave())
|| (v1.farPoint() || v1.ppSlave())
|| (v2.farPoint() || v2.ppSlave());
}
};
@ -259,6 +199,9 @@ public:
} // End namespace CGAL
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "indexedVertexI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,230 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Gt, class Vb>
inline CGAL::indexedVertex<Gt, Vb>::indexedVertex()
:
Vb(),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT)
{}
template<class Gt, class Vb>
inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(const Point& p)
:
Vb(p),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT)
{}
template<class Gt, class Vb>
inline CGAL::indexedVertex<Gt, Vb>::indexedVertex
(
const Point& p,
const int index,
const int& type
)
:
Vb(p),
index_(index),
type_(type)
{}
template<class Gt, class Vb>
inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(const Point& p, Face_handle f)
:
Vb(f, p),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT)
{}
template<class Gt, class Vb>
inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(Face_handle f)
:
Vb(f),
index_(INTERNAL_POINT),
type_(INTERNAL_POINT)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Gt, class Vb>
inline int& CGAL::indexedVertex<Gt, Vb>::index()
{
return index_;
}
template<class Gt, class Vb>
inline int CGAL::indexedVertex<Gt, Vb>::index() const
{
return index_;
}
template<class Gt, class Vb>
inline int& CGAL::indexedVertex<Gt, Vb>::type()
{
return type_;
}
template<class Gt, class Vb>
inline int CGAL::indexedVertex<Gt, Vb>::type() const
{
return type_;
}
template<class Gt, class Vb>
inline bool CGAL::indexedVertex<Gt, Vb>::farPoint() const
{
return type_ == FAR_POINT;
}
template<class Gt, class Vb>
inline bool CGAL::indexedVertex<Gt, Vb>::internalPoint() const
{
return type_ <= INTERNAL_POINT;
}
template<class Gt, class Vb>
inline bool CGAL::indexedVertex<Gt, Vb>::nearBoundary() const
{
return type_ == NEAR_BOUNDARY_POINT;
}
template<class Gt, class Vb>
inline void CGAL::indexedVertex<Gt, Vb>::setNearBoundary()
{
type_ = NEAR_BOUNDARY_POINT;
}
template<class Gt, class Vb>
inline bool CGAL::indexedVertex<Gt, Vb>::mirrorPoint() const
{
return type_ == MIRROR_POINT;
}
template<class Gt, class Vb>
inline bool CGAL::indexedVertex<Gt, Vb>::pairPoint() const
{
return type_ >= 0;
}
template<class Gt, class Vb>
inline bool CGAL::indexedVertex<Gt, Vb>::ppMaster() const
{
if (type_ > index_)
{
return true;
}
else
{
return false;
}
}
template<class Gt, class Vb>
inline bool CGAL::indexedVertex<Gt, Vb>::ppSlave() const
{
if (type_ >= 0 && type_ < index_)
{
return true;
}
else
{
return false;
}
}
template<class Gt, class Vb>
inline bool CGAL::indexedVertex<Gt, Vb>::internalOrBoundaryPoint() const
{
return internalPoint() || ppMaster();
}
template<class Gt, class Vb>
inline bool CGAL::indexedVertex<Gt, Vb>::nearOrOnBoundary() const
{
return pairPoint() || mirrorPoint() || nearBoundary();
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
template<class Gt, class Vb>
bool CGAL::pointPair
(
const indexedVertex<Gt, Vb>& v0,
const indexedVertex<Gt, Vb>& v1
)
{
return v0.index_ == v1.type_ || v1.index_ == v0.type_;
}
template<class Gt, class Vb>
bool CGAL::boundaryTriangle
(
const indexedVertex<Gt, Vb>& v0,
const indexedVertex<Gt, Vb>& v1,
const indexedVertex<Gt, Vb>& v2
)
{
return (v0.pairPoint() && pointPair(v1, v2))
|| (v1.pairPoint() && pointPair(v2, v0))
|| (v2.pairPoint() && pointPair(v0, v1));
}
template<class Gt, class Vb>
bool CGAL::outsideTriangle
(
const indexedVertex<Gt, Vb>& v0,
const indexedVertex<Gt, Vb>& v1,
const indexedVertex<Gt, Vb>& v2
)
{
return (v0.farPoint() || v0.ppSlave())
|| (v1.farPoint() || v1.ppSlave())
|| (v2.farPoint() || v2.ppSlave());
}