vtf-logo

shells/materials/MaterialContainer.h

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

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