00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 #ifndef IMPERFECTTHICKNESS_H
00014 #define IMPERFECTTHICKNESS_H
00015 
00016 #include <cmath>
00017 #include <map>
00018 #include <iterator>
00019 #include <cassert>
00020 
00021 #include "shells/driverCC/SElementFunctors.h"
00022 
00023 
00024 namespace shells {
00025     struct SElementS;
00026 }
00027 
00028 
00029 class ImperfectThickness {
00030 private:
00031     typedef std::map<double, double>     DDMap;
00032     typedef std::pair<double, double>    DDPair;
00033     DDMap     _angleThickness;
00034 
00035     static const double _pi = 3.14159265;
00036 
00037 public: 
00038     ImperfectThickness() {
00039         _angleThickness.insert(std::make_pair(-1.e-8 , 0.0008204));
00040         _angleThickness.insert(std::make_pair(0.25*_pi, 0.0008230));
00041         _angleThickness.insert(std::make_pair(0.50*_pi, 0.0008560));
00042         _angleThickness.insert(std::make_pair(0.75*_pi, 0.0009093));
00043         _angleThickness.insert(std::make_pair(1.00*_pi, 0.0009246));
00044         _angleThickness.insert(std::make_pair(1.25*_pi, 0.0009169));
00045         _angleThickness.insert(std::make_pair(1.50*_pi, 0.0008814));
00046         _angleThickness.insert(std::make_pair(1.75*_pi, 0.0008433));
00047         _angleThickness.insert(std::make_pair(2.00*_pi+1.e-8 , 0.0008204));
00048     }
00049         
00050     
00051     double thicknessPhi(double phi)
00052         {               
00053             DDMap::iterator itl = _angleThickness.lower_bound(phi);
00054             assert(itl != _angleThickness.begin());
00055             DDMap::iterator itb = itl;
00056             --itb;
00057         
00058             const double slope = (itl->second-itb->second)/(itl->first-itb->first);             
00059             const double thickness =  itb->second +(phi-itb->first)*slope;
00060                 
00061             return thickness;
00062         }
00063         
00064     double thickness(shells::SElementS* element)
00065         {
00066             
00067             double center[3];
00068             shells::SElementTriangleAverage<double*> cfunc;
00069             cfunc(element, center);
00070                 
00071             double phi = std::atan2(center[1], center[0]);
00072 
00073             if (center[1] < 0) phi = 2.0*_pi+phi;
00074                 
00075             return thicknessPhi(phi);
00076         }
00077 };
00078 
00079 
00080 #endif