]> Creatis software - cpMesh.git/blob - lib/cpm/Algorithms/Simplex/InternalForceFunction.h
First commit
[cpMesh.git] / lib / cpm / Algorithms / Simplex / InternalForceFunction.h
1 #ifndef __CPM__ALGORITHMS__SIMPLEX__INTERNALFORCEFUNCTION__H__
2 #define __CPM__ALGORITHMS__SIMPLEX__INTERNALFORCEFUNCTION__H__
3
4 #include <vector>
5 #include <cpm/Algorithms/Base/ForceFunction.h>
6
7 namespace cpm
8 {
9   namespace Algorithms
10   {
11     namespace Simplex
12     {
13       /**
14        */
15       template< class M >
16       class InternalForceFunction
17         : public cpm::Algorithms::Base::ForceFunction< M >
18       {
19       public:
20         typedef InternalForceFunction                     Self;
21         typedef cpm::Algorithms::Base::ForceFunction< M > Superclass;
22         typedef itk::SmartPointer< Self >                 Pointer;
23         typedef itk::SmartPointer< const Self >           ConstPointer;
24
25         typedef typename Superclass::TMesh    TMesh;
26         typedef typename Superclass::TPointId TPointId;
27         typedef typename Superclass::TVector  TVector;
28         typedef typename TVector::ValueType   TScalar;
29
30         enum PhiConstraint { C0 = 0, C1, C2, C3 };
31
32       public:
33         itkNewMacro( Self );
34         itkTypeMacro( InternalForceFunction, ForceFunction );
35
36       public:
37         virtual TVector Evaluate( const TPointId& pId ) const;
38
39         virtual void SetMesh( const M* m );
40         void SetPhiConstraintToC0( );
41         void SetPhiConstraintToC1( );
42         void SetPhiConstraintToC2( const unsigned int& neigh_order = 1 );
43         void SetPhiConstraintToC3( );
44
45       protected:
46         InternalForceFunction( );
47         virtual ~InternalForceFunction( );
48
49         TScalar _ComputeMeanPhi( const TPointId& pId ) const;
50
51         static TScalar _L(
52           const TScalar& delta, const TScalar& d, const TScalar& phi
53           );
54
55       private:
56         // Purposely not implemented
57         InternalForceFunction( const Self& );
58         Self& operator=( const Self& );
59
60       protected:
61         PhiConstraint          m_PhiConstraint;
62         unsigned int           m_NeighborhoodOrder;
63         std::vector< TScalar > m_InitialPhiAngles;
64       };
65
66     } // ecapseman
67
68   } // ecapseman
69
70 } // ecapseman
71
72 #include <cpm/Algorithms/Simplex/InternalForceFunction.hxx>
73
74 #endif // __CPM__ALGORITHMS__SIMPLEX__INTERNALFORCEFUNCTION__H__
75
76 // eof - $RCSfile$