NPSpec  0.2.0
Solve for the spectral properties of nanoparticles easily
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
nanoparticle.hpp
Go to the documentation of this file.
1 
10 #ifndef NANOPARTICLE_H
11 #define NANOPARTICLE_H
12 
13 #include "npspec/constants.h"
14 #include <string>
15 
28 {
29 public:
31 
42  Nanoparticle();
43 
45 
59  int calculateSpectrum();
60 
62 
71  void getSpectrum(double spec[NPSpec::NLAMBDA]) const;
72 
74 
87  void getRGB(double &r, double &g, double &b) const;
88 
90 
103  void getHSV(double &h, double &s, double &v) const;
104 
106 
108  double getOpacity() const;
109 
111 
112  int getNLayers() const;
113 
115 
117 
119 
121 
123 
125 
127 
134  double getSphereRadius() const;
135 
137 
144  double getEllipsoidZRadius() const;
145 
147 
159  double getEllipsoidXYRadius() const;
160 
162 
178  double getSphereLayerRelativeRadius(int layer_num) const;
179 
181 
197  double getEllipsoidLayerZRelativeRadius(int layer_num) const;
198 
200 
216  double getEllipsoidLayerXYRelativeRadius(int layer_num) const;
217 
219 
225  std::string getLayerMaterial(int layer_num) const;
226 
228 
234  int getLayerIndex(int layer_num) const;
235 
237 
238  int getIncrement() const;
239 
241 
242  double getPathLength() const;
243 
245 
246  double getConcentration() const;
247 
249 
250  bool getSizeCorrect() const;
251 
253 
254  double getMediumRefractiveIndex() const;
255 
257 
267  void setNLayers(int nlay);
268 
270  /* \param npshape The new shape of the nanoparticle.
271  *
272  * \warning For an ellipse a max of two layers are allowed.
273  *
274  * \remark
275  * When you change the shape of the nanoparticle, the parameters for
276  * the other shape remain in memory so you can switch back and forth
277  * and not have to reset the parameters.
278  */
279  void setShape(NPSpec::NanoparticleShape npshape);
280 
282 
285 
287 
290 
292 
303  void setSphereRadius(double rad);
304 
306 
323  void setEllipsoidRadius(double zrad, double xyrad);
324 
326 
343  void setSphereLayerRelativeRadius(int layer_num, double rrad);
344 
346 
370  void setEllipsoidLayerRelativeRadius(int layer_num, double zrrad, double xyrrad);
371 
373 
384  void setLayerMaterial(int layer_num, std::string mat);
385 
387 
393  void setIncrement(int i);
394 
396 
400  void setPathLength(double len);
401 
403 
407  void setConcentration(double conc);
408 
410 
418  void setSizeCorrect(bool corr);
419 
421 
424  void setMediumRefractiveIndex(double mref);
425 
426 private:
427  // Private functions
428  void updateRadius(NPSpec::NanoparticleShape npshape);
429  void updateRelativeRadius(NPSpec::NanoparticleShape npshape);
430  void distributeRelativeRadius(int n, double rrad, double array[NPSpec::MAXLAYERS]);
431 
432  // Input parameters to solvers
433  int nLayers;
434  NPSpec::SpectraType sType;
437  int increment;
438  bool sizeCorrect;
439  double pathLength;
440  double concentration;
441  double mediumRefractiveIndex;
442  std::string materials[NPSpec::MAXLAYERS];
443  int materialIndex[NPSpec::MAXLAYERS];
444  double radius[2];
445  double relativeRadius[NPSpec::MAXLAYERS][2];
446 
447  // Auxillary
448  double sphereRadius;
449  double sphereRelativeRadius[NPSpec::MAXLAYERS];
450  double ellipsoidRadius[2];
451  double ellipsoidRelativeRadius[NPSpec::MAXLAYERS][2];
452 
453  // Results
454  double extinction[NPSpec::NLAMBDA];
455  double scattering[NPSpec::NLAMBDA];
456  double absorbance[NPSpec::NLAMBDA];
457  double red;
458  double blue;
459  double green;
460  double hue;
461  double saturation;
462  double value;
463 
464 };
465 
466 
467 #endif // NANOPARTICLE_H