CGBasicSelfTest.cpp File Reference

Classes

class  CGBasicSelfTest
 Tests if the different CG templates work correctly. More...
 

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
120 {
121  //declare the DPM problem and set the name
122  CGBasicSelfTest problem;
123  problem.setTimeMax(0.21); //a total of 5000 time steps
124 
125  //int n1 = 1000, n2 = 100, n3=20;
126  size_t n1 = 1000, n2 = 33, n3=10;
127  //define different coarse-graining objects (which should all result in the same mean values)
128  auto cg0 = problem.cgHandler.copyAndAddObject(CG<CGCoordinates::O>());
129  cg0->setTimeMin(0.21);
131  cg1->setN(n1);
132  cg1->setWidth(0.5/3.01);
133  cg1->setTimeMin(0.21);
135  cg2->setN(n2);
136  cg2->setWidth(0.5/3.01);
137  cg2->setTimeMin(0.21);
139  cg3->setN(n3);
140  cg3->setWidth(0.5/3.01);
141  cg3->setTimeMin(0.21);
143  cg4->setNZ(n1);
144  cg4->setWidth(0.5/2.01);
145  cg4->setTimeMin(0.21);
147  cg5->setN(n2);
148  cg5->setWidth(0.5/2.01);
149  cg5->setTimeMin(0.21);
151  cg6->setN(n3);
152  cg6->setWidth(0.5/2.01);
153  cg6->setTimeMin(0.21);
155  cg7->setNZ(n1);
156  cg7->setWidth(0.5/2.01);
157  cg7->setTimeMin(0.21);
159  cg8->setN(n2);
160  cg8->setWidth(0.5/2.01);
161  cg8->setTimeMin(0.21);
163  cg9->setN(n3);
164  cg9->setWidth(0.5/2.01);
165  cg9->setTimeMin(0.21);
167  cg10->setN(n1);
168  cg10->setWidth(0.5/2.01);
169  cg10->setTimeMin(0.21);
171  cg11->setN(n1);
172  cg11->setWidth(0.5/3.01);
173  cg11->setTimeMin(0.21);
175  cg12->setN(n1);
176  cg12->setWidth(0.5/2.01);
177  cg12->setTimeMin(0.21);
179  cg13->setN(n1);
180  cg13->setWidth(0.5/3.01);
181  cg13->setTimeMin(0.21);
182 
183  //run the simulation
184  problem.solve(argc, argv);
185 
186  helpers::writeToFile("CGBasicSelfTest.1D.gnu","p 'CGBasicSelfTest.1.stat' u 2:22 w d, 'CGBasicSelfTest.4.stat' u 2:22 w d, 'CGBasicSelfTest.7.stat' u 2:22 w d");
187  helpers::writeToFile("CGBasicSelfTest.2D.gnu","sp 'CGBasicSelfTest.8.stat' u 2:3:23 w d");
188 }
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:379
Tests if the different CG templates work correctly.
Definition: CGBasicSelfTest.cpp:76
Evaluates time-resolved continuum fields and writes the data into a stat file.
Definition: CG.h:76
CGHandler cgHandler
Object of the class cgHandler.
Definition: DPMBase.h:1473
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:873
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:58

References DPMBase::cgHandler, BaseHandler< T >::copyAndAddObject(), DPMBase::setTimeMax(), DPMBase::solve(), and helpers::writeToFile().