------------------------------------------------------------------------------
| 85 | |
| 86 | //------------------------------------------------------------------------------ |
| 87 | void AttachPulseToGrid(vtkUniformGrid* grid) |
| 88 | { |
| 89 | assert("pre: grid is nullptr!" && (grid != nullptr)); |
| 90 | |
| 91 | vtkNew<vtkDoubleArray> xyz; |
| 92 | xyz->SetName("GaussianPulse"); |
| 93 | xyz->SetNumberOfComponents(1); |
| 94 | xyz->SetNumberOfTuples(grid->GetNumberOfCells()); |
| 95 | |
| 96 | for (int cellIdx = 0; cellIdx < grid->GetNumberOfCells(); ++cellIdx) |
| 97 | { |
| 98 | double center[3]; |
| 99 | AMRCommon::ComputeCellCenter(grid, cellIdx, center); |
| 100 | |
| 101 | double r = 0.0; |
| 102 | for (int i = 0; i < 3; ++i) |
| 103 | { |
| 104 | double dx = center[i] - Pulse.origin[i]; |
| 105 | r += (dx * dx) / (Pulse.width[i] * Pulse.width[i]); |
| 106 | } |
| 107 | double f = Pulse.amplitude * std::exp(-r); |
| 108 | |
| 109 | xyz->SetTuple1(cellIdx, f); |
| 110 | } // END for all cells |
| 111 | |
| 112 | grid->GetCellData()->AddArray(xyz); |
| 113 | } |
| 114 | //------------------------------------------------------------------------------ |
| 115 | vtkOverlappingAMR* GetAMRDataSet() |
| 116 | { |
no test coverage detected