Skip to content

Commit

Permalink
Cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
massimim committed Oct 20, 2022
1 parent 206989e commit 24395ae
Show file tree
Hide file tree
Showing 20 changed files with 714 additions and 430 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ struct StaggeredGrid : public Neon::domain::interface::GridBaseTemplate<Staggere
const -> bool;

private:

/**
* Hiding this method as it is replaced by isVoxelInsideDomain and isNodeInsideDomain
*/
Expand All @@ -151,15 +150,14 @@ struct StaggeredGrid : public Neon::domain::interface::GridBaseTemplate<Staggere
struct Storage
{
typename BuildingBlocks::Grid buildingBlockGrid;

Self::NodeGrid nodeGrid;
Self::VoxelGrid voxelGrid;
};

std::shared_ptr<Storage> mStorage;
};


} // namespace Neon::domain::internal::experimental::staggeredGrid


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ class NodeField : public Neon::domain::interface::FieldBaseTemplate<T,
* then the default outside value is returned.
*/
auto operator()(const Neon::index_3d& idx,
const int& cardinality) const
-> Type final;
const int& cardinality)
const -> Type final;

auto haloUpdate(Neon::set::HuOptions& opt) const
-> void final;
auto haloUpdate(Neon::set::HuOptions& opt)
const -> void final;

auto haloUpdate(SetIdx setIdx,
Neon::set::HuOptions& opt) const
-> void;
Neon::set::HuOptions& opt)
const -> void;

auto haloUpdate(Neon::set::HuOptions& opt)
-> void final;
Expand All @@ -201,8 +201,7 @@ class NodeField : public Neon::domain::interface::FieldBaseTemplate<T,
auto getPartition(const Neon::DeviceType& devType,
const Neon::SetIdx& idx,
const Neon::DataView& dataView = Neon::DataView::STANDARD)
const
-> const Partition&;
const -> const Partition&;

