Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

model/topos/SMeshN.h

Go to the documentation of this file.
00001 /* #start# ***********************************************************
00002 
00003            Scheduling Simulator
00004         Lehrstuhl f"ur Effiziente Algorithmen
00005            Technische Universit"at M"unchen
00006 
00007  File    : $Id: SMeshN.h,v 1.5 2003/01/08 18:57:14 meierb Exp $
00008 
00009  Purpose : 
00010 
00011  RCS-Log:
00012  $Log: SMeshN.h,v $
00013  Revision 1.5  2003/01/08 18:57:14  meierb
00014  added randomized release times
00015 
00016  Revision 1.1.1.1  2002/12/02 22:26:19  meierb
00017  my_schedule
00018 
00019  Revision 1.3  2002/11/09 23:21:58  taeubig
00020  Added std:: for standard namespace,
00021  realtive path corrections for header includes
00022 
00023  Revision 1.2  2002/11/07 12:33:25  taeubig
00024  Added class keyword to friend declaration
00025 
00026  Revision 1.1  2002/08/29 12:59:59  taeubig
00027  Added the sources
00028 
00029  Revision 1.3  2000/07/02 23:40:58  taeubig
00030  Updated class tree for n-dimensional, 2-dimensional, 1-dimensional
00031  meshes (SMeshN, SMeshTopology, SLineTopology)
00032  NOTE: virtual base classes have changed (only STopology is virtual)
00033 
00034  Revision 1.2  2000/06/21 17:27:41  taeubig
00035  Updates and bugfix for canEmbed() and embed()
00036 
00037  Revision 1.1  2000/06/21 12:30:05  taeubig
00038  Added n-dimensional mesh topology
00039 
00040 
00041  * #end# ************************************************************* */
00042 
00043 #ifndef SMESHN_H
00044 #define SMESHN_H
00045 
00046 // system header files
00047 #include <iostream>
00048 
00049 #include <LEDA/array.h>
00050 #include <LEDA/h_array.h>
00051 
00052 // project header files
00053 #include "STopology.h"
00054 #include "SMeshNMod.h"
00055 #include "SMeshNPosition.h"
00056 
00057 // ------------------------------------------------------------
00058 
00059 class SMeshNEntry {
00060 public:
00061   int _id;
00062   const SMeshNPosition *_pos;
00063   SMeshNEntry(int id, const SMeshNPosition *pos) :
00064     _id(id), _pos(pos) {};
00065 
00066   friend std::istream &operator>>(std::istream &i, SMeshNEntry &e) { return i; };
00067   friend std::ostream &operator<<(std::ostream &o, const SMeshNEntry &e) { return o; };
00068 };
00069 
00070 // ------------------------------------------------------------
00075 class SMeshN : public virtual STopology {
00076   TYPEINFO0(SMeshN, "meshN");
00077   friend class SMeshNMod;
00078 public:
00082   SMeshN(SDimArray &meshSize);
00083 
00087   SMeshN(int dim);
00088 
00091   virtual ~SMeshN() {}
00092 
00095   virtual STopologyMod &getModifier() 
00096     { return _mod; };
00097 
00102   virtual int getCount() const {
00103     int count = 1;
00104     for (int i=0; i<getDim(); i++)
00105       count *= _size[i];
00106     return count;
00107   };
00108   
00112   virtual int getDim() const { return _size.size(); };
00113 
00117   virtual SDimArray getSize() const { return _size; };
00118 
00123   virtual int getIDAt(int pos) const;
00124   
00129   virtual int getPos(int ID) const;
00130   
00135   virtual bool isPosFree(int pos) const;
00136 
00142   virtual bool canEmbedAt(const STopology &top, int pos) const;
00143   virtual bool canEmbedAt(const SComplexPosition &rHcPos) const;
00144 
00145   // /** @return list of all position where the topology may be embedded */
00146   //   virtual list<int> canEmbedAt(const STopology &top) const {
00147   //     // MISSING IMPLEMENTATION !
00148   //     return _free;
00149   //   }
00150   
00156   virtual void embed(const STopology& top, int pos, int ID);
00157   virtual void embed(const STopology& top,
00158          const SComplexPosition *pMeshNPos, int ID);
00159   
00163   virtual void remove(int ID);
00164   
00167   virtual void clear();
00168 
00169   virtual bool fitsInto(const STopology *top) const {
00170     const SMeshN *meshN = dynamic_cast<const SMeshN*>(top);
00171     bool ok = true;
00172     for (int i=0; i<getDim(); i++)
00173       if (_size[i] > meshN->getSize()[i]) {
00174   ok = false;
00175   break;
00176       }
00177     return ok;
00178   }
00179 
00180 protected:
00181   SDimArray _size;
00182 
00183   // Hashing array for getPos
00184   leda_h_array<int, SMeshNEntry*> _IDtoEntry;  // what about d_array?
00185   static SMeshNEntry _defaultEntry;
00186 
00187   void setSize(SDimArray &newSize);
00188 
00189 private:
00190   //int _dim;
00191   SMeshNMod _mod;
00192   //list<int> _free; 
00193 };
00194 
00195 #endif //SMESHN_H

Generated on Thu May 22 16:48:09 2003 for Sketch-it! by doxygen1.2.18