vtf-logo

VertexSimplexInc.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00008 #if !defined(__geom_VertexSimplexInc_h__)
00009 #define __geom_VertexSimplexInc_h__
00010 
00011 #if defined(DEBUG_geom) && !defined(DEBUG_VertexSimplexInc)
00012 #define DEBUG_VertexSimplexInc
00013 #endif
00014 
00015 #include "../../defs.h"
00016 
00017 #include "../../../ads/array/StaticArrayOfArrays.h"
00018 
00019 #include <vector>
00020 #include <iosfwd>
00021 
00022 BEGIN_NAMESPACE_GEOM
00023 
00025 
00031 template<int M>
00032 class VertexSimplexInc {
00033   //
00034   // Private types.
00035   //
00036 
00037 private:
00038 
00040   typedef ads::StaticArrayOfArrays<int> IncidenceContainer;
00042   typedef typename IncidenceContainer::iterator Iterator;
00043 
00044   //
00045   // Public types.
00046   //
00047 
00048 public:
00049 
00051   typedef typename IncidenceContainer::const_iterator ConstIterator;
00053   typedef typename IncidenceContainer::size_type SizeType;
00054 
00055   //
00056   // Data
00057   //
00058 
00059 private:
00060 
00061   // The array of vertex-simplex incidences.
00062   IncidenceContainer _inc;
00063 
00064 public:
00065 
00066   //--------------------------------------------------------------------------
00068   // @{
00069 
00071   VertexSimplexInc() :
00072     _inc()
00073   {}
00074 
00076 
00079   template<typename IndexedSimplex, bool A>
00080   VertexSimplexInc(const int numVertices,
00081                    const ads::Array<1,IndexedSimplex,A>& simplices) :
00082     _inc() {
00083     build(numVertices, simplices);
00084   }
00085 
00087   template<typename IndexedSimplex, bool A>
00088   void
00089   build(const int numVertices,
00090         const ads::Array<1,IndexedSimplex,A>& simplices);
00091 
00093   VertexSimplexInc(const VertexSimplexInc& other) :
00094     _inc(other._inc)
00095   {}
00096 
00098   VertexSimplexInc& 
00099   operator=(const VertexSimplexInc& other) {
00100     if (this != &other) {
00101       _inc = other._inc;
00102     }
00103     return *this;
00104   }
00105   
00107   void
00108   swap(VertexSimplexInc& x) {
00109     _inc.swap(x._inc);
00110   }
00111 
00113   ~VertexSimplexInc()
00114   {}
00115 
00116   // @}
00117   //--------------------------------------------------------------------------
00119   // @{
00120 
00122   SizeType
00123   getNumVertices() const {
00124     return _inc.getNumberOfArrays();
00125   }
00126 
00128   SizeType
00129   getSize() const {
00130     return _inc.size();
00131   }
00132 
00134   bool 
00135   isEmpty() const { 
00136     return _inc.empty();
00137   }
00138 
00140   SizeType
00141   getMaxSize() const { 
00142     return _inc.max_size();
00143   }
00144 
00146   SizeType 
00147   getMemoryUsage() const {
00148     return _inc.getMemoryUsage();
00149   }
00150 
00152   ConstIterator
00153   getBeginning() const { 
00154     return _inc.begin();
00155   }
00156 
00158   ConstIterator 
00159   getEnd() const { 
00160     return _inc.end();
00161   }
00162 
00163   // @}
00164   //--------------------------------------------------------------------------
00166   // @{
00167 
00169   SizeType
00170   getSize(const int n) const {
00171     return _inc.size(n);
00172   }
00173 
00175   bool 
00176   isEmpty(const int n) const { 
00177     return _inc.empty(n);
00178   }
00179 
00181   ConstIterator 
00182   getBeginning(const int n) const { 
00183     return _inc.begin(n);
00184   }
00185 
00187   ConstIterator 
00188   getEnd(const int n) const { 
00189     return _inc.end(n);
00190   }
00191 
00193   ConstIterator
00194   operator[](const int n) const {
00195     return _inc[n];
00196   }
00197 
00199   ConstIterator
00200   operator()(const int n) const {
00201     return _inc(n);
00202   }
00203 
00205   int
00206   operator()(const int n, const int m) const {
00207     return _inc(n, m);
00208   }
00209 
00210   // @}
00211   //--------------------------------------------------------------------------
00213   // @{
00214 
00216   void
00217   clear() {
00218     _inc.clear();
00219   }
00220 
00221   // @}
00222   //--------------------------------------------------------------------------
00224 
00225 
00227   bool
00228   operator==(const VertexSimplexInc& x) const {
00229     return _inc == x._inc;
00230   }
00231 
00233   bool
00234   operator!=(const VertexSimplexInc& x) const {
00235     return ! operator==(x);
00236   }
00237 
00238   // @}
00239   //--------------------------------------------------------------------------
00241 
00242 
00244   void
00245   put(std::ostream& out) const {
00246     out << _inc;
00247   }
00248 
00250 };
00251 
00252 //
00253 // File output.
00254 //
00255 
00257 template<int M>
00258 std::ostream&
00259 operator<<(std::ostream& out, const VertexSimplexInc<M>& x);
00260 
00261 END_NAMESPACE_GEOM
00262 
00263 #define __geom_VertexSimplexInc_ipp__
00264 #include "VertexSimplexInc.ipp"
00265 #undef __geom_VertexSimplexInc_ipp__
00266 
00267 #endif

Generated on Fri Aug 24 12:55:59 2007 for Computational Geometry Package by  doxygen 1.4.7