SundanceCellSet.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 #ifndef SUNDANCE_CELLSET_H
00032 #define SUNDANCE_CELLSET_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceCellSetBase.hpp"
00036 #include "SundanceCellPredicate.hpp"
00037 #include "PlayaHandle.hpp"
00038 
00039 
00040 namespace Sundance
00041 {
00042 using namespace Teuchos;
00043   
00044 /** 
00045  * CellSet is, you guessed it, a set of cells in a mesh. Cells are 
00046  * represented by their LID relative to the mesh. 
00047  * 
00048  * 
00049  * @see CellFilter, CellIterator
00050  **/
00051 class CellSet : public Playa::Handle<CellSetBase>
00052 {
00053 public:
00054   /* handle boilerplate */
00055   HANDLE_CTORS(CellSet, CellSetBase);
00056 
00057   /** Construct from an explicit set of cells */
00058   CellSet(const Mesh& mesh, int cellDim,
00059     const CellType& cellType,
00060     const Set<int>& cellLIDs);
00061       
00062 
00063   /** The ID number of the mesh in which these cells exist */
00064   int meshID() const {return ptr()->meshID();}
00065       
00066   /** The mesh in which these cells exist */
00067   const Mesh& mesh() const {return ptr()->mesh();}
00068 
00069   /** Indicate whether the cells in this set are null cells */
00070   bool isNull() const {return ptr().get()==0 || ptr()->dimension() < 0;}
00071 
00072   /** The dimension of the cells contained in this set */
00073   int dimension() const {return ptr()->dimension();}
00074 
00075   /** The type of the cells contained in this set */
00076   const CellType& cellType() const {return ptr()->cellType();}
00077 
00078   /** An iterator pointing to the beginning of the set */
00079   CellIterator begin() const {return ptr()->begin();}
00080 
00081   /** An iterator pointing to the end of the set */
00082   CellIterator end() const {return ptr()->end();}
00083 
00084   /** Return a cell set that is the union of this set and another set */
00085   CellSet setUnion(const CellSet& other) const ;
00086 
00087   /** Return a cell set that is the intersection
00088    *  of this set and another set */
00089   CellSet setIntersection(const CellSet& other) const ;
00090 
00091   /** Return a cell set that is the difference
00092    *  of this set and another set */
00093   CellSet setDifference(const CellSet& other) const ;
00094 
00095   /** */
00096   CellSet subset(const RCP<CellPredicate>& test) const ;
00097 
00098 
00099   /** Determine whether all cells in this set are
00100    * facets of cells in the other set */
00101   bool areFacetsOf(const CellSet& other) const ;
00102 
00103   /** */
00104   bool operator<(const CellSet& other) const ;
00105 
00106   /** */
00107   int numCells() const ;
00108 
00109 private:
00110   void checkCompatibility(const std::string& op, const CellSet& other) const ;
00111 };
00112 
00113 
00114 }
00115 
00116 namespace std
00117 {
00118 inline ostream& operator<<(std::ostream& os, 
00119   const Sundance::CellSet& c)
00120 {
00121   c.print(os);
00122   return os;
00123 }
00124 }
00125 
00126 
00127 
00128 #endif

Site Contact