1 /* *****************************************************************
2     MESQUITE -- The Mesh Quality Improvement Toolkit
3 
4     Copyright 2006 Sandia National Laboratories.  Developed at the
5     University of Wisconsin--Madison under SNL contract number
6     624796.  The U.S. Government and the University of Wisconsin
7     retain certain rights to this software.
8 
9     This library is free software; you can redistribute it and/or
10     modify it under the terms of the GNU Lesser General Public
11     License as published by the Free Software Foundation; either
12     version 2.1 of the License, or (at your option) any later version.
13 
14     This library is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17     Lesser General Public License for more details.
18 
19     You should have received a copy of the GNU Lesser General Public License
20     (lgpl.txt) along with this library; if not, write to the Free Software
21     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22 
23     (2006) kraftche@cae.wisc.edu
24 
25   ***************************************************************** */
26 
27 
28 /** \file ReferenceMesh.hpp
29  *  \brief
30  *  \author Jason Kraftcheck
31  */
32 
33 #ifndef MSQ_REFERENCE_MESH_HPP
34 #define MSQ_REFERENCE_MESH_HPP
35 
36 #include "Mesquite.hpp"
37 #include "MsqVertex.hpp"
38 #include "MeshInterface.hpp"
39 
40 namespace MBMesquite {
41 
42 class Mesh;
43 
44 /**\brief Class for accessing reference element topology.
45  *
46  * This class is provided in order to access reference elements
47  * for target calculators, where there is a static 1-to-1 mapping
48  * between vertices in the active mesh and vertices in the
49  * reference mesh.
50  */
51 class MESQUITE_EXPORT ReferenceMeshInterface
52 {
53 public:
54   virtual ~ReferenceMeshInterface();
55 
56   virtual void get_reference_vertex_coordinates(
57                            const Mesh::VertexHandle* vertices,
58                            size_t num_vertices,
59                            Vector3D* coordinates_out,
60                            MsqError& err ) = 0;
61 };
62 
63 class ReferenceMesh : public ReferenceMeshInterface
64 {
65 public:
ReferenceMesh(Mesh * mesh)66   MESQUITE_EXPORT ReferenceMesh( Mesh* mesh ) : mMesh(mesh) {}
67   MESQUITE_EXPORT virtual ~ReferenceMesh();
68 
69   MESQUITE_EXPORT virtual
70   void get_reference_vertex_coordinates(
71                            const Mesh::VertexHandle* vertices,
72                            size_t num_vertices,
73                            Vector3D* coordinates_out,
74                            MsqError& err );
75 private:
76   Mesh* mMesh;
77   std::vector<MsqVertex> tmpStorage;
78 };
79 
80 
81 } // namespace MBMesquite
82 
83 #endif
84