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

Function PutArray

IO/CellGrid/vtkDGIOResponder.cxx:18–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16{
17
18bool PutArray(vtkDataArray* array, const std::string& arrayRole, nlohmann::json& jSpec,
19 const std::unordered_map<vtkAbstractArray*, vtkStringToken>& arrayLocations)
20{
21 std::string arrayGroup;
22 std::string arrayName;
23 auto it = arrayLocations.find(array);
24 if (it != arrayLocations.end())
25 {
26 if (!it->second.Data().empty())
27 {
28 arrayGroup = it->second.Data();
29 }
30 else
31 {
32 std::ostringstream groupId;
33 groupId << it->second.Data();
34 arrayGroup = groupId.str();
35 }
36 }
37 arrayName = array ? array->GetName() : "";
38 if (!arrayGroup.empty() && !arrayName.empty())
39 {
40 jSpec[arrayRole] = nlohmann::json::array({ arrayGroup, arrayName });
41 }
42 else
43 {
44 vtkGenericWarningMacro("No array group contains array " << array << " or array is null.");
45 return false;
46 }
47 return true;
48}
49
50bool FetchArray(vtkDataArray*& array, const std::string& arrayName, const nlohmann::json& jSpec,
51 vtkCellGrid* grid, bool mandatory = true)

Callers 1

CellSourceToJSONFunction · 0.85

Calls 7

arrayClass · 0.85
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
DataMethod · 0.45
strMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected