vtf-logo

shells/fragmentation/CMaterialContainer.h

Go to the documentation of this file.
00001 // -*- C++ -*- 
00002 //
00003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00004 //
00005 //                                   Fehmi Cirak
00006 //                        California Institute of Technology
00007 //                           (C) 2004 All Rights Reserved
00008 //
00009 // <LicenseText>
00010 //
00011 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00012 //
00013 #ifndef CMATERIALCONTAINER_H
00014 #define CMATERIALCONTAINER_H
00015 #include "../fem/definitions.h"
00016 
00017 #include <vector>
00018 #include <cassert>
00019 
00020 
00021 namespace fragment {
00022     class CMaterialContainer;
00023     class CMaterial;
00024 }
00025 
00026 
00027 class fragment::CMaterialContainer {
00028 public:
00029     // this is a singleton class
00030     static CMaterialContainer * instance();
00031     void destroy();
00032     
00033     void addMaterial(CMaterial *mat)
00034         {
00035             _cmaterials.push_back(mat);
00036         }
00037 
00038     CMaterial* operator[](unsigned i) const
00039         {
00040             assert(i<_cmaterials.size());
00041             return _cmaterials[i];
00042         }
00043 
00044     CMaterial* getMaterial(unsigned i) const
00045         {
00046             assert(i<_cmaterials.size());
00047             return _cmaterials[i];
00048         }
00049     
00050 // this is a singleton class
00051 private:
00052     CMaterialContainer(){};
00053     ~CMaterialContainer(){};
00054     static CMaterialContainer *_instance;
00055 
00056 // copy constructor and assignment operator
00057 private:
00058     CMaterialContainer (const CMaterialContainer &);
00059     const CMaterialContainer & operator=(const CMaterialContainer &);
00060 
00061 private:
00062     typedef std::vector<CMaterial *>    _CMaterialCont;
00063     typedef _CMaterialCont::iterator    _CMaterialIt;
00064 
00065     // data
00066     _CMaterialCont               _cmaterials;
00067 };
00068 
00069 #endif

Generated on Fri Aug 24 13:00:24 2007 for SFC Thin-Shell Finite Element Solver by  doxygen 1.4.7