00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _ARBCART_GRID2D_H_
00032 #define _ARBCART_GRID2D_H_
00033
00034 #include <vector>
00035 #include <string>
00036 #include <list>
00037 #include "CartesianNode2D.h"
00038 #include "grid_enums.h"
00039 #include "Anomaly2D.h"
00040
00041 namespace FDDlib {
00042
00049 class ArbitraryCartesianGrid2D {
00050 public:
00051
00053 static const int DEFAULT_SPACING = 1;
00054
00055 protected:
00056
00058 int numx_;
00059
00061 int numy_;
00062
00066 struct s_offsets {
00068 int xoffset;
00069
00071 int yoffset;
00072
00073 };
00074
00076 std::vector<CartesianNode2D> nodeList_;
00077
00079 double energySpeed_;
00080
00082 int numActiveNodes_;
00083
00085 std::vector<double> deltax;
00086
00088 std::vector<double> deltay;
00089
00091 void setupNodes() throw(std::string);
00092
00094 static const int UNKNOWN_NUMACTIVE = -1;
00095
00096 public:
00097
00105 ArbitraryCartesianGrid2D(int numx, int numy,
00106 double energySpeed) throw(std::string);
00107
00117 ArbitraryCartesianGrid2D(int numx, int numy,
00118 double energySpeed,
00119 const std::vector<double> &dx,
00120 const std::vector<double> &dy) throw(std::string);
00121
00123 virtual ~ArbitraryCartesianGrid2D();
00124
00133 void setDelta(const std::vector<double> &dx,
00134 const std::vector<double> &dy) throw(std::string);
00135
00137 std::vector<double> getDxList() const;
00138
00140 std::vector<double> getDyList() const;
00141
00143 virtual double averageDx() const;
00144
00146 virtual double averageDy() const;
00147
00148
00150 int numX() const;
00151
00153 int numY() const;
00154
00169 virtual void computeNormals(int maxneighbors, int order, double tol)
00170 throw(std::string);
00171
00179 virtual void analyticalNormals() throw(std::string);
00180
00184 std::list<CartesianNode2D*> getBorderBySide(gridSide2D side) const;
00185
00187 std::list<CartesianNode2D*> getAllBorders() const;
00188
00196 int offsetsToIndex(int xoffset, int yoffset) const throw(std::string);
00197
00199 CartesianNode2D* getNode(int ind) const throw(std::string);
00200
00202 int numNodes() const;
00203
00207 void fillUniformProperty(Property* prop) throw(std::string);
00208
00213 void insertAnomaly(const Anomaly2D& anom);
00214
00216 void setEnergySpeed(double energySpeed);
00217
00219 double getEnergySpeed() const;
00220
00224 int numActiveNodes() const throw(std::string);
00225
00229 void generateLinearIndices();
00230
00232 int numBorderNodes() const;
00233
00234 };
00235
00236 }
00237
00238 #endif