00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef LUCUS_H
00013 #define LOCUS_H
00014
00015 #include <vector>
00016 #include <set>
00017 #include <string>
00018
00019 #ifdef HAVE_CONFIG_H
00020 #include <config.h>
00021 #endif
00022
00023 #include "tripleint.h"
00024 #include "tripledouble.h"
00025
00026
00027 class Nodegroup;
00028 #ifdef HAVE_LIBGTS
00029 class GtsInterface;
00030 #endif
00031 class Parser;
00032 class Simulation;
00033 class Lattice;
00034 class Mask;
00035
00036 using namespace std;
00037
00038 class Locus {
00039
00040 private:
00041 vector<int> indices;
00042 vector<int> bounds;
00043 vector<int> bounds_indices;
00044 vector<string> commands;
00045 Simulation *sim;
00046 #ifdef HAVE_LIBGTS
00047 GtsInterface *gts;
00048 #endif
00049 vector<string> labels;
00050 Mask* mask;
00051 int lblock[6];
00052 double pblock[6];
00053 bool walls[6];
00054 string between1;
00055 string between2;
00056 vector<TripleInt> lpoints;
00057 vector<TripleDouble> ppoints;
00058 vector<int> ind;
00059 bool periodic;
00060
00061 set<int>* nodeset;
00062 void (Locus::*inserter)(int);
00063
00064 public:
00065
00066 Locus(Simulation*);
00067
00068 ~Locus();
00069
00070 void read(Parser*);
00071 void read(Parser*, Lattice*);
00072 void init();
00073 void initSet();
00074 void initSet(set<int>*);
00075 void init(Lattice*);
00076 void init(Lattice*, bool);
00077 int calculateBounds(Lattice*);
00078 vector<int>* getBounds() {return &bounds;};
00079 void calculateBoundsIndices(Lattice*);
00080 vector<int>* getBoundsIndices() {return &bounds_indices;};
00081 bool isEverywhere();
00082 bool isGroup();
00083 vector<string>* getLabels() {return &labels;};
00084 vector<int>* getIndices() {return &indices;};
00085 vector<string>* getCommands() {return &commands;};
00086
00087 string getLocusDescriptor();
00088
00089 private:
00090
00091 void setLabels(Parser*);
00092 #ifdef HAVE_LIBGTS
00093 void setGts(Parser*, bool);
00094 #endif
00095 void setMask(Parser*, int);
00096 void setLBlock(Parser*, int);
00097 void setPBlock(Parser*, int);
00098 void setWalls(Parser*, int);
00099 void setBetween(Parser*, string);
00100 void setLPoints(Parser*, int);
00101 void setPPoints(Parser*, int);
00102
00103 void initLabels(Lattice*);
00104 void initLBlock(Lattice*);
00105 void initPBlock(Lattice*);
00106 void initWalls(Lattice*);
00107 void initBetween(Lattice*, bool);
00108 void initLPoints(Lattice*, bool);
00109 void initPPoints(Lattice*, bool);
00110 void initInds(Lattice*);
00111
00112 inline void insert(int loc) {indices.push_back(loc);};
00113 inline void insertIfInSet(int loc) {if (nodeset->find(loc) != nodeset->end()) indices.push_back(loc);};
00114
00115 };
00116
00117 #endif