1 // Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 // of Sandia, LLC (NTESS).  Under the terms of Contract DE-NA0003525 with
3 // NTESS, the U.S. Government retains certain rights in this software.
4 //
5 // See packages/seacas/LICENSE for details
6 
7 #include <Ioss_ConstructedVariableType.h>
8 #include <Ioss_Utils.h>
9 #include <Ioss_VariableType.h>
10 #include <cassert>
11 #include <string>
12 
ConstructedVariableType(const std::string & my_name,int number_components,bool delete_me)13 Ioss::ConstructedVariableType::ConstructedVariableType(const std::string &my_name,
14                                                        int number_components, bool delete_me)
15     : Ioss::VariableType(my_name, number_components, delete_me)
16 {
17 }
18 
ConstructedVariableType(int number_components,bool delete_me)19 Ioss::ConstructedVariableType::ConstructedVariableType(int number_components, bool delete_me)
20     : Ioss::VariableType(std::string("Real[") + std::to_string(number_components) +
21                              std::string("]"),
22                          number_components, delete_me)
23 {
24 }
25 
label(int which,const char)26 std::string Ioss::ConstructedVariableType::label(int which, const char /*suffix_sep*/) const
27 {
28   assert(which > 0 && which <= component_count());
29   if (component_count() == 1) {
30     return "";
31   }
32   return VariableType::numeric_label(which, component_count(), name());
33 }
34