| 51 | } |
| 52 | |
| 53 | void FEAdaptor::CoProcess(double time, unsigned int timeStep, bool lastTimeStep) |
| 54 | { |
| 55 | vtkNew<vtkCPDataDescription> dataDescription; |
| 56 | dataDescription->AddInput("input"); |
| 57 | dataDescription->SetTimeData(time, timeStep); |
| 58 | if (lastTimeStep == true) |
| 59 | { |
| 60 | // assume that we want to all the pipelines to execute if it |
| 61 | // is the last time step. |
| 62 | dataDescription->ForceOutputOn(); |
| 63 | } |
| 64 | if (this->Processor->RequestDataDescription(dataDescription) != 0) |
| 65 | { |
| 66 | vtkMultiProcessController* controller = vtkMultiProcessController::GetGlobalController(); |
| 67 | int numberOfProcesses = controller->GetNumberOfProcesses(); |
| 68 | int processId = controller->GetLocalProcessId(); |
| 69 | vtkNew<vtkHyperTreeGrid> hyperTreeGrid; |
| 70 | hyperTreeGrid->Initialize(); |
| 71 | int extent[6] = { processId, processId + 1, 0, 1, 0, 1 }; |
| 72 | hyperTreeGrid->SetGridExtent(extent); |
| 73 | hyperTreeGrid->SetDimension(3); |
| 74 | // hyperTreeGrid->SetOrientation(0); |
| 75 | hyperTreeGrid->SetBranchFactor(2); |
| 76 | // hyperTreeGrid->SetMaterialMaskIndex(nullptr); |
| 77 | |
| 78 | vtkNew<vtkDoubleArray> xCoords; |
| 79 | xCoords->SetNumberOfValues(2); |
| 80 | xCoords->SetValue(0, processId); |
| 81 | xCoords->SetValue(1, processId + 1.); |
| 82 | vtkNew<vtkDoubleArray> yCoords; |
| 83 | yCoords->SetNumberOfValues(2); |
| 84 | yCoords->SetValue(0, 0); |
| 85 | yCoords->SetValue(1, 1); |
| 86 | vtkNew<vtkDoubleArray> zCoords; |
| 87 | zCoords->SetNumberOfValues(2); |
| 88 | zCoords->SetValue(0, 0); |
| 89 | zCoords->SetValue(1, 1); |
| 90 | |
| 91 | hyperTreeGrid->SetXCoordinates(xCoords); |
| 92 | hyperTreeGrid->SetYCoordinates(yCoords); |
| 93 | hyperTreeGrid->SetZCoordinates(zCoords); |
| 94 | |
| 95 | hyperTreeGrid->GenerateTrees(); |
| 96 | |
| 97 | this->FillHTG(hyperTreeGrid); |
| 98 | |
| 99 | vtkCPInputDataDescription* inputDataDescription = |
| 100 | dataDescription->GetInputDescriptionByName("input"); |
| 101 | inputDataDescription->SetGrid(hyperTreeGrid); |
| 102 | |
| 103 | // Set whole extent |
| 104 | int wholeExtent[6] = { 0, numberOfProcesses, 0, 1, 0, 1 }; |
| 105 | inputDataDescription->SetWholeExtent(wholeExtent); |
| 106 | |
| 107 | this->Processor->CoProcess(dataDescription); |
| 108 | } |
| 109 | } |
| 110 |
no test coverage detected