updated polygon component to the cP/P behavior for access to elements
This commit is contained in:
parent
12543d68a2
commit
f3337dcb7c
|
@ -48,8 +48,8 @@ public:
|
|||
inline const int & VN() const { return _ns;}
|
||||
inline int Prev(const int & i){ return (i+(VN()-1))%VN();}
|
||||
inline int Next(const int & i){ return (i+1)%VN();}
|
||||
inline void Alloc(const int & /*ns*/){}
|
||||
inline void Dealloc(){}
|
||||
inline void Alloc(const int & /*ns*/){}
|
||||
inline void Dealloc(){}
|
||||
|
||||
// EmptyPFHAdj
|
||||
typename T::HEdgePointer &FHp(const int & ) { static typename T::HEdgePointer fp=0; assert(0); return fp; }
|
||||
|
@ -71,23 +71,23 @@ public:
|
|||
inline typename T::CoordType & P( const int /*j*/ ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||
inline const typename T::CoordType & P( const int /*j*/ ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||
inline const typename T::CoordType &cP( const int /*j*/ ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||
template <class LeftF>
|
||||
void ImportData(const LeftF & leftF) {T::ImportData(leftF);}
|
||||
static bool HasFVAdjN() { return false; }
|
||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||
template <class LeftF>
|
||||
void ImportData(const LeftF & leftF) {T::ImportData(leftF);}
|
||||
static bool HasFVAdjN() { return false; }
|
||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||
inline void Alloc(const int & /*ns*/){T::Alloc();}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
inline void Dealloc(){T::Dealloc();}
|
||||
|
||||
};
|
||||
template <class T> class PFVAdj: public T {
|
||||
public:
|
||||
typedef typename T::VertexType::CoordType CoordType;
|
||||
typedef typename T::VertexType::ScalarType ScalarType;
|
||||
typedef typename T::VertexType VertexType;
|
||||
typedef typename T::VertexType::CoordType CoordType;
|
||||
typedef typename T::VertexType::ScalarType ScalarType;
|
||||
typedef typename T::VertexType VertexType;
|
||||
|
||||
PFVAdj(){_vpoly = NULL;}
|
||||
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<this->VN()); return _vpoly[j]; }
|
||||
inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]; }
|
||||
PFVAdj(){_vpoly = NULL;}
|
||||
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<this->VN()); return _vpoly[j]; }
|
||||
inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]; }
|
||||
inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]; }
|
||||
|
||||
|
||||
|
@ -105,20 +105,16 @@ public:
|
|||
inline const VertexType * const & cV2( const int j ) const { return cV((j+2)%this->VN());}
|
||||
|
||||
// Shortcut per accedere ai punti delle facce
|
||||
inline CoordType & P( const int j ) { assert(j>=0 && j<this->VN()); return _vpoly[j]->P(); }
|
||||
inline const CoordType & P( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]->cP(); }
|
||||
inline const CoordType &cP( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]->cP(); }
|
||||
inline CoordType &P( const int j ) { assert(j>=0 && j<this->VN()); return _vpoly[j]->P(); }
|
||||
inline const CoordType cP( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]->cP(); }
|
||||
|
||||
/// Shortcut per accedere ai punti delle facce
|
||||
inline CoordType & P0( const int j ) { return V(j)->P();}
|
||||
inline CoordType & P1( const int j ) { return V((j+1)%this->VN())->P();}
|
||||
inline CoordType & P2( const int j ) { return V((j+2)%this->VN())->P();}
|
||||
inline const CoordType & P0( const int j ) const { return V(j)->P();}
|
||||
inline const CoordType & P1( const int j ) const { return V((j+1)%this->VN())->P();}
|
||||
inline const CoordType & P2( const int j ) const { return V((j+2)%this->VN())->P();}
|
||||
inline const CoordType & cP0( const int j ) const { return cV(j)->P();}
|
||||
inline const CoordType & cP1( const int j ) const { return cV((j+1)%this->VN())->P();}
|
||||
inline const CoordType & cP2( const int j ) const { return cV((j+2)%this->VN())->P();}
|
||||
inline CoordType & P0( const int j ) { return V(j)->P();}
|
||||
inline CoordType & P1( const int j ) { return V((j+1)%this->VN())->P();}
|
||||
inline CoordType & P2( const int j ) { return V((j+2)%this->VN())->P();}
|
||||
inline const CoordType cP0( const int j ) const { return cV(j)->P();}
|
||||
inline const CoordType cP1( const int j ) const { return cV((j+1)%this->VN())->P();}
|
||||
inline const CoordType cP2( const int j ) const { return cV((j+2)%this->VN())->P();}
|
||||
|
||||
template <class LeftF>
|
||||
void ImportData(const LeftF & leftF){ for(int i =0; i < this->VN(); ++i) V(i) = NULL; T::ImportData(leftF);}
|
||||
|
@ -137,17 +133,17 @@ public:
|
|||
}
|
||||
|
||||
static bool HasFVAdjacency() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("PFVAdj"));T::Name(name);}
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("PFVAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::VertexPointer *_vpoly;
|
||||
typename T::VertexPointer *_vpoly;
|
||||
};
|
||||
|
||||
/*----------------------------- PVFADJ ------------------------------*/
|
||||
template <class T> class EmptyPVFAdj: public T {
|
||||
public:
|
||||
typedef typename T::VertexType VertexType;
|
||||
typedef int VFAdjType;
|
||||
typedef int VFAdjType;
|
||||
typename T::FacePointer &VFp(const int) { static typename T::FacePointer fp=0; assert(0); return fp; }
|
||||
typename T::FacePointer cVFp(const int) const { return 0; }
|
||||
typename T::FacePointer &FFp(const int) { static typename T::FacePointer fp=0; assert(0); return fp; }
|
||||
|
@ -184,16 +180,16 @@ public:
|
|||
typename T::FacePointer const VFp(const int j) const { assert(j>=0 && j<this->VN()); return _vfpP[j]; }
|
||||
typename T::FacePointer const cVFp(const int j) const { assert(j>=0 && j<this->VN()); return _vfpP[j]; }
|
||||
char &VFi(const int j) {return _vfiP[j]; }
|
||||
template <class LeftF>
|
||||
void ImportData(const LeftF & leftF){T::ImportData(leftF);}
|
||||
inline void Alloc(const int & ns) {
|
||||
if(_vfpP == NULL){
|
||||
this->SetVN(ns);
|
||||
_vfpP = new FaceType*[this->VN()];
|
||||
_vfiP = new char[this->VN()];
|
||||
template <class LeftF>
|
||||
void ImportData(const LeftF & leftF){T::ImportData(leftF);}
|
||||
inline void Alloc(const int & ns) {
|
||||
if(_vfpP == NULL){
|
||||
this->SetVN(ns);
|
||||
_vfpP = new FaceType*[this->VN()];
|
||||
_vfiP = new char[this->VN()];
|
||||
for(int i = 0; i < this->VN(); ++i) {_vfpP[i] = 0;_vfiP[i] = -1;}
|
||||
}
|
||||
T::Alloc(ns);
|
||||
}
|
||||
T::Alloc(ns);
|
||||
|
||||
}
|
||||
unsigned int SizeNeigh(){ return this->VN();}
|
||||
|
@ -219,8 +215,8 @@ private:
|
|||
template <class T> class PFFAdj: public T {
|
||||
public:
|
||||
typedef typename T::FaceType FaceType;
|
||||
PFFAdj(){_ffpP = NULL; _ffiP = NULL; }
|
||||
typename T::FacePointer &FFp(const int j) { assert(j>=0 && j<this->VN()); return _ffpP[j]; }
|
||||
PFFAdj(){_ffpP = NULL; _ffiP = NULL; }
|
||||
typename T::FacePointer &FFp(const int j) { assert(j>=0 && j<this->VN()); return _ffpP[j]; }
|
||||
typename T::FacePointer const FFp(const int j) const { assert(j>=0 && j<this->VN()); return _ffpP[j]; }
|
||||
typename T::FacePointer const cFFp(const int j) const { assert(j>=0 && j<this->VN()); return _ffpP[j]; }
|
||||
char &FFi(const int j) { return _ffiP[j]; }
|
||||
|
@ -258,8 +254,8 @@ public:
|
|||
template <class T> class PFEAdj: public T {
|
||||
public:
|
||||
typedef typename T::EdgeType EdgeType;
|
||||
PFEAdj(){_fepP = NULL; }
|
||||
typename T::EdgePointer &FEp(const int j) { assert(j>=0 && j<this->VN()); return _fepP[j]; }
|
||||
PFEAdj(){_fepP = NULL; }
|
||||
typename T::EdgePointer &FEp(const int j) { assert(j>=0 && j<this->VN()); return _fepP[j]; }
|
||||
typename T::EdgePointer const FEp(const int j) const { assert(j>=0 && j<this->VN()); return _fepP[j]; }
|
||||
typename T::EdgePointer const cFEp(const int j) const { assert(j>=0 && j<this->VN()); return _fepP[j]; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue