Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
cdo
Commits
2d9ba6e5
Commit
2d9ba6e5
authored
2 years ago
by
Volker Neff
Browse files
Options
Downloads
Patches
Plain Diff
use field_operations
parent
7985f7d4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!6
Draft: [WIP] New Field Architekture
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/field.h
+1
-1
1 addition, 1 deletion
src/field.h
src/field_t.inl
+4
-21
4 additions, 21 deletions
src/field_t.inl
with
5 additions
and
22 deletions
src/field.h
+
1
−
1
View file @
2d9ba6e5
...
...
@@ -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 */
This diff is collapsed.
Click to expand it.
src/field_t.inl
+
4
−
21
View file @
2d9ba6e5
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment