00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MESH_EXPRESSION_HPP
00021 #define MESH_EXPRESSION_HPP
00022
00023 #include <Expression.hpp>
00024 #include <Vector3Expression.hpp>
00025 #include <RealExpression.hpp>
00026
00027 #include <cmath>
00028 #include <Variable.hpp>
00029
00030 #include <FileDescriptor.hpp>
00031
00032 #include <list>
00033
00043 class Mesh;
00044 class MeshExpression
00045 : public Expression
00046 {
00047 protected:
00048 ConstReferenceCounting<Mesh> __mesh;
00049
00050 public:
00051 enum TypeOfMesh {
00052 extract,
00053 octree,
00054 periodic,
00055 read,
00056 simplify,
00057 surface,
00058 spectral,
00059 structured,
00060 tetrahedrize,
00061 tetrahedrizeDomain,
00062 transform,
00063 undefined,
00064 unstructured,
00065 variable
00066 };
00067
00068 private:
00069 MeshExpression::TypeOfMesh __typeOfMesh;
00070
00071 public:
00072 ConstReferenceCounting<Mesh> mesh() const;
00073
00074 const MeshExpression::TypeOfMesh& typeOfMesh() const
00075 {
00076 return __typeOfMesh;
00077 }
00078
00079 MeshExpression(const MeshExpression& e);
00080
00081 MeshExpression(ReferenceCounting<Mesh> m,
00082 const MeshExpression::TypeOfMesh& t);
00083
00084 virtual ~MeshExpression();
00085 };
00086
00087 class DomainExpression;
00088
00096 class MeshExpressionStructured
00097 : public MeshExpression
00098 {
00099 private:
00100 ReferenceCounting<Vector3Expression> __meshSize;
00101 ReferenceCounting<Vector3Expression> __corner1;
00102 ReferenceCounting<Vector3Expression> __corner2;
00103
00104 std::ostream& put(std::ostream& os) const;
00105
00106 public:
00107 void execute();
00108
00109 MeshExpressionStructured(ReferenceCounting<Vector3Expression> size,
00110 ReferenceCounting<Vector3Expression> corner1,
00111 ReferenceCounting<Vector3Expression> corner2);
00112
00113 MeshExpressionStructured(const MeshExpressionStructured& m);
00114
00115 ~MeshExpressionStructured();
00116 };
00117
00125 class MeshExpressionSpectral
00126 : public MeshExpression
00127 {
00128 private:
00129 ReferenceCounting<Vector3Expression> __degree;
00130 ReferenceCounting<Vector3Expression> __corner1;
00131 ReferenceCounting<Vector3Expression> __corner2;
00132
00133 std::ostream& put(std::ostream& os) const;
00134
00135 public:
00136 void execute();
00137
00138 MeshExpressionSpectral(ReferenceCounting<Vector3Expression> degrees,
00139 ReferenceCounting<Vector3Expression> corner1,
00140 ReferenceCounting<Vector3Expression> corner2);
00141
00142 MeshExpressionSpectral(const MeshExpressionSpectral& m);
00143
00144 ~MeshExpressionSpectral();
00145 };
00146
00154 class MeshExpressionSurface
00155 : public MeshExpression
00156 {
00157 private:
00158 ReferenceCounting<DomainExpression> __domain;
00159 ReferenceCounting<MeshExpression> __volumeMesh;
00160
00161 std::ostream& put(std::ostream& os) const;
00162
00163 template <typename MeshType>
00164 void __getSurfaceMesh(MeshType& mesh);
00165
00166 public:
00167 void execute();
00168
00169 MeshExpressionSurface(ReferenceCounting<DomainExpression> domain,
00170 ReferenceCounting<MeshExpression> volumeMesh);
00171
00172 MeshExpressionSurface(ReferenceCounting<MeshExpression> volumeMesh);
00173
00174 MeshExpressionSurface(const MeshExpressionSurface& m);
00175
00176 ~MeshExpressionSurface();
00177 };
00178
00179 class MeshExpressionOctree
00180 : public MeshExpression
00181 {
00182 private:
00183 ReferenceCounting<DomainExpression> __domainExpression;
00184 ReferenceCounting<MeshExpression> __meshExpression;
00185 ReferenceCounting<RealExpression> __levelExpression;
00186
00187 std::ostream& put(std::ostream& os) const;
00188
00189 public:
00190 void execute();
00191
00192 MeshExpressionOctree(ReferenceCounting<DomainExpression> domainExpression,
00193 ReferenceCounting<MeshExpression> meshExpression,
00194 ReferenceCounting<RealExpression> levelExpression);
00195
00196 MeshExpressionOctree(const MeshExpressionOctree& m);
00197
00198 ~MeshExpressionOctree();
00199 };
00200
00201 class MeshExpressionVariable
00202 : public MeshExpression
00203 {
00204 private:
00205 const std::string __meshName;
00206 ReferenceCounting<MeshVariable> __meshVariable;
00207
00208 std::ostream& put(std::ostream& os) const
00209 {
00210 os << __meshVariable->name();
00211 if (StreamCenter::instance().getDebugLevel() > 3) {
00212 os << '{' << (*__meshVariable->expression()) << '}';
00213 }
00214 return os;
00215 }
00216
00217 public:
00218 void execute();
00219
00220 MeshExpressionVariable(const std::string& meshName);
00221
00222 MeshExpressionVariable(const MeshExpressionVariable& e);
00223
00224 ~MeshExpressionVariable();
00225 };
00226
00227
00228 class MeshExpressionRead
00229 : public MeshExpression
00230 {
00231 private:
00232 ReferenceCounting<MeshExpression> __meshVariable;
00233
00234 ReferenceCounting<FileDescriptor> __fileDescriptor;
00235
00236 ReferenceCounting<StringExpression> __filename;
00237
00238 std::ostream& put(std::ostream& os) const;
00239
00240 public:
00241 void execute();
00242
00243 MeshExpressionRead(ReferenceCounting<FileDescriptor> descriptor,
00244 ReferenceCounting<StringExpression> filename);
00245
00246 MeshExpressionRead(const MeshExpressionRead& e);
00247
00248 ~MeshExpressionRead();
00249 };
00250
00251
00252 class MeshExpressionSimplify
00253 : public MeshExpression
00254 {
00255 private:
00256 ReferenceCounting<MeshExpression> __originalMesh;
00257
00258 std::ostream& put(std::ostream& os) const;
00259
00260 public:
00261 void execute();
00262
00263 MeshExpressionSimplify(ReferenceCounting<MeshExpression>);
00264
00265 MeshExpressionSimplify(const MeshExpressionSimplify& e);
00266
00267 ~MeshExpressionSimplify();
00268 };
00269
00270 class MeshExpressionExtract
00271 : public MeshExpression
00272 {
00273 private:
00274 ReferenceCounting<MeshExpression> __originalMesh;
00275 ReferenceCounting<RealExpression> __referenceToExtract;
00276
00277 std::ostream& put(std::ostream& os) const;
00278
00279 template <typename MeshType>
00280 void __extract();
00281
00282 public:
00283 void execute();
00284
00285 MeshExpressionExtract(ReferenceCounting<MeshExpression>,
00286 ReferenceCounting<RealExpression>);
00287
00288 MeshExpressionExtract(const MeshExpressionExtract& e);
00289
00290 ~MeshExpressionExtract();
00291 };
00292
00293
00294 class MeshExpressionTetrahedrize
00295 : public MeshExpression
00296 {
00297 private:
00298 std::ostream& put(std::ostream& os) const
00299 {
00300 os << "tetrahedrize mesh";
00301 return os;
00302 }
00303
00304 ReferenceCounting<MeshExpression> __inputMesh;
00305
00306 public:
00307 void execute();
00308
00309 MeshExpressionTetrahedrize(ReferenceCounting<MeshExpression> m);
00310
00311 MeshExpressionTetrahedrize(const MeshExpressionTetrahedrize& m);
00312
00313 ~MeshExpressionTetrahedrize();
00314 };
00315
00326 class MeshExpressionTetrahedrizeDomain
00327 : public MeshExpression
00328 {
00329 private:
00330 std::ostream& put(std::ostream& os) const
00331 {
00332 os << "tetrahedrize domain mesh";
00333 return os;
00334 }
00335
00336 ReferenceCounting<MeshExpression> __inputMesh;
00337 ReferenceCounting<DomainExpression> __domain;
00338
00339 public:
00340 void execute();
00341
00342 MeshExpressionTetrahedrizeDomain(ReferenceCounting<MeshExpression> m,
00343 ReferenceCounting<DomainExpression> d);
00344
00345 MeshExpressionTetrahedrizeDomain(const MeshExpressionTetrahedrizeDomain& m);
00346
00347 ~MeshExpressionTetrahedrizeDomain();
00348 };
00349
00350
00351 class MeshExpressionUndefined
00352 : public MeshExpression
00353 {
00354 private:
00355 std::ostream& put(std::ostream& os) const
00356 {
00357 os << "undefined mesh";
00358 return os;
00359 }
00360
00361 public:
00362
00363 void execute()
00364 {
00365 ;
00366 }
00367
00368 MeshExpressionUndefined();
00369
00370 MeshExpressionUndefined(const MeshExpressionUndefined& m);
00371
00372 ~MeshExpressionUndefined();
00373 };
00374
00375 class VerticesSet;
00376 class FieldExpression;
00377 class MeshExpressionTransform
00378 : public MeshExpression
00379 {
00380 private:
00381 std::ostream& put(std::ostream& os) const
00382 {
00383 os << "transformed mesh";
00384 return os;
00385 }
00386
00387 ReferenceCounting<MeshExpression> __inputMesh;
00388
00389 ReferenceCounting<FieldExpression> __transformationField;
00390
00391 public:
00392
00393 void execute();
00394
00395 MeshExpressionTransform(ReferenceCounting<MeshExpression> m,
00396 ReferenceCounting<FieldExpression> f);
00397
00398 MeshExpressionTransform(const MeshExpressionTransform& m);
00399
00400 ~MeshExpressionTransform();
00401 };
00402
00403 class MeshExpressionPeriodic
00404 : public MeshExpression
00405 {
00406 public:
00407 typedef std::list<std::pair<ReferenceCounting<RealExpression>,
00408 ReferenceCounting<RealExpression> > >
00409 MappedReferencesList;
00410
00411 private:
00412 std::ostream& put(std::ostream& os) const
00413 {
00414 os << "periodic mesh";
00415 return os;
00416 }
00417
00418 ReferenceCounting<MeshExpression> __inputMesh;
00419
00420 ReferenceCounting<MappedReferencesList> __mappedReferences;
00421 public:
00422
00423 void execute();
00424
00425 MeshExpressionPeriodic(ReferenceCounting<MeshExpression> m,
00426 ReferenceCounting<MappedReferencesList> references);
00427
00428 MeshExpressionPeriodic(const MeshExpressionPeriodic& m);
00429
00430 ~MeshExpressionPeriodic();
00431 };
00432
00433 #endif // _MESH_EXPRESSION_HPP_
00434