ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkFEMElement2DStress.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 
00019 #ifndef __itkFEMElement2DStress_h
00020 #define __itkFEMElement2DStress_h
00021 
00022 #include "itkFEMElementBase.h"
00023 #include "itkFEMMaterialLinearElasticity.h"
00024 
00025 namespace itk
00026 {
00027 namespace fem
00028 {
00044 template <class TBaseClass = Element>
00045 class Element2DStress : public TBaseClass
00046 {
00047 public:
00048 
00050   typedef Element2DStress          Self;
00051   typedef TBaseClass               Superclass;
00052   typedef SmartPointer<Self>       Pointer;
00053   typedef SmartPointer<const Self> ConstPointer;
00054 
00056   itkTypeMacro(Element2DStress, TBaseClass);
00057 
00058   // Repeat the required typedefs and enums from parent class
00059   typedef typename Superclass::Float      Float;
00060   typedef typename Superclass::MatrixType MatrixType;
00061   typedef typename Superclass::VectorType VectorType;
00062 
00066   Element2DStress();
00067 
00068   // ////////////////////////////////////////////////////////////////////////
00069   /*
00070    * Methods related to the physics of the problem.
00071    */
00072 
00076   virtual void GetStrainDisplacementMatrix(MatrixType & B, const MatrixType & shapeDgl) const;
00077 
00081   virtual void GetMaterialMatrix(MatrixType & D) const;
00082 
00086   void GetMassMatrix(MatrixType & Me) const;
00087 
00091   virtual unsigned int GetNumberOfDegreesOfFreedomPerNode(void) const
00092   {
00093     return 2;
00094   }
00095 
00099   virtual Material::ConstPointer GetMaterial(void) const
00100   {
00101     return dynamic_cast<const Material *>(m_mat);
00102   }
00103 
00104   virtual void SetMaterial(Material::ConstPointer mat_)
00105   {
00106     this->SetMaterialInternal(mat_.GetPointer());
00107   }
00108   virtual void SetMaterial(Material::Pointer mat_)
00109   {
00110     this->SetMaterialInternal(mat_.GetPointer());
00111   }
00112 
00113 protected:
00114 
00115   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00116 
00120   const MaterialLinearElasticity * m_mat;
00121   virtual void SetMaterialInternal(const Material *mat_)
00122     {
00123       m_mat =
00124         dynamic_cast<const MaterialLinearElasticity *>( mat_ );
00125     }
00127 
00128 };  // class Element2DStress
00129 
00130 }
00131 }  // end namespace itk::fem
00132 
00133 #ifndef ITK_MANUAL_INSTANTIATION
00134 #include "itkFEMElement2DStress.hxx"
00135 #endif
00136 
00137 #endif  // #ifndef __itkFEMElement2DStress_h
00138