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

Method SetActiveAttribute

Common/DataModel/vtkDataObject.cxx:305–395  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

303
304//------------------------------------------------------------------------------
305vtkInformation* vtkDataObject::SetActiveAttribute(
306 vtkInformation* info, int fieldAssociation, const char* attributeName, int attributeType)
307{
308 int i;
309 vtkInformation* fieldDataInfo;
310 vtkInformationVector* fieldDataInfoVector;
311
312 if (fieldAssociation == FIELD_ASSOCIATION_POINTS)
313 {
314 fieldDataInfoVector = info->Get(POINT_DATA_VECTOR());
315 }
316 else if (fieldAssociation == FIELD_ASSOCIATION_CELLS)
317 {
318 fieldDataInfoVector = info->Get(CELL_DATA_VECTOR());
319 }
320 else if (fieldAssociation == FIELD_ASSOCIATION_VERTICES)
321 {
322 fieldDataInfoVector = info->Get(VERTEX_DATA_VECTOR());
323 }
324 else if (fieldAssociation == FIELD_ASSOCIATION_EDGES)
325 {
326 fieldDataInfoVector = info->Get(EDGE_DATA_VECTOR());
327 }
328 else
329 {
330 vtkGenericWarningMacro("Unrecognized field association!");
331 return nullptr;
332 }
333 if (!fieldDataInfoVector)
334 {
335 fieldDataInfoVector = vtkInformationVector::New();
336 if (fieldAssociation == FIELD_ASSOCIATION_POINTS)
337 {
338 info->Set(POINT_DATA_VECTOR(), fieldDataInfoVector);
339 }
340 else if (fieldAssociation == FIELD_ASSOCIATION_CELLS)
341 {
342 info->Set(CELL_DATA_VECTOR(), fieldDataInfoVector);
343 }
344 else if (fieldAssociation == FIELD_ASSOCIATION_VERTICES)
345 {
346 info->Set(VERTEX_DATA_VECTOR(), fieldDataInfoVector);
347 }
348 else // if (fieldAssociation == FIELD_ASSOCIATION_EDGES)
349 {
350 info->Set(EDGE_DATA_VECTOR(), fieldDataInfoVector);
351 }
352 fieldDataInfoVector->FastDelete();
353 }
354
355 // if we find a matching field, turn it on (active); if another field of same
356 // attribute type was active, turn it off (not active)
357 vtkInformation* activeField = nullptr;
358 int activeAttribute;
359 const char* fieldName;
360 for (i = 0; i < fieldDataInfoVector->GetNumberOfInformationObjects(); i++)
361 {
362 fieldDataInfo = fieldDataInfoVector->GetInformationObject(i);

Callers 15

ReadAttributeIndicesMethod · 0.45
AssignAttributeMethod · 0.45
vtkUpdateCellsV8toV9Function · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45
RequestDataMethod · 0.45
CopyAttributeDataMethod · 0.45
CopyAllocateMethod · 0.45
BuildPrototypeMethod · 0.45

Calls 6

FastDeleteMethod · 0.80
GetInformationObjectMethod · 0.80
NewFunction · 0.50
GetMethod · 0.45
SetMethod · 0.45
AppendMethod · 0.45

Tested by 2

TestEdgeFlagsFunction · 0.36