00001 // -*- C++ -*- 00002 // 00003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00004 // 00005 // Ralf Deiterding, Fehmi Cirak 00006 // California Institute of Technology 00007 // (C) 2005 All Rights Reserved 00008 // 00009 // <LicenseText> 00010 // 00011 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00012 // 00013 #ifndef SHELLENFORCEBCFUNCTOR_H 00014 #define SHELLENFORCEBCFUNCTOR_H 00015 00016 #include "shells/driverCC/SVertexFunctors.h" 00017 #include "shells/driverCC/PrescribeVarFunctor.h" 00018 00019 #include <functional> 00020 00021 00022 namespace shells { 00023 class ShellEnforceBCFunctor; 00024 } 00025 00026 00027 class shells::ShellEnforceBCFunctor : 00028 public std::unary_function<shells::SVertexS*, void> { 00029 00030 public: 00031 ShellEnforceBCFunctor() {} 00032 00033 ~ShellEnforceBCFunctor() {} 00034 00035 void operator()(shells::SVertex *vtx) const { 00036 SVertexCoordinate extractC; 00037 SVertexCoordinate::DataType *coor = extractC(vtx); 00038 const double xcoor = coor[0]; 00039 const double ycoor = coor[1]; 00040 const double zcoor = coor[2]; 00041 00042 // set the velocities and accelerations to zero at the boundaries 00043 if (std::sqrt(ycoor*ycoor+zcoor*zcoor)>0.0319) { 00044 SVertexVelocity extractV; 00045 SVertexAcceleration extractA; 00046 00047 SVertexVelocity::DataType *vel = extractV(vtx); 00048 SVertexAcceleration::DataType *acc = extractA(vtx); 00049 for (unsigned i=0; i<SVertexVelocity::numVar; ++i) { 00050 vel[i] = 0.0; 00051 acc[i] = 0.0; 00052 } 00053 } 00054 } 00055 }; 00056 #endif