27 : fieldMetainfoImpl_(fieldMetainfoImpl),
31 : fieldMetainfoImpl_(other.fieldMetainfoImpl_),
35 *fieldMetainfoImpl_ = *other.fieldMetainfoImpl_;
41 int jMinusHalo,
int jPlusHalo,
int kMinusHalo,
int kPlusHalo,
42 int lMinusHalo,
int lPlusHalo) {
44 fieldMetainfoImpl_ = boost::make_shared<FieldMetainfoImpl>();
45 metainfo_.
setImpl(internal::make_shared_ptr<MetainfoMapImpl>(fieldMetainfoImpl_->metaInfoPtr()));
48 TypeID typeID = internal::TypeNameToTypeID(type);
49 fieldMetainfoImpl_->type() = typeID;
52 throw Exception(
"inconsistent bytes-per-element: got '%i' but according to passed type " 56 fieldMetainfoImpl_->dims() = std::vector<int>{
iSize,
jSize,
kSize, lSize};
60 metaInfo.
insert(
"__name", name);
61 metaInfo.
insert(
"__elementtype", type);
62 metaInfo.
insert(
"__bytesperelement", bytesPerElement);
63 metaInfo.
insert(
"__rank", rank);
64 metaInfo.
insert(
"__isize", iSize);
65 metaInfo.
insert(
"__jsize", jSize);
66 metaInfo.
insert(
"__ksize", kSize);
67 metaInfo.
insert(
"__lsize", lSize);
68 metaInfo.
insert(
"__iminushalosize", iMinusHalo);
69 metaInfo.
insert(
"__iplushalosize", iPlusHalo);
70 metaInfo.
insert(
"__jminushalosize", jMinusHalo);
71 metaInfo.
insert(
"__jplushalosize", jPlusHalo);
72 metaInfo.
insert(
"__kminushalosize", kMinusHalo);
73 metaInfo.
insert(
"__kplushalosize", kPlusHalo);
74 metaInfo.
insert(
"__lminushalosize", lMinusHalo);
75 metaInfo.
insert(
"__lplushalosize", lPlusHalo);
78 internal::throwSerializationException(
"Error: %s", e.what());
83 return fieldMetainfoImpl_->metaInfo().hasKey(
"__name")
84 ? fieldMetainfoImpl_->metaInfo().as<std::string>(
"__name")
89 return fieldMetainfoImpl_->metaInfo().hasKey(
"__elementtype")
90 ? fieldMetainfoImpl_->metaInfo().as<std::string>(
"__elementtype")
95 return fieldMetainfoImpl_->metaInfo().hasKey(
"__bytesperelement")
96 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__bytesperelement")
101 return fieldMetainfoImpl_->metaInfo().hasKey(
"__rank")
102 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__rank")
107 return fieldMetainfoImpl_->metaInfo().hasKey(
"__isize")
108 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__isize")
113 return fieldMetainfoImpl_->metaInfo().hasKey(
"__jsize")
114 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__jsize")
119 return fieldMetainfoImpl_->metaInfo().hasKey(
"__ksize")
120 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__ksize")
125 return fieldMetainfoImpl_->metaInfo().hasKey(
"__lsize")
126 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__lsize")
131 return fieldMetainfoImpl_->metaInfo().hasKey(
"__iminushalosize")
132 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__iminushalosize")
137 return fieldMetainfoImpl_->metaInfo().hasKey(
"__iplushalosize")
138 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__iplushalosize")
143 return fieldMetainfoImpl_->metaInfo().hasKey(
"__jminushalosize")
144 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__jminushalosize")
149 return fieldMetainfoImpl_->metaInfo().hasKey(
"__jplushalosize")
150 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__jplushalosize")
155 return fieldMetainfoImpl_->metaInfo().hasKey(
"__kminushalosize")
156 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__kminushalosize")
161 return fieldMetainfoImpl_->metaInfo().hasKey(
"__kplushalosize")
162 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__kplushalosize")
167 return fieldMetainfoImpl_->metaInfo().hasKey(
"__lminushalosize")
168 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__lminushalosize")
173 return fieldMetainfoImpl_->metaInfo().hasKey(
"__lplushalosize")
174 ? fieldMetainfoImpl_->metaInfo().as<
int>(
"__lplushalosize")
179 return (*fieldMetainfoImpl_ == *other.fieldMetainfoImpl_);
183 std::ostringstream ss;
184 const auto& metaInfo = fieldMetainfoImpl_->metaInfo();
186 std::string
name = metaInfo.hasKey(
"__name") ? metaInfo.as<std::string>(
"__name") :
"";
188 const auto& dims = fieldMetainfoImpl_->dims();
189 int iSize = dims.size() < 1 ? 1 : dims[0];
190 int jSize = dims.size() < 2 ? 1 : dims[1];
191 int kSize = dims.size() < 3 ? 1 : dims[2];
192 int lSize = dims.size() < 4 ? 1 : dims[3];
194 ss << name <<
" (" << iSize <<
"x" << jSize <<
"x" << kSize <<
"x" << lSize <<
") " 200 metainfo_.
setImpl(internal::make_shared_ptr<MetainfoMapImpl>(fieldMetainfoImpl_->metaInfoPtr()));
206 return fieldMetainfoImpl_;
boost::shared_ptr< FieldMetainfoImpl > & getImpl()
Get implementation pointer.
std::string name() const
The field name.
int iSize() const
The size of the field in i-direction, including the halo.
int kPlusHaloSize() const
The size of the halo in positive k-direction.
int kSize() const
The size of the field in k-direction, including the halo.
Information of a data-field.
int lSize() const
The size of the field in l-direction, including the halo.
bool operator==(const DataFieldInfo &other) const
Comparator operator.
std::string type() const
The field scalar type.
static int sizeOf(TypeID id)
Get size of the type.
int kMinusHaloSize() const
The size of the halo in negative k-direction.
Namespace of the STELLA frontend.
Namespace of the serialbox library.
TypeID
Type-id of types recognized by serialbox.
void Init(const TDataField &dataField)
Initialize with field.
int lMinusHaloSize() const
The size of the halo in negative l-direction.
int lPlusHaloSize() const
The size of the halo in positive l-direction.
int jMinusHaloSize() const
The size of the halo in negative j-direction.
int iMinusHaloSize() const
The size of the halo in negative i-direction.
int iPlusHaloSize() const
The size of the halo in positive i-direction.
int bytesPerElement() const
The dimension in bytes of a single element.
DataFieldInfo & operator=(const DataFieldInfo &other)
Assignment operator.
std::string ToString() const
Gives a string representation of the object, useful for debugging.
int rank() const
The number of dimensions of the field.
DataFieldInfo()
Default constructor.
Exception class which stores a human-readable error description.
void setImpl(const boost::shared_ptr< FieldMetainfoImpl > &fieldMetainfoImpl)
Set implementation pointer.
int jPlusHaloSize() const
The size of the halo in positive j-direction.
int jSize() const
The size of the field in j-direction, including the halo.