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
00156 CellFilter subset(const CellPredicate& test) const ;
00157
00158
00159
00160 CellFilter subset(const RCP<CellPredicateFunctorBase>& test) const ;
00161
00162
00163 const Set<CellFilter>& knownSubsets() const ;
00164
00165
00166
00167 const Set<CellFilter>& knownDisjoints() const ;
00168
00169
00170
00171
00172
00173
00174
00175 bool isKnownSubsetOf(const CellFilter& other) const ;
00176
00177
00178
00179
00180
00181
00182
00183 bool isKnownDisjointWith(const CellFilter& other) const ;
00184
00185
00186
00187 bool isSubsetOf(const CellFilter& other, const Mesh& mesh) const ;
00188
00189
00190
00191 bool isDisjointWith(const CellFilter& other, const Mesh& mesh) const ;
00192
00193
00194 void registerSubset(const CellFilter& sub) const ;
00195
00196
00197 void registerDisjoint(const CellFilter& sub) const ;
00198
00199
00200 void registerLabeledSubset(int label, const CellFilter& sub) const ;
00201
00202
00203
00204 bool isNullCellFilter() const ;
00205
00206
00207
00208
00209 bool areFacetsOf(const CellFilter& other, const Mesh& mesh) const ;
00210
00211
00212 bool isNull() const ;
00213
00214
00215 bool operator==(const CellFilter& other) const ;
00216
00217
00218 bool operator!=(const CellFilter& other) const ;
00219
00220
00221
00222 XMLObject toXML() const ;
00223
00224
00225 std::string toString() const ;
00226
00227
00228 void setName(const std::string& name) ;
00229
00230
00231 const CellFilterBase* cfbPtr() const ;
00232
00233 CellFilterBase* nonConstCfbPtr();
00234
00235 private:
00236
00237 };
00238
00239
00240
00241
00242 inline
00243 Array<CellFilter> List(const CellFilter& a)
00244 {
00245 Array<CellFilter> rtn(1, a);
00246 return rtn;
00247 }
00248
00249
00250
00251
00252 inline
00253 Array<CellFilter> List(const CellFilter& a, const CellFilter& b)
00254 {
00255 Array<CellFilter> rtn(2);
00256 rtn[0] = a;
00257 rtn[1] = b;
00258 return rtn;
00259 }
00260
00261
00262
00263
00264 inline
00265 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c)
00266 {
00267 Array<CellFilter> rtn(3);
00268 rtn[0] = a;
00269 rtn[1] = b;
00270 rtn[2] = c;
00271 return rtn;
00272 }
00273
00274
00275
00276
00277 inline
00278 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d)
00279 {
00280 Array<CellFilter> rtn(4);
00281 rtn[0] = a;
00282 rtn[1] = b;
00283 rtn[2] = c;
00284 rtn[3] = d;
00285 return rtn;
00286 }
00287
00288
00289
00290
00291 inline
00292 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e)
00293 {
00294 Array<CellFilter> rtn(5);
00295 rtn[0] = a;
00296 rtn[1] = b;
00297 rtn[2] = c;
00298 rtn[3] = d;
00299 rtn[4] = e;
00300 return rtn;
00301 }
00302
00303
00304
00305
00306
00307 inline
00308 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e,
00309 const CellFilter& f)
00310 {
00311 Array<CellFilter> rtn(6);
00312 rtn[0] = a;
00313 rtn[1] = b;
00314 rtn[2] = c;
00315 rtn[3] = d;
00316 rtn[4] = e;
00317 rtn[5] = f;
00318 return rtn;
00319 }
00320
00321
00322
00323
00324 inline
00325 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e,
00326 const CellFilter& f, const CellFilter& g)
00327 {
00328 Array<CellFilter> rtn(7);
00329 rtn[0] = a;
00330 rtn[1] = b;
00331 rtn[2] = c;
00332 rtn[3] = d;
00333 rtn[4] = e;
00334 rtn[5] = f;
00335 rtn[6] = g;
00336 return rtn;
00337 }
00338
00339
00340
00341
00342 inline
00343 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e,
00344 const CellFilter& f, const CellFilter& g, const CellFilter& h)
00345 {
00346 Array<CellFilter> rtn(8);
00347 rtn[0] = a;
00348 rtn[1] = b;
00349 rtn[2] = c;
00350 rtn[3] = d;
00351 rtn[4] = e;
00352 rtn[5] = f;
00353 rtn[6] = g;
00354 rtn[7] = h;
00355 return rtn;
00356 }
00357
00358
00359
00360
00361 inline
00362 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e,
00363 const CellFilter& f, const CellFilter& g, const CellFilter& h, const CellFilter& i)
00364 {
00365 Array<CellFilter> rtn(9);
00366 rtn[0] = a;
00367 rtn[1] = b;
00368 rtn[2] = c;
00369 rtn[3] = d;
00370 rtn[4] = e;
00371 rtn[5] = f;
00372 rtn[6] = g;
00373 rtn[7] = h;
00374 rtn[8] = i;
00375 return rtn;
00376 }
00377
00378
00379
00380
00381
00382 inline
00383 Array<CellFilter> List(const CellFilter& a, const CellFilter& b, const CellFilter& c, const CellFilter& d, const CellFilter& e,
00384 const CellFilter& f, const CellFilter& g, const CellFilter& h, const CellFilter& i, const CellFilter& j)
00385 {
00386 Array<CellFilter> rtn(10);
00387 rtn[0] = a;
00388 rtn[1] = b;
00389 rtn[2] = c;
00390 rtn[3] = d;
00391 rtn[4] = e;
00392 rtn[5] = f;
00393 rtn[6] = g;
00394 rtn[7] = h;
00395 rtn[8] = i;
00396 rtn[9] = j;
00397 return rtn;
00398 }
00399
00400
00401 typedef Array<CellFilter> CellFilterArray;
00402
00403 }
00404
00405 namespace std
00406 {
00407 inline std::ostream& operator<<(std::ostream& os, const Sundance::CellFilter& f)
00408 {
00409 os << f.toString();
00410 return os;
00411 }
00412 }
00413
00414 #endif