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

Method FindCell

Common/DataModel/vtkOverlappingAMRMetaData.cxx:876–912  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

874
875//------------------------------------------------------------------------------
876bool vtkOverlappingAMRMetaData::FindCell(
877 double q[3], unsigned int level, unsigned int id, int& cellIdx)
878{
879 if (this->HasSpacing(level))
880 {
881 double h[3];
882 this->GetSpacing(level, h);
883
884 const vtkAMRBox& box = this->GetAMRBox(level, id);
885 double gbounds[6];
886 this->GetBounds(level, id, gbounds);
887 if ((q[0] < gbounds[0]) || (q[0] > gbounds[1]) || (q[1] < gbounds[2]) || (q[1] > gbounds[3]) ||
888 (q[2] < gbounds[4]) || (q[2] > gbounds[5]))
889 {
890 return false;
891 }
892 int ijk[3];
893 double pcoords[3];
894 int status = vtkAMRBox::ComputeStructuredCoordinates(box, this->Origin, h, q, ijk, pcoords);
895 if (status == 1)
896 {
897 int dims[3];
898 box.GetNumberOfNodes(dims);
899 cellIdx = vtkStructuredData::ComputeCellId(dims, ijk);
900 return true;
901 }
902 }
903 else
904 {
905 // XXX: This cannot be implemented with block bounds but instead we should add
906 // vtkOverlappingAMR::FindCell and use the cartesian grid there when spacing is not available.
907 vtkErrorMacro("Cannot FindCell, please use SetSpacing");
908 return false;
909 }
910
911 return false;
912}
913
914//------------------------------------------------------------------------------
915bool vtkOverlappingAMRMetaData::GetCoarsenedAMRBox(

Callers

nothing calls this directly

Calls 6

HasSpacingMethod · 0.95
GetSpacingMethod · 0.95
GetAMRBoxMethod · 0.95
GetBoundsMethod · 0.95
GetNumberOfNodesMethod · 0.45

Tested by

no test coverage detected