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 namespace {
00030 class ImperfectThickness {
00031 private:
00032 typedef std::map<double, double> DDMap;
00033 typedef std::pair<double, double> DDPair;
00034 DDMap _angleThickness;
00035
00036 static const double _pi;
00037
00038 public:
00039 ImperfectThickness() {
00040 _angleThickness.insert(std::make_pair(-1.e-8 , 0.0008204));
00041 _angleThickness.insert(std::make_pair(0.25*_pi, 0.0008230));
00042 _angleThickness.insert(std::make_pair(0.50*_pi, 0.0008560));
00043 _angleThickness.insert(std::make_pair(0.75*_pi, 0.0009093));
00044 _angleThickness.insert(std::make_pair(1.00*_pi, 0.0009246));
00045 _angleThickness.insert(std::make_pair(1.25*_pi, 0.0009169));
00046 _angleThickness.insert(std::make_pair(1.50*_pi, 0.0008814));
00047 _angleThickness.insert(std::make_pair(1.75*_pi, 0.0008433));
00048 _angleThickness.insert(std::make_pair(2.00*_pi+1.e-8 , 0.0008204));
00049 }
00050
00051
00052 double thicknessPhi(double phi)
00053 {
00054 DDMap::iterator itl = _angleThickness.lower_bound(phi);
00055 assert(itl != _angleThickness.begin());
00056 DDMap::iterator itb = itl;
00057 --itb;
00058
00059 const double slope = (itl->second-itb->second)/(itl->first-itb->first);
00060 const double thickness = itb->second +(phi-itb->first)*slope;
00061
00062 return thickness;
00063 }
00064
00065 double thickness(shells::SElementS* element)
00066 {
00067
00068 double center[3];
00069 shells::SElementTriangleAverage<double*> cfunc;
00070 cfunc(element, center);
00071
00072 double phi = std::atan2(center[1], center[0]);
00073
00074 if (center[1] < 0) phi = 2.0*_pi+phi;
00075
00076 return thicknessPhi(phi);
00077 }
00078 };
00079
00080 const double ImperfectThickness::_pi = 3.14159265;
00081
00082 }
00083
00084 #endif