[vtk-developers] New nonlinear celltypes
Soeren Gebbert
soeren.gebbert at inpro.de
Tue Jan 10 11:16:24 EST 2006
David C. Thompson wrote:
>On Mon, 2006-01-09 at 13:33, John Platt wrote:
>
>
>>... I have just had a quick look at the version of
>>vtkQuadraticHexahedron::Contour() I am using from 4.4. The call to the
>>linear Hex contouring
>>
>> this->Hex->Contour(value,this->Scalars,locator,verts,lines,polys,
>> this->PointData,outPd,this->CellData,0,outCd);
>>
>>takes the local PointData and CellData from Subdivide(). Your call
>>
>> this->Hex->Contour(value,this->Scalars,locator,verts,lines,polys,
>> inPd, outPd, inCd, cellId, outCd);
>>
>>passes the dataset point and cell data.
>>
>>
>You know, I looked at that and assumed that all Subdivide() did was make
>a local copy with 27 instead of 20 nodes. Since the 27-node hex didn't
>need to generate mid-face and body points, I thought it would be OK to
>pass them directly and didn't even think about indexing, but you're
>right... that might cause trouble.
>
>
>
I thought it would be smart to pass the inPd and inCd direct to the
clipping/contouring methods to spare some
memory. (this->PointData, this->CellData and this->CellScalars are not
needed anymore, will be not declared or initialized).
Because, as David sayd, the 27 node Hex dont need subdivision or data
interpolation.
But i made two implementation's:
1.) with data interpolation (like vtkQuadrataicHexahedron)
//----------------------------------------------------------------------------
// Clip this triquadratic hex using scalar value provided. Like contouring,
// except that it cuts the hex to produce tetrahedra.
void
vtkTriQuadraticHexahedron::Clip (double value,
vtkDataArray * cellScalars,
vtkPointLocator * locator,
vtkCellArray * tets,
vtkPointData * inPd,
vtkPointData * outPd,
vtkCellData * inCd, vtkIdType cellId, vtkCellData *
outCd, int insideOut)
{
int i, j;
vtkPointData *PointData = vtkPointData::New();
vtkCellData *CellData = vtkCellData::New();
vtkDoubleArray *CellScalars = vtkDoubleArray::New();
PointData->Initialize();
CellData->Initialize();
CellScalars->Initialize();
PointData->CopyAllocate(inPd,27);
CellData->CopyAllocate(inCd,8);
CellScalars->SetNumberOfTuples(27);
for (i=0; i<27; i++)
{
PointData->CopyData(inPd,this->PointIds->GetId(i),i);
CellScalars->SetValue( i, cellScalars->GetTuple1(i));
}
CellData->CopyData(inCd,cellId,0);
//clip each linear hex separately
for (i = 0; i < 8; i++)
{
for (j = 0; j < 8; j++)
{
this->Hex->Points->SetPoint (j, this->Points->GetPoint
(LinearHexs[i][j]));
this->Hex->PointIds->SetId (j, LinearHexs[i][j]);
this->Scalars->SetValue (j, CellScalars->GetTuple1
(LinearHexs[i][j]));
}
this->Hex->Clip (value, this->Scalars, locator, tets, PointData,
outPd, CellData, cellId, outCd, insideOut);
}
PointData->Delete();
CellData->Delete();
CellScalars->Delete();
}
2.) without data interpolation
//----------------------------------------------------------------------------
// Clip this triquadratic hex using scalar value provided. Like contouring,
// except that it cuts the hex to produce tetrahedra.
void
vtkTriQuadraticHexahedron::Clip (double value,
vtkDataArray * cellScalars,
vtkPointLocator * locator,
vtkCellArray * tets,
vtkPointData * inPd,
vtkPointData * outPd,
vtkCellData * inCd, vtkIdType cellId, vtkCellData *
outCd, int insideOut)
{
int i, j;
//clip each linear hex separately
for (i = 0; i < 8; i++)
{
for (j = 0; j < 8; j++)
{
this->Hex->Points->SetPoint (j, this->Points->GetPoint
(LinearHexs[i][j]));
this->Hex->PointIds->SetId (j, LinearHexs[i][j]);
this->Scalars->SetValue (j, cellScalars->GetTuple1
(LinearHexs[i][j]));
}
this->Hex->Clip (value, this->Scalars, locator, tets, inPd, outPd,
inCd, cellId, outCd, insideOut);
}
}
Booth have the same problems, so the implementation
this->Hex->Clip (value, this->Scalars, locator, tets, inPd, outPd, inCd, cellId, outCd, insideOut);
seems to be correct (incorrect???) too. (numbering and stuff)
>>I don't know if this has changed at version 5.
>>
>>
>Nope. Although as of 4.4.2, there was a bug in clipping and contouring
>preventing them from working on more than a single cell because the
>point ids were being set incorrectly. It looks like Soeren got that part
>right. To see the difference run
> cd VTK/Common
> cvs diff -r 1.21 -r 1.22 vtkQuadraticHexahedron.cxx
>
> David
>
>
>
>
More information about the vtk-developers
mailing list