source: sasview/src/sas/sascalc/simulation/pointsmodelpy/libpointsmodelpy/lores_model.h @ 7949dcf7

Last change on this file since 7949dcf7 was d85c194, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 9 years ago

Remaining modules refactored

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/** \file lores_model.h child class of PointsModel*/
2
3#ifndef LORESMODEL_H
4#define LORESMODEL_H
5
6#include <deque>
7#include "points_model.h"
8#include "geo_shape.h"
9//temporary
10#include <fstream>
11
12/**
13 *  Class LORESModel, low resolution models
14 */
15
16class LORESModel : public PointsModel {
17 private:
18  typedef vector<Point3D> PointsVector;
19
20  struct RealSpaceShape {
21    GeoShape* shape;
22    PointsVector points;
23
24    RealSpaceShape(GeoShape* s = NULL) : shape(s) {
25    }
26
27    ~RealSpaceShape() {
28      if (shape) delete shape;
29    }
30  };
31
32  typedef deque<RealSpaceShape*> RealSpaceShapeCollection;
33
34 public:
35  LORESModel(double density = 1.0);
36  ~LORESModel();
37
38  // Change density
39  void SetDensity(double density);
40  double GetDensity();
41
42  // Add new shape
43  void Add(GeoShape& geo_shape, double sld = 1);
44
45  // Delete ith shape at shapes_
46  void Delete(size_t i);
47
48  int GetPoints(Point3DVector &);
49  //Write points to a file, mainly for testing right now
50  void WritePoints2File(Point3DVector &);
51
52  //get the maximum possible dimension
53  double GetDimBound();
54
55  //will be used in determining the maximum distance for
56  //P(r) calculation for a complex model (merge several
57  //pointsmodel instance together
58  vector<double> GetCenter();
59
60 protected:
61  GeoShape* GetGeoShape(GeoShape& geo_shape);
62  void FillPoints(RealSpaceShape* real_shape, double sld);
63  bool IsInside(const Point3D& point);
64  void DistributePoint(const Point3D& point, size_t i);
65
66 private:
67  RealSpaceShapeCollection shapes_;
68  int npoints_;
69  double density_;
70 
71};
72
73#endif
Note: See TracBrowser for help on using the repository browser.