Skip to content

Commit

Permalink
Revert changes in existing C++ classes
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Nov 9, 2023
1 parent 9286564 commit 0f22f82
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
22 changes: 10 additions & 12 deletions src/atlas/redistribution/detail/RedistributeGeneric.cc
Original file line number Diff line number Diff line change
Expand Up @@ -304,20 +304,18 @@ void RedistributeGeneric::execute(const Field& sourceField, Field& targetField)

void RedistributeGeneric::execute(const FieldSet& sourceFieldSet, FieldSet& targetFieldSet) const {
// Check field set sizes match.
ATLAS_ASSERT(sourceFieldSet->size() == targetFieldSet->size());
ATLAS_ASSERT(sourceFieldSet.size() == targetFieldSet.size());

// Redistribute fields.
auto targetFieldSetIt = targetFieldSet->begin();
std::for_each(sourceFieldSet->cbegin(), sourceFieldSet->cend(), [&](const Field& sourceField) {
execute(sourceField, *targetFieldSetIt++);
return;
});
for (idx_t i = 0; i < sourceFieldSet.size(); ++i) {
execute(sourceFieldSet[i], targetFieldSet[i]);
}
}

// Determine datatype.
void RedistributeGeneric::do_execute(const Field& sourceField, Field& targetField) const {
// Available datatypes defined in array/LocalView.cc
switch (sourceField->datatype().kind()) {
switch (sourceField.datatype().kind()) {
case array::DataType::KIND_REAL64: {
return do_execute<double>(sourceField, targetField);
}
Expand All @@ -331,7 +329,7 @@ void RedistributeGeneric::do_execute(const Field& sourceField, Field& targetFiel
return do_execute<int>(sourceField, targetField);
}
default: {
ATLAS_THROW_EXCEPTION("No implementation for data type " + sourceField->datatype().str());
ATLAS_THROW_EXCEPTION("No implementation for data type " + sourceField.datatype().str());
}
}
}
Expand All @@ -340,7 +338,7 @@ void RedistributeGeneric::do_execute(const Field& sourceField, Field& targetFiel
template <typename Value>
void RedistributeGeneric::do_execute(const Field& sourceField, Field& targetField) const {
// Available ranks defined in array/LocalView.cc
switch (sourceField->rank()) {
switch (sourceField.rank()) {
case 1: {
return do_execute<Value, 1>(sourceField, targetField);
}
Expand Down Expand Up @@ -369,7 +367,7 @@ void RedistributeGeneric::do_execute(const Field& sourceField, Field& targetFiel
return do_execute<Value, 9>(sourceField, targetField);
}
default: {
ATLAS_THROW_EXCEPTION("No implementation for rank " + std::to_string(sourceField->rank()));
ATLAS_THROW_EXCEPTION("No implementation for rank " + std::to_string(sourceField.rank()));
}
}
}
Expand All @@ -378,8 +376,8 @@ void RedistributeGeneric::do_execute(const Field& sourceField, Field& targetFiel
template <typename Value, int Rank>
void RedistributeGeneric::do_execute(const Field& sourceField, Field& targetField) const {
// Get array views.
auto sourceView = array::make_view<Value, Rank>(*sourceField);
auto targetView = array::make_view<Value, Rank>(*targetField);
auto sourceView = array::make_view<Value, Rank>(sourceField);
auto targetView = array::make_view<Value, Rank>(targetField);

const auto& comm = mpi::comm(mpi_comm_);
auto mpi_size = comm.size();
Expand Down
1 change: 0 additions & 1 deletion src/atlas/redistribution/detail/RedistributeGeneric.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <string>

#include "atlas/field/detail/FieldImpl.h"
#include "atlas/redistribution/detail/RedistributionImpl.h"

namespace atlas {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ void RedistributeStructuredColumns::execute(const Field& sourceField, Field& tar

void RedistributeStructuredColumns::execute(const FieldSet& sourceFieldSet, FieldSet& targetFieldSet) const {
// Check that both FieldSets are the same size.
ATLAS_ASSERT(sourceFieldSet->size() == targetFieldSet->size());
ATLAS_ASSERT(sourceFieldSet.size() == targetFieldSet.size());

auto targetFieldSetIt = targetFieldSet->begin();
std::for_each(sourceFieldSet->cbegin(), sourceFieldSet->cend(), [&](const Field& sourceField) {
auto targetFieldSetIt = targetFieldSet.begin();
std::for_each(sourceFieldSet.cbegin(), sourceFieldSet.cend(), [&](const Field& sourceField) {
execute(sourceField, *targetFieldSetIt++);
return;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

namespace atlas {

class FieldImpl;
class FieldSetImpl;
class Field;
class FieldSet;
class FunctionSpace;

namespace functionspace {
Expand Down
4 changes: 0 additions & 4 deletions src/atlas/redistribution/detail/RedistributionImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@
#include "atlas/util/Object.h"

namespace atlas {
namespace field {
class Field;
class FieldSet;
}
namespace functionspace {
class FunctionSpace;
}
} // namespace atlas

namespace atlas {
Expand Down

0 comments on commit 0f22f82

Please sign in to comment.