00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <BoundaryExpressionSurfaceMesh.hpp>
00021 #include <MeshExpression.hpp>
00022
00023 #include <BoundarySurfaceMesh.hpp>
00024
00025 #include <Mesh.hpp>
00026 #include <Structured3DMesh.hpp>
00027 #include <MeshOfHexahedra.hpp>
00028 #include <MeshOfTetrahedra.hpp>
00029
00030 std::ostream&
00031 BoundaryExpressionSurfaceMesh::
00032 put(std::ostream& os) const
00033 {
00034 os << "Surface Mesh";
00035 return os;
00036 }
00037
00038 void
00039 BoundaryExpressionSurfaceMesh::
00040 execute()
00041 {
00042 __surfaceMeshExpression->execute();
00043
00044 const Mesh* m = __surfaceMeshExpression->mesh();
00045
00046 switch (m->family()) {
00047 case Mesh::volume: {
00048
00049 __isPredefinedSurfaceMesh = false;
00050
00051 switch (m->type()) {
00052 case Mesh::cartesianHexahedraMesh: {
00053 const Structured3DMesh& mesh = dynamic_cast<const Structured3DMesh&>(*m);
00054 const SurfaceMesh* surface = mesh.borderMesh();
00055 __boundary = new BoundarySurfaceMesh(surface);
00056 break;
00057 }
00058 case Mesh::tetrahedraMesh: {
00059 const MeshOfTetrahedra& mesh = dynamic_cast<const MeshOfTetrahedra&>(*m);
00060 const SurfaceMesh* surface = mesh.borderMesh();
00061 __boundary = new BoundarySurfaceMesh(surface);
00062 break;
00063 }
00064 case Mesh::hexahedraMesh: {
00065 const MeshOfHexahedra& mesh = dynamic_cast<const MeshOfHexahedra&>(*m);
00066 const SurfaceMesh* surface = mesh.borderMesh();
00067 __boundary = new BoundarySurfaceMesh(surface);
00068 break;
00069 }
00070 default: {
00071 throw ErrorHandler(__BASE_FILE__,__LINE__,
00072 "Unexpected volume mesh type",
00073 ErrorHandler::unexpected);
00074 }
00075 }
00076 break;
00077 }
00078 case Mesh::surface: {
00079 ASSERT(m->type() == Mesh::surfaceMeshTriangles);
00080 __isPredefinedSurfaceMesh = true;
00081 __boundary
00082 = new BoundarySurfaceMesh(dynamic_cast<const SurfaceMeshOfTriangles*>(m));
00083 break;
00084 }
00085 default: {
00086 throw ErrorHandler(__BASE_FILE__,__LINE__,
00087 "Unexpected mesh family",
00088 ErrorHandler::unexpected);
00089 }
00090 }
00091 }
00092
00093 BoundaryExpressionSurfaceMesh::
00094 BoundaryExpressionSurfaceMesh(ReferenceCounting<MeshExpression> m)
00095 : BoundaryExpression(BoundaryExpression::surfaceMesh),
00096 __surfaceMeshExpression(m),
00097 __isPredefinedSurfaceMesh(true)
00098 {
00099 ;
00100 }
00101
00102 BoundaryExpressionSurfaceMesh::
00103 BoundaryExpressionSurfaceMesh(const BoundaryExpressionSurfaceMesh& m)
00104 : BoundaryExpression(m),
00105 __surfaceMeshExpression(m.__surfaceMeshExpression),
00106 __isPredefinedSurfaceMesh(false)
00107 {
00108 ;
00109 }
00110
00111 BoundaryExpressionSurfaceMesh::
00112 ~BoundaryExpressionSurfaceMesh()
00113 {
00114 ;
00115 }
00116