DataTransferKit - Multiphysics Solution Transfer Services  2.0
DTK_PointImpl.hpp
1 //---------------------------------------------------------------------------//
2 /*
3  Copyright (c) 2012, Stuart R. Slattery
4  All rights reserved.
5 
6  Redistribution and use in source and binary forms, with or without
7  modification, are permitted provided that the following conditions are
8  met:
9 
10  *: Redistributions of source code must retain the above copyright
11  notice, this list of conditions and the following disclaimer.
12 
13  *: Redistributions in binary form must reproduce the above copyright
14  notice, this list of conditions and the following disclaimer in the
15  documentation and/or other materials provided with the distribution.
16 
17  *: Neither the name of the University of Wisconsin - Madison nor the
18  names of its contributors may be used to endorse or promote products
19  derived from this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 //---------------------------------------------------------------------------//
39 //---------------------------------------------------------------------------//
40 
41 #ifndef DTK_POINTIMPL_HPP
42 #define DTK_POINTIMPL_HPP
43 
45 #include "DTK_Types.hpp"
46 
47 #include <Teuchos_Array.hpp>
48 #include <Teuchos_ArrayView.hpp>
49 #include <Teuchos_Tuple.hpp>
50 
51 #include <iostream>
52 
53 namespace DataTransferKit
54 {
55 //---------------------------------------------------------------------------//
75 //---------------------------------------------------------------------------//
76 class PointImpl : public BasicGeometryEntityImpl
77 {
78  public:
79  // Default constructor.
80  PointImpl();
81 
82  // Array constructor.
83  PointImpl( const EntityId global_id, const int owner_rank,
84  const Teuchos::Array<double> &coordinates,
85  const Teuchos::Array<int> &block_ids,
86  const Teuchos::Array<int> &boundary_ids );
87 
89  // Get the coordinates of the point.
91  virtual void
92  getCoordinates( const Teuchos::ArrayView<double> &coordinates ) const;
94 
95  // Get the unique global identifier for the entity.
96  EntityId id() const override;
97 
98  // Get the parallel rank that owns the entity.
99  int ownerRank() const override;
100 
101  // Return the topological dimension of the entity.
102  int topologicalDimension() const override;
103 
104  // Return the physical dimension of the entity.
105  virtual int physicalDimension() const override;
106 
107  // Return the axis-aligned bounding box around the entity.
108  void boundingBox( Teuchos::Tuple<double, 6> &bounds ) const override;
109 
110  // Determine if an entity is in the block with the given id.
111  bool inBlock( const int block_id ) const override;
112 
113  // Determine if an entity is on the boundary with the given id.
114  bool onBoundary( const int boundary_id ) const override;
115 
116  // Provide a one line description of the object.
117  std::string description() const override
118  {
119  return std::string( "Basic Geometry Point" );
120  }
121 
122  // Provide a verbose description of the object.
123  void describe( Teuchos::FancyOStream &out,
124  const Teuchos::EVerbosityLevel verb_level ) const override;
125 
126  // Return the entity measure with respect to the parameteric
127  double measure() const override;
128 
129  // Compute the centroid of the entity.
130  void centroid( const Teuchos::ArrayView<double> &centroid ) const override;
131 
132  // (Reverse Map) Map a point to the reference space of an entity. Return
133  // the parameterized point.
134  bool mapToReferenceFrame(
135  const Teuchos::ArrayView<const double> &point,
136  const Teuchos::ArrayView<double> &reference_point ) const override;
137 
138  // Determine if a reference point is in the parameterized space of an
139  // entity.
140  bool checkPointInclusion( const double tolerance,
141  const Teuchos::ArrayView<const double>
142  &reference_point ) const override;
143 
144  // (Forward Map) Map a reference point to the physical space of an entity.
145  void mapToPhysicalFrame(
146  const Teuchos::ArrayView<const double> &reference_point,
147  const Teuchos::ArrayView<double> &point ) const override;
148 
149  protected:
150  // Global id.
151  EntityId d_global_id;
152 
153  // Owning parallel rank.
154  int d_owner_rank;
155 
156  // Block ids.
157  Teuchos::Array<int> d_block_ids;
158 
159  // Boundary ids.
160  Teuchos::Array<int> d_boundary_ids;
161 
162  private:
163  // Coordinates.
164  Teuchos::Array<double> d_coordinates;
165 };
166 
167 //---------------------------------------------------------------------------//
168 
169 } // end namespace DataTransferKit
170 
171 //---------------------------------------------------------------------------//
172 
173 #endif // end DTK_POINTIMPL_HPP
174 
175 //---------------------------------------------------------------------------//
176 // end DTK_PointImpl.hpp
177 //---------------------------------------------------------------------------//
BasicGeometryEntityImpl declaration.
unsigned long int EntityId
Entity id type.
Definition: DTK_Types.hpp:50
DTK_BasicEntitySet.cpp.