Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

CellSet.h

Go to the documentation of this file.
00001 #ifndef CELLSET_H
00002 #define CELLSET_H
00003 
00004 #include "SundanceDefs.h"
00005 
00006 #include "TSFSmartPtr.h"
00007 #include "Cell.h"
00008 #include "CellSetBase.h"
00009 #include "CellBlock.h"
00010 #include "XMLObject.h"
00011 #include "TSFArray.h"
00012 #include "TSFNonDupArray.h"
00013 #include "TSFHashtable.h"
00014 #include "LogicalExpr.h"
00015 #include "TSFTimeMonitor.h"
00016 
00017 
00018 
00019 namespace Sundance
00020 {
00021 
00022   using namespace TSF;
00023   using std::string;
00024 
00025   using std::ostream;
00026 
00027   class Mesh;
00028 
00029 
00030   /** \ingroup UserLevelGeometry
00031    * CellSet defines a set of cells for application of an equation or BC.
00032    * The class CellSet is a handle for a low-level CellSetBase object.
00033    */
00034 
00035   class CellSet
00036     {
00037     public:
00038       /** empty ctor */
00039       CellSet() : ptr_(0) {;}
00040       /** construct, assuming control of a CellSetBase subclass object */
00041       CellSet(CellSetBase* ptr);
00042 
00043       /* determine if a given cell is contained in this set */
00044       bool contains(const Cell& cell) const ;
00045 
00046       /**  Get lists of cells organized into blocks of identical cell types.
00047        * This is for use in assembling work sets. When building a DOF map,
00048        * use getOrderedCells() instead so that reordering is used. */
00049       TSFHashtable<CellTopologyCode, TSFSmartPtr<TSFArray<CellBlock> > >
00050         getCellBlocks(const Mesh& mesh, TSFNonDupArray<CellTopologyCode>& cellType) const ;
00051 
00052       /** Get a list of cells, ordered according to the
00053        * current reordering scheme. For use in the DOF map builder.
00054        * When building work sets, use getCellBlocks() instead because work sets
00055        * require a list of cells of identical type. */
00056       TSFSmartPtr<TSFArray<Cell> > getOrderedCells(const Mesh& mesh) const ;
00057 
00058       /** test equality */
00059       bool operator==(const CellSet& other) const ;
00060 
00061       /** relational test */
00062       bool operator<(const CellSet& other) const ;
00063 
00064       /** returns all cells that are in either this or other */
00065       CellSet operator+(const CellSet& other) const ;
00066 
00067       /** returns all cells that are in both this and other */
00068       CellSet operator&&(const CellSet& other) const ;
00069 
00070       /** returns a cell set containing all cells that are in this but not
00071        * in other. */
00072       CellSet operator-(const CellSet& other) const ;
00073 
00074       /** find the union of this set with another. Note: the keyword
00075        * "union" is reserved so we call this method join(). */
00076       CellSet join(const CellSet& other) const ;
00077 
00078       /** find intersection of this set with another */
00079       CellSet intersection(const CellSet& other) const ;
00080 
00081       /** find exclusion of this set with another */
00082       CellSet exclude(const CellSet& other) const ;
00083 
00084       /** find the complement of this set */
00085       CellSet complement() const ;
00086 
00087       /** find the subset on which the given logical expr is true */
00088       CellSet subset(const LogicalExpr& expr) const ;
00089 
00090       /** find the subset having a given label */
00091       CellSet labeledSubset(const string& label) const ;
00092 
00093       /** static method to return a MaximalCellSet object */
00094       static CellSet maximalCells() ;
00095 
00096       /** write self as XML */
00097       XMLObject toXML() const ;
00098 
00099       /** return ptr to low-level implementation. Developer use only! */
00100       const CellSetBase* ptr() const ;
00101 
00102       /** find the dimension of this cell set on the given mesh */
00103       int dimension(const Mesh& mesh) const ;
00104 
00105     private:
00106       TSFSmartPtr<CellSetBase> ptr_;
00107 
00108       static TSFTimer& cellSetTimer();
00109     };
00110 
00111   /** \relates CellSet
00112    * write to stream
00113    */
00114   ostream& operator<<(ostream& os, const CellSet& cellSet);
00115 
00116 
00117 }
00118 
00119 namespace TSF
00120 {
00121   /** \relates CellSet
00122    * write to string
00123    */
00124   inline string toString(const Sundance::CellSet& cs)
00125     {
00126       return cs.toXML().toString();
00127     }
00128 }
00129 
00130 
00131 #endif
00132 
00133 

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by