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

Method RecursivelyInitializePureMask

Common/DataModel/vtkHyperTreeGrid.cxx:1167–1230  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1165
1166//------------------------------------------------------------------------------
1167bool vtkHyperTreeGrid::RecursivelyInitializePureMask(
1168 vtkHyperTreeGridNonOrientedCursor* cursor, vtkDataArray* intercepts)
1169{
1170 // Retrieve mask value at cursor
1171 vtkIdType id = cursor->GetGlobalNodeIndex();
1172
1173 // 0 isn't masked : if not exist Mask or no masked
1174 // 1 is masked : if exist Mask and masked
1175 bool mask = this->HasMask() && this->Mask->GetValue(id);
1176
1177 // Check masked
1178 if (mask)
1179 {
1180 // If the cell is masked then the cell is not a pure material cell,
1181 // set PureMask to true
1182 this->PureMask->SetTuple1(id, true);
1183 return true;
1184 }
1185
1186 // Check is leaf
1187 if (cursor->IsLeaf())
1188 {
1189 // Check exist material interface intercepts
1190 if (intercepts)
1191 {
1192 if (intercepts->GetNumberOfComponents() != 3)
1193 {
1194 vtkErrorMacro("Intercepts array must have 3 components, but has "
1195 << intercepts->GetNumberOfComponents());
1196 return mask;
1197 }
1198 double values[3];
1199 intercepts->GetTuple(id, values);
1200 // If the type value is less than 2 then the cell has
1201 // one or two interfaces, it is not a pure material cell
1202 // (this cell is mixed), set PureMask to true;
1203 // else set PureMask to false
1204 mask = (values[2] < 2);
1205 }
1206 this->PureMask->SetTuple1(id, mask);
1207 return mask;
1208 }
1209
1210 // The cell is coarse, iterate over all children
1211 unsigned int numChildren = this->GetNumberOfChildren();
1212 for (unsigned int child = 0; child < numChildren; ++child)
1213 {
1214 cursor->ToChild(child);
1215 // Recursively initialize pure material mask
1216 // The initialization of the PureMask for a coarse cell
1217 // depends on the values associated with each of
1218 // its children. As soon as one of her daughters is PureMask
1219 // then she is too.
1220 // WARNING Nevertheless, it is essential to continue the
1221 // in-depth journey in order to update all the values of
1222 // PureMask offering the possibility of optimization at
1223 // a higher level.
1224 mask |= this->RecursivelyInitializePureMask(cursor, intercepts);

Callers 1

GetPureMaskMethod · 0.95

Calls 10

HasMaskMethod · 0.95
SetTuple1Method · 0.80
GetGlobalNodeIndexMethod · 0.45
GetValueMethod · 0.45
IsLeafMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetTupleMethod · 0.45
GetNumberOfChildrenMethod · 0.45
ToChildMethod · 0.45
ToParentMethod · 0.45

Tested by

no test coverage detected