- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AnalysisAction/PairCorrelationAction.cpp
r623e89 r112b09 6 6 */ 7 7 8 #include "Helpers/MemDebug.hpp" 9 8 10 #include "Actions/AnalysisAction/PairCorrelationAction.hpp" 11 #include "CommandLineParser.hpp" 9 12 #include "analysis_correlation.hpp" 10 #include "boundary.hpp"11 #include "linkedcell.hpp"12 13 #include "log.hpp" 13 14 #include "element.hpp" 14 #include "molecule.hpp"15 15 #include "periodentafel.hpp" 16 #include "vector.hpp"17 16 #include "World.hpp" 18 17 … … 38 37 Dialog *dialog = UIFactory::getInstance().makeDialog(); 39 38 int ranges[3] = {1, 1, 1}; 39 double BinStart = 0.; 40 40 double BinEnd = 0.; 41 double BinStart = 0.;42 double BinWidth = 0.;43 molecule *Boundary = NULL;44 41 string outputname; 45 42 string binoutputname; … … 47 44 ofstream output; 48 45 ofstream binoutput; 49 std::vector< element *> elements; 50 string type; 51 Vector Point; 52 BinPairMap *binmap = NULL; 53 MoleculeListClass *molecules = World::getInstance().getMolecules(); 46 const element *elemental1; 47 const element *elemental2; 54 48 55 // first dialog: Obtain which type of correlation 56 dialog->queryString(NAME, &type, MapOfActions::getInstance().getDescription(NAME)); 57 if(dialog->display()) { 58 delete dialog; 59 } else { 60 delete dialog; 61 return Action::failure; 62 } 63 64 // second dialog: Obtain parameters specific to this type 65 dialog = UIFactory::getInstance().makeDialog(); 66 if (type == "P") 67 dialog->queryVector("position", &Point, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("position")); 68 if (type == "S") 69 dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id")); 70 dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements")); 49 dialog->queryElement("elements", &elemental1, MapOfActions::getInstance().getDescription("elements")); 50 dialog->queryElement("elements", &elemental2, MapOfActions::getInstance().getDescription("elements")); 71 51 dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start")); 72 dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width"));73 52 dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end")); 74 53 dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file")); … … 80 59 binoutput.open(binoutputname.c_str()); 81 60 PairCorrelationMap *correlationmap = NULL; 82 if (type == "E") { 83 PairCorrelationMap *correlationmap = NULL; 84 if (periodic) 85 correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elements, ranges); 86 else 87 correlationmap = PairCorrelation(World::getInstance().getMolecules(), elements); 88 //OutputCorrelationToSurface(&output, correlationmap); 89 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd ); 90 } else if (type == "P") { 91 cout << "Point to correlate to is " << Point << endl; 92 CorrelationToPointMap *correlationmap = NULL; 93 if (periodic) 94 correlationmap = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges); 95 else 96 correlationmap = CorrelationToPoint(molecules, elements, &Point); 97 //OutputCorrelationToSurface(&output, correlationmap); 98 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd ); 99 } else if (type == "S") { 100 ASSERT(Boundary != NULL, "No molecule specified for SurfaceCorrelation."); 101 const double radius = 4.; 102 double LCWidth = 20.; 103 if (BinEnd > 0) { 104 if (BinEnd > 2.*radius) 105 LCWidth = BinEnd; 106 else 107 LCWidth = 2.*radius; 108 } 109 110 // get the boundary 111 class Tesselation *TesselStruct = NULL; 112 const LinkedCell *LCList = NULL; 113 // find biggest molecule 114 int counter = molecules->ListOfMolecules.size(); 115 bool *Actives = new bool[counter]; 116 counter = 0; 117 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 118 Actives[counter++] = (*BigFinder)->ActiveFlag; 119 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true; 120 } 121 LCList = new LinkedCell(Boundary, LCWidth); 122 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); 123 CorrelationToSurfaceMap *surfacemap = NULL; 124 if (periodic) 125 surfacemap = PeriodicCorrelationToSurface( molecules, elements, TesselStruct, LCList, ranges); 126 else 127 surfacemap = CorrelationToSurface( molecules, elements, TesselStruct, LCList); 128 OutputCorrelationToSurface(&output, surfacemap); 129 // check whether radius was appropriate 130 { 131 double start; double end; 132 GetMinMax( surfacemap, start, end); 133 if (LCWidth < end) 134 DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl); 135 } 136 binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd ); 137 } else 138 return Action::failure; 61 if (periodic) 62 correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elemental1, elemental2, ranges); 63 else 64 correlationmap = PairCorrelation(World::getInstance().getMolecules(), elemental1, elemental2); 65 //OutputCorrelationToSurface(&output, correlationmap); 66 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 139 67 OutputCorrelation ( &binoutput, binmap ); 140 68 output.close();
Note:
See TracChangeset
for help on using the changeset viewer.