124 printf(
"[%03d] Lower: %g\t%g\t%g\n", rank, verts[0], verts[1], verts[2]);
125 printf(
"[%03d] Upper: %g\t%g\t%g\n", rank, verts[3], verts[4], verts[5]);
137 int nranks = size[0] * size[1] * size[2];
139 MPI_Offset offset = (step * size[0] * size[1] * size[2] * 11 + rank * 11) *
sizeof(
double);
143 buf[0] = (double)rank;
145 buf[2] = vertices.at(0)[0];
146 buf[3] = vertices.at(0)[1];
147 buf[4] = vertices.at(0)[2];
148 buf[5] = vertices.at(1)[0];
149 buf[6] = vertices.at(1)[1];
150 buf[7] = vertices.at(1)[2];
151 buf[8] = (double)(loc[0]);
152 buf[9] = (double)(loc[1]);
153 buf[10] = (double)(loc[2]);
156 MPI_File_write_at(fh, offset, buf, 11, MPI_DOUBLE, &state);
171 MPI_Init(&argc, &argv);
173 const int NumberOfSteps = 50;
176 std::string outputDir;
179 outputDir.assign(argv[1]);
182 outputDir.assign(
".");
184 const int Dimensions = 3;
185 const int LoadbalancerGamma = 0;
191 int MyLocation[3] = {0};
193 MPI_Comm_rank(MPI_COMM_WORLD, &MyLocation[2]);
194 int MyRank = MyLocation[2];
196 int NumberOfProcesses[3] = {1, 1, 1};
197 MPI_Comm_size(MPI_COMM_WORLD, &NumberOfProcesses[2]);
198 int MaximumRank = NumberOfProcesses[2];
200 std::stringstream ss;
201 ss << outputDir <<
"/" <<
"ALL_Staggered_" << NumberOfProcesses[2] <<
".bin";
202 std::string file = ss.str();
204 MPI_File_delete(file.c_str(), MPI_INFO_NULL);
205 MPI_File_open(MPI_COMM_WORLD, file.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh);
206 MPI_File_set_size(fh, NumberOfSteps * NumberOfProcesses[2] * 11 *
sizeof(MPI_DOUBLE));
207 MPI_File_preallocate(fh, NumberOfSteps * NumberOfProcesses[2] * 11 *
sizeof(MPI_DOUBLE));
211 printf(
"Ranks: %d\nNumber of Steps: %d\n", MaximumRank, NumberOfSteps);
214 MPI_Barrier(MPI_COMM_WORLD);
219 std::vector<int> MyLocationVector(MyLocation, MyLocation + 3);
220 std::vector<int> NumberOfProcessesVector(NumberOfProcesses, NumberOfProcesses + 3);
224 std::vector<double> MinimumDomainSize{0.1, 0.1, 0.1};
244 const double DomainSize = 1.0;
246 for (
int VertexIndex = 0; VertexIndex < 2; VertexIndex++)
248 for (
int DimensionIndex = 0; DimensionIndex < Dimensions; DimensionIndex++)
250 DomainVertices.at(VertexIndex)[DimensionIndex] = (MyLocation[DimensionIndex] + VertexIndex) * DomainSize;
253 double VertexArray[6];
259 double MyWork = (double)MyRank + 1.;
262 for (CurrentStep = 0; CurrentStep < NumberOfSteps; CurrentStep++)
268 printf(
"Starting step: %d/%d\n", CurrentStep + 1, NumberOfSteps);
271#ifdef ALL_VTK_OUTPUT_EXAMPLE
278 std::cout << e.
what() << std::endl;
286 std::vector<ALL::Point<double>> NewVertices = jall->
getVertices();
289 print_binary(CurrentStep, MyRank, MyWork, NewVertices, MyLocation, NumberOfProcesses, fh);
298#ifdef ALL_VTK_OUTPUT_EXAMPLE
305 std::cout << e.
what() << std::endl;
void print_binary(int step, int rank, double work, std::vector< ALL::Point< double > > &vertices, int *loc, int *size, MPI_File fh)