00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef SUNDANCE_CELLFILTER_H
00032 #define SUNDANCE_CELLFILTER_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceSet.hpp"
00036 #include "SundanceCellSet.hpp"
00037 #include "SundanceCellPredicate.hpp"
00038 #include "SundanceCellFilterStub.hpp"
00039 #include "SundancePositionalCellPredicate.hpp"
00040 #include "SundanceOrderedHandle.hpp"
00041 #include "PlayaHandle.hpp"
00042 #include "Teuchos_RefCountPtr.hpp"
00043 
00044 namespace Sundance
00045 {
00046 using namespace Teuchos;
00047   
00048 
00049 class CellFilterBase;
00050 
00051   
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 class CellFilter : public OrderedHandle<CellFilterStub>
00121 {
00122 public:
00123   ORDERED_HANDLE_CTORS(CellFilter, CellFilterStub);
00124 
00125 
00126   CellSet getCells(const Mesh& mesh) const ;
00127 
00128 
00129   int dimension(const Mesh& mesh) const ;
00130 
00131 
00132 
00133   CellFilter operator+(const CellFilter& other) const ;
00134     
00135 
00136 
00137   CellFilter operator-(const CellFilter& other) const ;
00138 
00139 
00140 
00141   CellFilter intersection(const CellFilter& other) const ;
00142 
00143   
00144   
00145   
00146   
00147 
00148     
00149 
00150 
00151   CellFilter labeledSubset(int label) const ;
00152 
00153 
00154 
00155   CellFilter labeledSubset(const Array<int>& labels) const ;
00156 
00157 
00158 
00159   CellFilter coordSubset(int dir, const double& coordVal) const ;
00160 
00161     
00162 
00163 
00164   CellFilter subset(const CellPredicate& test) const ;
00165     
00166 
00167 
00168   CellFilter subset(const RCP<CellPredicateFunctorBase>& test) const ;
00169 
00170 
00171   const Set<CellFilter>& knownSubsets() const ;
00172 
00173 
00174 
00175   const Set<CellFilter>& knownDisjoints() const ;
00176 
00177 
00178 
00179 
00180 
00181 
00182 
00183   bool isKnownSubsetOf(const CellFilter& other) const ;
00184 
00185 
00186 
00187 
00188 
00189 
00190 
00191   bool isKnownDisjointWith(const CellFilter& other) const ;
00192 
00193 
00194 
00195   bool isSubsetOf(const CellFilter& other, const Mesh& mesh) const ;
00196 
00197 
00198 
00199   bool isDisjointWith(const CellFilter& other, const Mesh& mesh) const ;
00200 
00201 
00202   void registerSubset(const CellFilter& sub) const ;
00203 
00204 
00205   void registerDisjoint(const CellFilter& sub) const ;
00206 
00207 
00208   void registerLabeledSubset(const Set<int>& label, const CellFilter& sub) const ;
00209 
00210     
00211 
00212   bool isNullCellFilter() const ;
00213 
00214 
00215 
00216 
00217   bool areFacetsOf(const CellFilter& other, const Mesh& mesh) const ;
00218 
00219 
00220   bool isNull() const ;
00221 
00222 
00223   bool operator==(const CellFilter& other) const ;
00224 
00225 
00226   bool operator!=(const CellFilter& other) const ;
00227     
00228 
00229 
00230   XMLObject toXML() const ;
00231 
00232 
00233   std::string toString() const ;
00234 
00235 
00236   void setName(const std::string& name) ;
00237 
00238 
00239   const CellFilterBase* cfbPtr() const ;
00240 
00241   CellFilterBase* nonConstCfbPtr();
00242     
00243 private:
00244 
00245 };
00246 
00247 
00248 
00249 
00250 inline
00251 Array<CellFilter> List(const CellFilter& a)
00252 {
00253   Array<CellFilter> rtn(1, a);
00254   return rtn;
00255 }
00256 
00257 
00258 
00259 
00260 inline
00261 Array<CellFilter> List(const CellFilter& a, const CellFilter& b)
00262 {
00263   Array<CellFilter> rtn(2);
00264   rtn[0] = a;
00265   rtn[1] = b;
00266   return rtn;
00267 }
00268 
00269 
00270 
00271 
00272 inline
00273 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c)
00274 {
00275   Array<CellFilter> rtn(3);
00276   rtn[0] = a;
00277   rtn[1] = b;
00278   rtn[2] = c;
00279   return rtn;
00280 }
00281 
00282 
00283 
00284 
00285 inline
00286 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d)
00287 {
00288   Array<CellFilter> rtn(4);
00289   rtn[0] = a;
00290   rtn[1] = b;
00291   rtn[2] = c;
00292   rtn[3] = d;
00293   return rtn;
00294 }
00295 
00296 
00297 
00298 
00299 inline
00300 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e)
00301 {
00302   Array<CellFilter> rtn(5);
00303   rtn[0] = a;
00304   rtn[1] = b;
00305   rtn[2] = c;
00306   rtn[3] = d;
00307   rtn[4] = e;
00308   return rtn;
00309 }
00310 
00311 
00312 
00313 
00314 
00315 inline
00316 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e,
00317   const CellFilter& f)
00318 {
00319   Array<CellFilter> rtn(6);
00320   rtn[0] = a;
00321   rtn[1] = b;
00322   rtn[2] = c;
00323   rtn[3] = d;
00324   rtn[4] = e;
00325   rtn[5] = f;
00326   return rtn;
00327 }
00328 
00329 
00330 
00331 
00332 inline
00333 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e,
00334   const CellFilter& f, const CellFilter& g)
00335 {
00336   Array<CellFilter> rtn(7);
00337   rtn[0] = a;
00338   rtn[1] = b;
00339   rtn[2] = c;
00340   rtn[3] = d;
00341   rtn[4] = e;
00342   rtn[5] = f;
00343   rtn[6] = g;
00344   return rtn;
00345 }
00346 
00347 
00348 
00349 
00350 inline
00351 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e,
00352   const CellFilter& f, const CellFilter& g, const CellFilter& h)
00353 {
00354   Array<CellFilter> rtn(8);
00355   rtn[0] = a;
00356   rtn[1] = b;
00357   rtn[2] = c;
00358   rtn[3] = d;
00359   rtn[4] = e;
00360   rtn[5] = f;
00361   rtn[6] = g;
00362   rtn[7] = h;
00363   return rtn;
00364 }
00365 
00366 
00367 
00368 
00369 inline
00370 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e,
00371   const CellFilter& f, const CellFilter& g, const CellFilter& h, const CellFilter& i)
00372 {
00373   Array<CellFilter> rtn(9);
00374   rtn[0] = a;
00375   rtn[1] = b;
00376   rtn[2] = c;
00377   rtn[3] = d;
00378   rtn[4] = e;
00379   rtn[5] = f;
00380   rtn[6] = g;
00381   rtn[7] = h;
00382   rtn[8] = i;
00383   return rtn;
00384 }
00385 
00386 
00387 
00388 
00389 
00390 inline
00391 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e,
00392   const CellFilter& f, const CellFilter& g, const CellFilter& h, const CellFilter& i, const CellFilter& j)
00393 {
00394   Array<CellFilter> rtn(10);
00395   rtn[0] = a;
00396   rtn[1] = b;
00397   rtn[2] = c;
00398   rtn[3] = d;
00399   rtn[4] = e;
00400   rtn[5] = f;
00401   rtn[6] = g;
00402   rtn[7] = h;
00403   rtn[8] = i;
00404   rtn[9] = j;
00405   return rtn;
00406 }
00407 
00408 
00409 typedef Array<CellFilter> CellFilterArray;
00410 
00411 }
00412 
00413 namespace std
00414 {
00415 inline std::ostream& operator<<(std::ostream& os, const Sundance::CellFilter& f)
00416 {
00417   os << f.toString();
00418   return os;
00419 }
00420 }
00421 
00422 #endif