1 /*========================================================================= 2 * 3 * Copyright Insight Software Consortium 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0.txt 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 *=========================================================================*/ 18 #ifndef itkQuadraticTriangleCell_h 19 #define itkQuadraticTriangleCell_h 20 21 #include "itkQuadraticEdgeCell.h" 22 #include "itkQuadraticTriangleCellTopology.h" 23 24 namespace itk 25 { 26 /** \class QuadraticTriangleCell 27 * \brief Represents a second order triangular patch for a Mesh. 28 * 29 * \tparam TPixelType The type associated with a point, cell, or boundary 30 * for use in storing its data. 31 * 32 * \tparam TCellTraits Type information of mesh containing cell. 33 * 34 * \ingroup MeshObjects 35 * \ingroup ITKCommon 36 */ 37 template< typename TCellInterface > 38 class ITK_TEMPLATE_EXPORT QuadraticTriangleCell:public TCellInterface, private QuadraticTriangleCellTopology 39 { 40 public: 41 ITK_DISALLOW_COPY_AND_ASSIGN(QuadraticTriangleCell); 42 43 /** Standard class type aliases. */ 44 itkCellCommonTypedefs(QuadraticTriangleCell); 45 itkCellInheritedTypedefs(TCellInterface); 46 47 /** Standard part of every itk Object. */ 48 itkTypeMacro(QuadraticTriangleCell, CellInterface); 49 50 /** The type of boundary for this triangle's vertices. */ 51 using VertexType = VertexCell< TCellInterface >; 52 using VertexAutoPointer = typename VertexType::SelfAutoPointer; 53 54 /** The type of boundary for this triangle's edges. */ 55 using EdgeType = QuadraticEdgeCell< TCellInterface >; 56 using EdgeAutoPointer = typename EdgeType::SelfAutoPointer; 57 58 /** Triangle-specific topology numbers. */ 59 static constexpr unsigned int NumberOfPoints = 6; 60 static constexpr unsigned int NumberOfVertices = 3; 61 static constexpr unsigned int NumberOfEdges = 3; 62 static constexpr unsigned int CellDimension = 2; 63 64 /** Implement the standard CellInterface. */ GetType()65 CellGeometry GetType() const override 66 { return Superclass::QUADRATIC_TRIANGLE_CELL; } 67 void MakeCopy(CellAutoPointer &) const override; 68 69 unsigned int GetDimension() const override; 70 71 unsigned int GetNumberOfPoints() const override; 72 73 CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const override; 74 75 bool GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &) override; 76 void SetPointIds(PointIdConstIterator first) override; 77 78 void SetPointIds(PointIdConstIterator first, 79 PointIdConstIterator last) override; 80 81 void SetPointId(int localId, PointIdentifier) override; 82 PointIdIterator PointIdsBegin() override; 83 84 PointIdConstIterator PointIdsBegin() const override; 85 86 PointIdIterator PointIdsEnd() override; 87 88 PointIdConstIterator PointIdsEnd() const override; 89 90 /** Triangle-specific interface. */ 91 virtual CellFeatureCount GetNumberOfVertices() const; 92 93 virtual CellFeatureCount GetNumberOfEdges() const; 94 95 virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &); 96 virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &); 97 98 /** Cell visitor interface. */ 99 itkCellVisitMacro(Superclass::QUADRATIC_TRIANGLE_CELL); 100 101 /** Given the parametric coordinates of a point in the cell 102 * determine the value of its Shape Functions 103 * returned through an itkArray<InterpolationWeightType>). */ 104 void EvaluateShapeFunctions( 105 const ParametricCoordArrayType & parametricCoordinates, 106 ShapeFunctionsArrayType & weights) const override; 107 108 public: QuadraticTriangleCell()109 QuadraticTriangleCell() 110 { 111 for ( PointIdentifier i = 0; i < Self::NumberOfPoints; i++ ) 112 { 113 m_PointIds[i] = NumericTraits< PointIdentifier >::max(); 114 } 115 } 116 117 ~QuadraticTriangleCell() override = default; 118 119 protected: 120 /** Store the number of points needed for a triangle. */ 121 PointIdentifier m_PointIds[NumberOfPoints]; 122 }; 123 } // end namespace itk 124 125 #ifndef ITK_MANUAL_INSTANTIATION 126 #include "itkQuadraticTriangleCell.hxx" 127 #endif 128 129 #endif 130