SkeletonID.hpp

00001 
00002 //
00003 // $Id: SkeletonID.hpp,v 1.4 2008/04/09 01:54:30 werner Exp $
00004 //
00006 #ifndef __FIBER_SKELETONID_HPP
00007 #define __FIBER_SKELETONID_HPP "Created 27.02.2001 21:42:27 by werner"
00008 
00009 #include "GridAPI.h"
00010 #include <field/Field.hpp>
00011 #include <memcore/TypeInfo.hpp>
00012 #include <set>
00013 #include <list>
00014 
00015 #include "FieldID.hpp"
00016 #include "FiberSpace.hpp"
00017 #include "Transformation.hpp"
00018 #include "Representation.hpp"
00019 #include "Chart.hpp"
00020 #include "Skeleton.hpp"
00021 
00022 namespace Fiber
00023 {
00024         using MemCore::WeakPtr;
00025         using MemCore::NullPtr;
00026         using std::set;
00027         using std::list;
00028 
00034 class   GRID_API SkeletonID
00035 {
00036         int     index_depth;
00037         DynamicSize domainsize;
00038         DynamicSize refinement;
00039 
00040 public: 
00044         SkeletonID(int dimension, int index_depth=0); 
00045 
00047         ~SkeletonID(); 
00048 
00050         bool operator<(const SkeletonID&S) const; 
00051 
00053         int     IndexDepth() const
00054         {
00055                 return index_depth;
00056         } 
00057 
00059         unsigned Dims() const
00060         {
00061                 return domainsize.size();
00062         }
00063 
00064         index_t Refinement(unsigned int i) const
00065         {
00066                 return refinement[i];
00067         }
00068 
00069         bool    isLevel(index_t L) const
00070         {
00071                 for(int i=0; i<refinement.size(); i++)
00072                 {
00073                         if (refinement[i] != L)
00074                                 return false;
00075                 } 
00076                 return true;
00077         } 
00078 
00085         index_t getHomogeneousLevel() const
00086         {
00087                 if (refinement.size()<1)
00088                         return 0;
00089 
00090         index_t L = refinement[0];
00091                 for(int i=1; i<refinement.size(); i++)
00092                 {
00093                         if (refinement[i] != L)
00094                                 return -i;
00095                 } 
00096                 return L;
00097         }
00098 
00099         unsigned Size(unsigned i) const
00100         {
00101                 return domainsize[i];
00102         }
00103 
00104         bool setSize(unsigned i, index_t extension)
00105         {
00106                 return domainsize.setSize( i, extension);
00107         }
00108 
00109         bool setRefinement(unsigned i, index_t extension)
00110         {
00111                 return refinement.setSize( i, extension);
00112         } 
00113 
00114 
00118         string Name() const;
00119 };
00120 
00124 class   GRID_API SkeletonIterator
00125 {
00126 public:
00127         virtual ~SkeletonIterator();
00128 
00129         virtual bool apply(const SkeletonID&id, const Skeleton&S) = 0;
00130 };
00131 
00132 
00133 } /* namespace Fiber */ 
00134 
00135 #endif /* __FIBER_SKELETONID_HPP */