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

Function Model

IO/IOSS/vtkIOSSModel.cxx:1104–1153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1102 }
1103
1104 void Model(Ioss::Region& region) const override
1105 {
1106 auto* nodeBlock = region.get_node_block(this->Name);
1107 nodeBlock->put_field_data("ids", this->Ids);
1108
1109 // add mesh coordinates
1110 using Dispatcher = vtkArrayDispatch::DispatchByArray<vtkArrayDispatch::AllPointArrays>;
1111 PutFieldWorker<double> worker(3, this->Ids.size(), false /* createAOS */);
1112 for (size_t dsIndex = 0; dsIndex < this->DataSets.size(); ++dsIndex)
1113 {
1114 auto& ds = this->DataSets[dsIndex];
1115 auto& lids = this->IdsRaw[dsIndex];
1116 worker.SetSourceIds(&lids);
1117 if (ds->GetPoints())
1118 {
1119 if (!Dispatcher::Execute(ds->GetPoints()->GetData(), worker))
1120 {
1121 vtkLog(ERROR, "Failed to dispatch points.");
1122 }
1123 }
1124 }
1125
1126 // if displacement array is present, offset the mesh coordinates by the
1127 // provided displacement.
1128 const auto displMagnitude =
1129 this->DataSets.empty() ? 0.0 : this->Writer->GetDisplacementMagnitude();
1130 const std::string displName =
1131 displMagnitude > 0 ? vtkIOSSUtilities::GetDisplacementFieldName(this->DataSets.front()) : "";
1132 if (!displName.empty() && displMagnitude > 0.0)
1133 {
1134 DisplacementWorker<double> dworker(worker.SOAData, displMagnitude);
1135 for (size_t dsIndex = 0; dsIndex < this->DataSets.size(); ++dsIndex)
1136 {
1137 auto& ds = this->DataSets[dsIndex];
1138 auto& lids = this->IdsRaw[dsIndex];
1139 dworker.SetSourceIds(&lids);
1140 if (auto dispArray = ds->GetPointData()->GetArray(displName.c_str()))
1141 {
1142 if (!Dispatcher::Execute(dispArray, dworker))
1143 {
1144 vtkLog(ERROR, "Failed to dispatch displacements.");
1145 }
1146 }
1147 }
1148 }
1149
1150 nodeBlock->put_field_data("mesh_model_coordinates_x", worker.SOAData[0]);
1151 nodeBlock->put_field_data("mesh_model_coordinates_y", worker.SOAData[1]);
1152 nodeBlock->put_field_data("mesh_model_coordinates_z", worker.SOAData[2]);
1153 }
1154
1155 void Transient(Ioss::Region& region) const override
1156 {

Callers

nothing calls this directly

Calls 13

GetDisplacementFieldNameFunction · 0.85
put_field_dataMethod · 0.80
ExecuteFunction · 0.50
sizeMethod · 0.45
SetSourceIdsMethod · 0.45
GetPointsMethod · 0.45
GetDataMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
GetArrayMethod · 0.45
GetPointDataMethod · 0.45

Tested by

no test coverage detected