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

Function FetchArray

IO/CellGrid/vtkDGIOResponder.cxx:50–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50bool FetchArray(vtkDataArray*& array, const std::string& arrayName, const nlohmann::json& jSpec,
51 vtkCellGrid* grid, bool mandatory = true)
52{
53 auto jArray = jSpec.find(arrayName);
54 if (jArray == jSpec.end() || !jArray->is_array() || jArray->size() != 2)
55 {
56 if (mandatory)
57 {
58 vtkGenericWarningMacro("Specification has missing or malformed connectivity.");
59 }
60 return false;
61 }
62 else
63 {
64 auto arrayGroupName = (*jArray)[0].get<std::string>();
65 auto jArrayName = (*jArray)[1].get<std::string>();
66 auto* arrayGroup = grid->FindAttributes(vtkStringToken(arrayGroupName));
67 if (arrayGroup)
68 {
69 array = arrayGroup->GetArray(jArrayName.c_str());
70 }
71 else
72 {
73 vtkGenericWarningMacro(
74 "Connectivity \"" << arrayGroupName << "\", \"" << jArrayName << "\" not found.");
75 return false;
76 }
77 }
78 return true;
79}
80
81nlohmann::json CellSourceToJSON(const vtkDGCell::Source& spec,
82 const std::unordered_map<vtkAbstractArray*, vtkStringToken>& arrayLocations)

Callers 1

JSONToCellSourceFunction · 0.85

Calls 7

FindAttributesMethod · 0.80
vtkStringTokenFunction · 0.50
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
GetArrayMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected