Skip to content
Snippets Groups Projects
Commit 2d9ba6e5 authored by Volker Neff's avatar Volker Neff
Browse files

use field_operations

parent 7985f7d4
No related branches found
No related tags found
1 merge request!6Draft: [WIP] New Field Architekture
......@@ -240,13 +240,13 @@ enum field_flag
******** Inline Template definitions ***********
************************************************
***********************************************/
#include "field_operation.h"
#include "field.inl"
#include "field3d.inl"
#include "field_t.inl"
#include "field_factory.inl"
#include "field_operation.h"
#include "field_operation.inl"
#endif /* FIELD_H */
......@@ -8,6 +8,7 @@
#define FIELD_t_INL
#include "field.h"
#include "field_operation.h"
inline constexpr Field_t::Field_t() noexcept
: _var_()
......@@ -79,24 +80,12 @@ inline Field_t& Field_t::operator=( T&& t ) noexcept {
}
inline void Field_t::resize(size_t count) {
if(std::holds_alternative<FieldFloat>(*this)) {
std::get<FieldFloat>(*this).resize(count);
} else if(std::holds_alternative<FieldDouble>(*this)) {
std::get<FieldDouble>(*this).resize(count);
} else {
throw std::runtime_error("Not supported Type");
}
field_operation([](LambdaField_T_ field, size_t count){field.resize(count);}, *this, count);
}
template<typename U>
inline void Field_t::resize(size_t count, const U value) {
if(std::holds_alternative<FieldFloat>(*this)) {
std::get<FieldFloat>(*this).resize(count);
} else if(std::holds_alternative<FieldDouble>(*this)) {
std::get<FieldDouble>(*this).resize(count);
} else {
throw std::runtime_error("Not supported Type");
}
field_operation([](LambdaField_T_ field, size_t count, const U value){field.resize(count, value);}, *this, count, value);
}
inline void Field_t::setMissValue(double value) {
......@@ -110,13 +99,7 @@ inline void Field_t::setMissValue(double value) {
}
inline double Field_t::getMissValue() const {
if(std::holds_alternative<FieldFloat>(*this)) {
return std::get<FieldFloat>(*this).getMissValue();
} else if(std::holds_alternative<FieldDouble>(*this)) {
return std::get<FieldDouble>(*this).getMissValue();
} else {
throw std::runtime_error("Not supported Type");
}
return field_operation([](LambdaField_T_ field){return field.getMissValueDouble();}, *this);
}
#endif // FIELD_t_INL
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment