| 968 | } |
| 969 | |
| 970 | void DefineFields(Ioss::GroupingEntity* block, |
| 971 | const std::vector<std::tuple<std::string, Ioss::Field::BasicType, int>>& fields, |
| 972 | Ioss::Field::RoleType role, int64_t elementCount) const |
| 973 | { |
| 974 | for (const auto& field : fields) |
| 975 | { |
| 976 | const auto& name = std::get<0>(field); |
| 977 | const auto& type = std::get<1>(field); |
| 978 | const auto& numComponents = std::get<2>(field); |
| 979 | switch (numComponents) |
| 980 | { |
| 981 | // fancier variable type names can be found in Ioss_ConcreteVariableType.C |
| 982 | case 1: |
| 983 | { |
| 984 | block->field_add(Ioss::Field(name, type, IOSS_SCALAR(), role, elementCount)); |
| 985 | break; |
| 986 | } |
| 987 | case 2: |
| 988 | { |
| 989 | block->field_add(Ioss::Field(name, type, IOSS_VECTOR_2D(), role, elementCount)); |
| 990 | break; |
| 991 | } |
| 992 | case 3: |
| 993 | { |
| 994 | block->field_add(Ioss::Field(name, type, IOSS_VECTOR_3D(), role, elementCount)); |
| 995 | break; |
| 996 | } |
| 997 | case 6: |
| 998 | { |
| 999 | block->field_add(Ioss::Field(name, type, IOSS_SYM_TENSOR(), role, elementCount)); |
| 1000 | break; |
| 1001 | } |
| 1002 | default: |
| 1003 | { |
| 1004 | for (int comp = 0; comp < numComponents; ++comp) |
| 1005 | { |
| 1006 | const auto compName = name + vtk::to_string(comp + 1); |
| 1007 | block->field_add(Ioss::Field(compName, type, IOSS_SCALAR(), role, elementCount)); |
| 1008 | } |
| 1009 | } |
| 1010 | } |
| 1011 | } |
| 1012 | } |
| 1013 | }; |
| 1014 | |
| 1015 | } // end namespace {} |
no test coverage detected