vtf-logo

shells/applications/cylinderElastic/helpers/DetonationPressure1D.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00004 //
00005 //                                   Fehmi Cirak
00006 //                        California Institute of Technology
00007 //                           (C) 2004 All Rights Reserved
00008 //
00009 // <LicenseText>
00010 //
00011 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00012 //
00013 #ifndef DETONATIONPRESSURE1D_H
00014 #define DETONATIONPRESSURE1D_H
00015 #include <vector>
00016 #include <map>
00017 #include <fstream>
00018 #include <iostream>
00019 #include <iterator>
00020 #include <utility>
00021 #include <cassert>
00022 
00023 
00024 namespace cylExp {
00025     struct DetonationPressure1D;
00026 }
00027 
00028 
00029 struct DetonationPressure1D {
00030 private:
00031     typedef std::map<double, double> DDMap;
00032     
00033     DDMap   _positionPressure;
00034 
00035 public:
00036 
00037     DetonationPressure1D() {
00038         std::ifstream ifs("./Pressure_180.txt");
00039         assert(ifs.is_open());
00040 
00041         std::istream_iterator<double> begin(ifs);
00042         std::vector<double> data(begin, std::istream_iterator<double>());
00043         
00044         const int lines = static_cast<int>(data.size()/2.);
00045         
00046         for (int i=0; i<lines; ++i) {
00047             std::pair<double, double> posPres(data[2*i], data[2*i+1]);
00048             _positionPressure.insert(posPres);
00049         }
00050     }
00051 
00052 
00053     double operator()(double time, double x, double y, double z) const {
00054 
00055         const double vcj = 2365;
00056         double zshift = z-time*vcj;
00057         
00058         DDMap::const_iterator it = _positionPressure.upper_bound(zshift);
00059 
00060         if (it==_positionPressure.end()) {
00061           return 0.0;           
00062         } else {
00063           return (it->second-80000.0);
00064         }
00065     }   
00066 
00067 };
00068 
00069 #endif

Generated on Fri Aug 24 13:00:24 2007 for SFC Thin-Shell Finite Element Solver by  doxygen 1.4.7