00001 00002 #ifndef _MC_GRID_3D_SCALAR_HPP_ 00003 #define _MC_GRID_3D_SCALAR_HPP_ 00004 00005 #include <MC_grid_3d.hpp> 00006 #include <MC_int_vector.hpp> 00007 #include <MC_v3d.hpp> 00008 00009 namespace mesh_conv 00010 { 00011 namespace implicit 00012 { 00013 class MC_potential_sphere; 00014 } 00015 00017 class MC_grid_3d_scalar 00018 { 00019 public: 00020 00021 // ********************************************* // 00022 // ********************************************* // 00023 // CONSTRUCTORS 00024 // ********************************************* // 00025 // ********************************************* // 00026 00028 MC_grid_3d_scalar(); 00030 MC_grid_3d_scalar(const MC_int_vector& given_size,const MC_v3d& real_size=MC_v3d(1,1,1),const MC_v3d& offset=MC_v3d(0,0,0)); 00031 00032 00033 // ********************************************* // 00034 // ********************************************* // 00035 // Size 00036 // ********************************************* // 00037 // ********************************************* // 00038 00040 const MC_int_vector& size() const; 00042 bool is_within_bound(const MC_v3d& x) const; 00044 bool is_within_bound_voxel(const MC_int_vector& x) const; 00045 00046 00047 // ********************************************* // 00048 // ********************************************* // 00049 // Fill 00050 // ********************************************* // 00051 // ********************************************* // 00052 00054 void fill(const float& value); 00055 00056 // ********************************************* // 00057 // ********************************************* // 00058 // Dimension and conversion 00059 // ********************************************* // 00060 // ********************************************* // 00061 00063 const MC_v3d& dimension() const; 00065 MC_v3d& dimension(); 00066 00068 const MC_v3d& offset() const; 00070 MC_v3d& offset(); 00071 00073 MC_v3d convert_real_to_voxel_index(const MC_v3d& x) const; 00075 MC_v3d convert_voxel_index_to_real(const MC_v3d& u) const; 00076 00077 00078 // ********************************************* // 00079 // ********************************************* // 00080 // get and set values 00081 // ********************************************* // 00082 // ********************************************* // 00083 00085 const float& get(const MC_int_vector& u) const; 00087 float& get(const MC_int_vector& u); 00089 void set(const MC_int_vector& u,const float& value); 00090 00091 00093 float operator()(const MC_v3d& x) const; 00094 00095 00096 // ********************************************* // 00097 // ********************************************* // 00098 // Add potential object 00099 // ********************************************* // 00100 // ********************************************* // 00101 00103 void add_potential(const implicit::MC_potential_sphere& sphere_implicit); 00104 00105 00106 // ********************************************* // 00107 // ********************************************* // 00108 // Evaluator 00109 // ********************************************* // 00110 // ********************************************* // 00111 00113 float linear_interpolation(const MC_v3d& x) const; 00114 00115 00116 00117 private: 00118 00120 MC_grid_3d<float> potential; 00121 00123 MC_v3d dimension_internal; 00125 MC_v3d offset_internal; 00126 00127 }; 00128 } 00129 00130 #endif
1.6.1