00001
00012 #ifndef _DIRICHLET_BC_BASSO_H_
00013 #define _DIRICHLET_BC_BASSO_H_
00014
00015
00016 #include <list>
00017
00018
00019 #include "basso.h"
00020 #include "DofMap.h"
00021
00022 namespace basso {
00023
00024
00029 class DirichletBC {
00030
00031 public:
00032
00033
00034
00035
00041 DirichletBC( const set<int> &nodeids, const Array<Dof> &dofs, Numeric sf=0.0 )
00042 {
00043 fNodeIds=&nodeids;
00044 mScaleFactor=sf;
00045 mDofs=dofs;
00046 }
00047
00053 DirichletBC( const set<int> &nodeids, const Dof &ldof, Numeric sf=0.0 ) : mDofs(1)
00054 {
00055 fNodeIds=&nodeids;
00056 mScaleFactor=sf;
00057 mDofs[0]=ldof;
00058 }
00059
00060
00061 virtual ~DirichletBC() { }
00062
00063
00064
00065
00071 virtual void AddFixedDofs( const DofMap &dofmap, list<int> &fdofs, list<Numeric> &fvals ) const;
00072
00077 virtual void AddFixedDofs( const DofMap &dofmap, list<int> &fdofs ) const;
00078
00079 protected:
00080
00081 virtual Numeric DofValue() const { return mScaleFactor; }
00082
00083 protected:
00084
00085 const set<int> *fNodeIds;
00086 Numeric mScaleFactor;
00087 Array<Dof> mDofs;
00088
00089 };
00090
00091 void DirichletBC::AddFixedDofs( const DofMap &dofmap, list<int> &fdofs, list<Numeric> &fvals ) const
00092 {
00093 set<int>::const_iterator nItr;
00094 Array<Dof>::const_iterator dofItr;
00095 for ( nItr=fNodeIds->begin(); nItr!=fNodeIds->end(); ++nItr )
00096 for ( dofItr=mDofs.begin(); dofItr!=mDofs.end(); ++dofItr )
00097 {
00098 fdofs.push_back( dofmap.GlobalDof( *nItr, *dofItr ) );
00099 fvals.push_back( DofValue() );
00100 }
00101 }
00102
00103 void DirichletBC::AddFixedDofs( const DofMap &dofmap, list<int> &fdofs ) const
00104 {
00105 set<int>::const_iterator nItr;
00106 Array<Dof>::const_iterator dofItr;
00107 for ( nItr=fNodeIds->begin(); nItr!=fNodeIds->end(); ++nItr )
00108 for ( dofItr=mDofs.begin(); dofItr!=mDofs.end(); ++dofItr )
00109 fdofs.push_back( dofmap.GlobalDof( *nItr, *dofItr ) );
00110 }
00111
00112
00113 }
00114
00115 #endif
00116
00117