DataTransferKit - Multiphysics Solution Transfer Services  2.0
DTK_BoxGeometryImpl.hpp
Go to the documentation of this file.
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_BOXGEOMETRYIMPL_HPP
42 #define DTK_BOXGEOMETRYIMPL_HPP
43 
45 
46 #include <Teuchos_ArrayView.hpp>
47 #include <Teuchos_Tuple.hpp>
48 
49 namespace DataTransferKit
50 {
51 //---------------------------------------------------------------------------//
60 //---------------------------------------------------------------------------//
62 {
63  public:
64  // Default constructor.
66 
67  // Constructor.
68  BoxGeometryImpl( const EntityId global_id, const int owner_rank,
69  const int block_id, const double x_min, const double y_min,
70  const double z_min, const double x_max, const double y_max,
71  const double z_max );
72 
73  // Tuple constructor.
74  BoxGeometryImpl( const EntityId global_id, const int owner_rank,
75  const int block_id,
76  const Teuchos::Tuple<double, 6> &bounds );
77 
78  // Get the unique global identifier for the entity.
79  EntityId id() const override;
80 
81  // Get the parallel rank that owns the entity.
82  int ownerRank() const override;
83 
84  // Return the topological dimension of the entity.
85  int topologicalDimension() const override;
86 
87  // Return the physical dimension of the entity.
88  int physicalDimension() const override;
89 
90  // Compute the bounding box around the entity.
91  void boundingBox( Teuchos::Tuple<double, 6> &bounds ) const override;
92 
93  // Determine if an entity is in the block with the given id.
94  bool inBlock( const int block_id ) const override;
95 
96  // Determine if an entity is on the boundary with the given id.
97  bool onBoundary( const int boundary_id ) const override;
98 
99  // Provide a one line description of the object.
100  std::string description() const override
101  {
102  return std::string( "Basic Geometry BoxGeometry" );
103  }
104 
105  // Provide a verbose description of the object.
106  void describe( Teuchos::FancyOStream &out,
107  const Teuchos::EVerbosityLevel verb_level ) const override;
108 
109  // Return the entity measure with respect to the parameteric
110  double measure() const override;
111 
112  // Compute the centroid of the entity.
113  void centroid( const Teuchos::ArrayView<double> &centroid ) const override;
114 
115  // (Reverse Map) Map a point to the reference space of an entity. Return
116  // the parameterized point.
117  bool mapToReferenceFrame(
118  const Teuchos::ArrayView<const double> &point,
119  const Teuchos::ArrayView<double> &reference_point ) const override;
120 
121  // Determine if a reference point is in the parameterized space of an
122  // entity.
123  bool checkPointInclusion( const double tolerance,
124  const Teuchos::ArrayView<const double>
125  &reference_point ) const override;
126 
127  // (Forward Map) Map a reference point to the physical space of an entity.
128  void mapToPhysicalFrame(
129  const Teuchos::ArrayView<const double> &reference_point,
130  const Teuchos::ArrayView<double> &point ) const override;
131 
132  private:
133  // Global id.
134  EntityId d_global_id;
135 
136  // Owning parallel rank.
137  int d_owner_rank;
138 
139  // Block id.
140  int d_block_id;
141 
142  // X min.
143  double d_x_min;
144 
145  // Y min.
146  double d_y_min;
147 
148  // Z min.
149  double d_z_min;
150 
151  // X max.
152  double d_x_max;
153 
154  // Y max.
155  double d_y_max;
156 
157  // Z max.
158  double d_z_max;
159 };
160 
161 //---------------------------------------------------------------------------//
162 
163 } // end namespace DataTransferKit
164 
165 //---------------------------------------------------------------------------//
166 
167 #endif // end DTK_BOXGEOMETRYIMPL_HPP
168 
169 //---------------------------------------------------------------------------//
170 // end DTK_BoxGeometry.hpp
171 //---------------------------------------------------------------------------//
int ownerRank() const override
Get the parallel rank that owns the entity.
BasicGeometryEntityImpl declaration.
double measure() const override
Compute the measure of the box.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verb_level) const override
Provide a verbose description of the object.
int physicalDimension() const override
Return the physical dimension of the entity.
void boundingBox(Teuchos::Tuple< double, 6 > &bounds) const override
Compute the bounding box around the box.
bool onBoundary(const int boundary_id) const override
Determine if an entity is on the boundary with the given id.
int topologicalDimension() const override
Return the topological dimension of the entity.
bool inBlock(const int block_id) const override
Determine if an entity is in the block with the given id.
EntityId id() const override
EntityImpl interface.
unsigned long int EntityId
Entity id type.
Definition: DTK_Types.hpp:50
std::string description() const override
Provide a one line description of the object.
Axis-aligned Cartesian box container implementation.
void centroid(const Teuchos::ArrayView< double > &centroid) const override
Get the centroid of the box.
bool checkPointInclusion(const double tolerance, const Teuchos::ArrayView< const double > &reference_point) const override
Determine if a reference point is in the parameterized space of an entity.
DTK_BasicEntitySet.cpp.
void mapToPhysicalFrame(const Teuchos::ArrayView< const double > &reference_point, const Teuchos::ArrayView< double > &point) const override
Map a reference point to the physical space of an entity.
bool mapToReferenceFrame(const Teuchos::ArrayView< const double > &point, const Teuchos::ArrayView< double > &reference_point) const override
Map a point to the reference space of an entity. Return the.
BoxGeometryImpl()
Default constructor.