MCPcopy Create free account
hub / github.com/Kitware/VTK / ExecuteDataWithInformation

Method ExecuteDataWithInformation

Imaging/Hybrid/vtkPointLoad.cxx:118–237  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Generate tensors and scalars for point load on semi-infinite domain.

Source from the content-addressed store, hash-verified

116// Generate tensors and scalars for point load on semi-infinite domain.
117//
118void vtkPointLoad::ExecuteDataWithInformation(vtkDataObject* outp, vtkInformation* outInfo)
119{
120 int i, j, k;
121 vtkFloatArray* newTensors;
122 double tensor[9];
123 vtkIdType numPts;
124 double P, twoPi, xP[3], rho, rho2, rho3, rho5, nu;
125 double x, x2, y, y2, z, z2, rhoPlusz2, zPlus2rho, txy, txz, tyz;
126 double sx, sy, sz, seff;
127 vtkImageData* output = this->AllocateOutputData(outp, outInfo);
128 vtkFloatArray* newScalars = vtkArrayDownCast<vtkFloatArray>(output->GetPointData()->GetScalars());
129 double *spacing, *origin;
130
131 vtkDebugMacro(<< "Computing point load stress tensors");
132
133 //
134 // Initialize self; create output objects
135 //
136 numPts = this->SampleDimensions[0] * this->SampleDimensions[1] * this->SampleDimensions[2];
137 spacing = output->GetSpacing();
138 origin = output->GetOrigin();
139 newTensors = vtkFloatArray::New();
140 newTensors->SetNumberOfComponents(9);
141 newTensors->Allocate(9 * numPts);
142 newTensors->SetName("PointLoadTensors");
143
144 //
145 // Compute the location of the load
146 //
147 xP[0] = (this->ModelBounds[0] + this->ModelBounds[1]) / 2.0; // in center
148 xP[1] = (this->ModelBounds[2] + this->ModelBounds[3]) / 2.0;
149 xP[2] = this->ModelBounds[5]; // at top of box
150 //
151 // Traverse all points evaluating implicit function at each point. Note that
152 // points are evaluated in local coordinate system of applied force.
153 //
154 twoPi = 2.0 * vtkMath::Pi();
155 P = -this->LoadValue;
156 int pointCount = 0;
157 for (k = 0; k < this->SampleDimensions[2]; k++)
158 {
159 z = xP[2] - (origin[2] + k * spacing[2]);
160 for (j = 0; j < this->SampleDimensions[1]; j++)
161 {
162 y = xP[1] - (origin[1] + j * spacing[1]);
163 for (i = 0; i < this->SampleDimensions[0]; i++)
164 {
165 x = (origin[0] + i * spacing[0]) - xP[0];
166 rho = sqrt(x * x + y * y + z * z); // in local coordinates
167 if (rho < 1.0e-10)
168 {
169 vtkWarningMacro(<< "Attempting to set singularity, resetting");
170 tensor[0] = VTK_FLOAT_MAX; // Component(0,0)
171 tensor[4] = VTK_FLOAT_MAX; // Component(1,1);
172 tensor[8] = VTK_FLOAT_MAX; // Component(2,2);
173 tensor[3] = 0.0; // Component(0,1);
174 tensor[6] = 0.0; // Component(0,2);
175 tensor[1] = 0.0; // Component(1,0);

Callers

nothing calls this directly

Calls 15

PiFunction · 0.85
SetTensorsMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
sqrtFunction · 0.50
AllocateOutputDataMethod · 0.45
GetScalarsMethod · 0.45
GetPointDataMethod · 0.45
GetSpacingMethod · 0.45
GetOriginMethod · 0.45
SetNumberOfComponentsMethod · 0.45
AllocateMethod · 0.45

Tested by

no test coverage detected