auto getPartition(const Neon::DeviceType& devType,
const Neon::SetIdx& idx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,90 +15,108 @@ namespace Neon::domain::internal::experimental::staggeredGrid::details {


template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::self() -> NodeField::Self&
auto NodeField<BuildingBlockGridT, T, C>::
self()
-> NodeField::Self&
{
return *this;
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::self() const -> const NodeField::Self&
auto NodeField<BuildingBlockGridT, T, C>::
self()
const -> const NodeField::Self&
{
return *this;
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::operator()(const index_3d& idx,
const int& cardinality) const -> Type
auto NodeField<BuildingBlockGridT, T, C>::
operator()(const index_3d& idx,
const int& cardinality)
const -> Type
{
return this->getStorage().getBuildingBlockField().operator()(idx, cardinality);
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::haloUpdate(set::HuOptions& opt) const -> void
auto NodeField<BuildingBlockGridT, T, C>::
haloUpdate(set::HuOptions& opt) const -> void
{
return this->getStorage().getBuildingBlockField().haloUpdate(opt);
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::haloUpdate(SetIdx setIdx, set::HuOptions& opt) const -> void
auto NodeField<BuildingBlockGridT, T, C>::
haloUpdate(SetIdx setIdx, set::HuOptions& opt) const -> void
{
return this->getStorage().getBuildingBlockField().haloUpdate(setIdx, opt);
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::haloUpdate(set::HuOptions& opt) -> void
auto NodeField<BuildingBlockGridT, T, C>::
haloUpdate(set::HuOptions& opt) -> void
{
return this->getStorage().getBuildingBlockField().haloUpdate(opt);
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::haloUpdate(SetIdx setIdx, set::HuOptions& opt) -> void
auto NodeField<BuildingBlockGridT, T, C>::
haloUpdate(SetIdx setIdx, set::HuOptions& opt) -> void
{
return this->getStorage().getBuildingBlockField().haloUpdate(setIdx, opt);
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::getReference(const index_3d& idx, const int& cardinality) -> Type&
auto NodeField<BuildingBlockGridT, T, C>::
getReference(const index_3d& idx, const int& cardinality) -> Type&
{
return this->getStorage().getBuildingBlockField().getReference(idx, cardinality);
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::updateCompute(int streamSetId) -> void
auto NodeField<BuildingBlockGridT, T, C>::
updateCompute(int streamSetId) -> void
{
return this->getStorage().getBuildingBlockField().updateCompute(streamSetId);
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::updateIO(int streamSetId) -> void
auto NodeField<BuildingBlockGridT, T, C>::
updateIO(int streamSetId) -> void
{
return this->getStorage().getBuildingBlockField().updateIO(streamSetId);
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::getPartition(const DeviceType& devType,
const SetIdx& idx,
const DataView& dataView) const -> const NodeField::Partition&
auto NodeField<BuildingBlockGridT, T, C>::
getPartition(const DeviceType& devType,
const SetIdx& idx,
const DataView& dataView) const -> const NodeField::Partition&
{
const Neon::Execution execution = DeviceTypeUtil::getExecution(devType);
const auto& partition = getPartition(execution, idx, dataView);
return partition;
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::getPartition(const DeviceType& devType,
const SetIdx& idx,
const DataView& dataView) -> NodeField::Partition&
auto NodeField<BuildingBlockGridT, T, C>::
getPartition(const DeviceType& devType,
const SetIdx& idx,
const DataView& dataView)
-> NodeField::Partition&
{
const Neon::Execution execution = DeviceTypeUtil::getExecution(devType);
auto& partition = getPartition(execution, idx, dataView);
return partition;
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::getPartition(Neon::Execution execution,
Neon::SetIdx setIdx,
const DataView& dataView) const -> const NodeField::Partition&
auto NodeField<BuildingBlockGridT, T, C>::
getPartition(Neon::Execution execution,
Neon::SetIdx setIdx,
const DataView& dataView)
const -> const NodeField::Partition&
{
auto& s = this->getStorage();
if (!s.isSupported(execution)) {
Expand All @@ -113,9 +131,10 @@ auto NodeField<BuildingBlockGridT, T, C>::getPartition(Neon::Execution execution
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::getPartition(Neon::Execution execution,
Neon::SetIdx setIdx,
const DataView& dataView) -> NodeField::Partition&
auto NodeField<BuildingBlockGridT, T, C>::
getPartition(Neon::Execution execution,
Neon::SetIdx setIdx,
const DataView& dataView) -> NodeField::Partition&
{
auto& s = this->getStorage();
if (!s.isSupported(execution)) {
Expand All @@ -130,30 +149,38 @@ auto NodeField<BuildingBlockGridT, T, C>::getPartition(Neon::Execution execution
}

template <typename BuildingBlockGridT, typename T, int C>
auto NodeField<BuildingBlockGridT, T, C>::swap(NodeField& A, NodeField& B) -> void
auto NodeField<BuildingBlockGridT, T, C>::
swap(NodeField& A, NodeField& B)
-> void
{
(void)A;
(void)B;
NEON_DEV_UNDER_CONSTRUCTION("");
}

template <typename BuildingBlockGridT, typename T, int C>
NodeField<BuildingBlockGridT, T, C>::NodeField(const std::string& fieldUserName,
Neon::DataUse dataUse,
const Neon::MemoryOptions& memoryOptions,
const Grid& grid,
const typename BuildingBlocks::Grid& buildingBlockGrid,
int cardinality,
T outsideVal,
Neon::domain::haloStatus_et::e haloStatus)
: Neon::domain::interface::FieldBaseTemplate<T, C, typename Self::Grid, typename Self::Partition, Storage>(&grid,
fieldUserName,
std::string("Staggered-") + buildingBlockGrid.getImplementationName(),
cardinality,
outsideVal,
dataUse,
memoryOptions,
haloStatus) {
NodeField<BuildingBlockGridT, T, C>::
NodeField(const std::string& fieldUserName,
Neon::DataUse dataUse,
const Neon::MemoryOptions& memoryOptions,
const Grid& grid,
const typename BuildingBlocks::Grid& buildingBlockGrid,
int cardinality,
T outsideVal,
Neon::domain::haloStatus_et::e haloStatus)
: Neon::domain::interface::FieldBaseTemplate<T,
C,
typename Self::Grid,
typename Self::Partition,
Storage>(&grid,
fieldUserName,
std::string("Staggered-") + buildingBlockGrid.getImplementationName(),
cardinality,
outsideVal,
dataUse,
memoryOptions,
haloStatus) {

auto buildingBlockField = buildingBlockGrid.template newField<T, C>(fieldUserName,
cardinality,
outsideVal,
Expand All @@ -166,11 +193,13 @@ NodeField<BuildingBlockGridT, T, C>::NodeField(const std::string&

template <typename BuildingBlockGridT, typename T, int C>
template <typename VtiExportType>
auto NodeField<BuildingBlockGridT, T, C>::ioToVtk(const std::string& fileName,
const std::string& FieldName,
bool includeDomain,
Neon::IoFileType ioFileType,
bool isNodeSpace) const -> void
auto NodeField<BuildingBlockGridT, T, C>::
ioToVtk(const std::string& fileName,
const std::string& FieldName,
bool includeDomain,
Neon::IoFileType ioFileType,
bool isNodeSpace)
const -> void
{
auto& buildingBlockField = this->getStorage().getBuildingBlockField();
const auto spacing = buildingBlockField.getGrid().getSpacing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ NodeGeneric<BuildingBlockGridT>::NodeGeneric(const typename BuildingBlocks::Cell

template <typename BuildingBlockGridT>
inline auto
NodeGeneric<BuildingBlockGridT>::getBuildingBlockCell()
NodeGeneric<BuildingBlockGridT>::
getBuildingBlockCell()
-> typename BuildingBlocks::Cell&
{
return mBuildingBlockCell;
Expand All @@ -22,8 +23,9 @@ NodeGeneric<BuildingBlockGridT>::getBuildingBlockCell()
template <typename BuildingBlockGridT>
NEON_CUDA_HOST_DEVICE
inline auto
NodeGeneric<BuildingBlockGridT>::getBuildingBlockCell() const
-> const typename BuildingBlocks::Cell&
NodeGeneric<BuildingBlockGridT>::
getBuildingBlockCell()
const-> const typename BuildingBlocks::Cell&
{
return mBuildingBlockCell;
}
Expand Down
Loading

0 comments on commit 24395ae

Please sign in to comment.