From ed27eb978c139694cbdbd20fdaca138b08c274b9 Mon Sep 17 00:00:00 2001 From: hamidrezanorouzi Date: Thu, 1 Sep 2022 21:35:35 +0430 Subject: [PATCH] added phasicFlow --- src/phasicFlow/Kokkos/KokkosTypes.H | 135 + src/phasicFlow/Kokkos/KokkosUtilities.H | 92 + src/phasicFlow/Kokkos/ViewAlgorithms.H | 593 +++ src/phasicFlow/Kokkos/baseAlgorithms.H | 245 ++ src/phasicFlow/Kokkos/baseAlgorithmsFwd.H | 51 + src/phasicFlow/Timer/Timer.C | 97 + src/phasicFlow/Timer/Timer.H | 163 + src/phasicFlow/Timer/Timers.C | 40 + src/phasicFlow/Timer/Timers.H | 120 + .../algorithms/algorithmFunctions.H | 96 + src/phasicFlow/algorithms/cudaAlgorithms.H | 182 + src/phasicFlow/algorithms/kokkosAlgorithms.H | 188 + src/phasicFlow/algorithms/stdAlgorithms.H | 243 ++ src/phasicFlow/commandLine/CLI/App.hpp | 3201 +++++++++++++++++ src/phasicFlow/commandLine/CLI/CLI.hpp | 36 + src/phasicFlow/commandLine/CLI/Config.hpp | 396 ++ src/phasicFlow/commandLine/CLI/ConfigFwd.hpp | 182 + src/phasicFlow/commandLine/CLI/Error.hpp | 351 ++ src/phasicFlow/commandLine/CLI/Formatter.hpp | 292 ++ .../commandLine/CLI/FormatterFwd.hpp | 184 + src/phasicFlow/commandLine/CLI/LICENSE | 25 + src/phasicFlow/commandLine/CLI/Macros.hpp | 44 + src/phasicFlow/commandLine/CLI/Option.hpp | 1348 +++++++ src/phasicFlow/commandLine/CLI/Split.hpp | 143 + .../commandLine/CLI/StringTools.hpp | 430 +++ src/phasicFlow/commandLine/CLI/Timer.hpp | 134 + src/phasicFlow/commandLine/CLI/TypeTools.hpp | 1548 ++++++++ src/phasicFlow/commandLine/CLI/Validators.hpp | 1142 ++++++ src/phasicFlow/commandLine/CLI/Version.hpp | 16 + src/phasicFlow/commandLine/commandLine.C | 63 + src/phasicFlow/commandLine/commandLine.H | 140 + src/phasicFlow/containers/Field/Field.C | 170 + src/phasicFlow/containers/Field/Field.H | 270 ++ src/phasicFlow/containers/Field/Fields.C | 81 + src/phasicFlow/containers/Field/Fields.H | 126 + src/phasicFlow/containers/List/List/List.H | 250 ++ src/phasicFlow/containers/List/List/ListI.H | 257 ++ .../containers/List/ListPtr/ListPtr.H | 197 + .../containers/List/ListPtr/ListPtrI.H | 301 ++ src/phasicFlow/containers/List/Lists.H | 35 + src/phasicFlow/containers/Map/Map/Map.H | 174 + src/phasicFlow/containers/Map/Map/MapI.H | 134 + src/phasicFlow/containers/Map/MapPtr/MapPtr.H | 274 ++ .../containers/Map/MapPtr/MapPtrI.H | 333 ++ src/phasicFlow/containers/Map/Maps.H | 30 + .../containers/Map/hashMap/hashMap.H | 174 + .../containers/Map/hashMap/hashMapI.H | 137 + src/phasicFlow/containers/Set/Set.H | 35 + src/phasicFlow/containers/Vector/Vector.C | 352 ++ src/phasicFlow/containers/Vector/Vector.H | 425 +++ .../containers/Vector/VectorAlgorithm.H | 80 + src/phasicFlow/containers/Vector/VectorFwd.H | 80 + src/phasicFlow/containers/Vector/VectorI.H | 302 ++ src/phasicFlow/containers/Vector/VectorMath.H | 212 ++ src/phasicFlow/containers/Vector/Vectors.C | 46 + src/phasicFlow/containers/Vector/Vectors.H | 101 + .../containers/VectorHD/VectorDual.H | 965 +++++ .../VectorHD/VectorDualAlgorithms.H | 113 + .../containers/VectorHD/VectorDuals.H | 52 + .../containers/VectorHD/VectorSingle.H | 859 +++++ .../VectorHD/VectorSingleAlgorithms.H | 61 + .../containers/VectorHD/VectorSingles.H | 86 + src/phasicFlow/containers/bitsetHD/bitsetHD.H | 223 ++ .../containers/bitsetHD/bitsetHDs.C | 27 + .../indexContainer/indexContainer.C | 21 + .../indexContainer/indexContainer.H | 171 + .../containers/pointField/pointField.C | 129 + .../containers/pointField/pointField.H | 196 + .../pointField/pointFieldAlgorithms.H | 269 ++ .../containers/pointField/pointFields.C | 58 + .../containers/pointField/pointFields.H | 88 + src/phasicFlow/containers/span/span.H | 161 + .../containers/symArrayHD/symArrayHD.H | 278 ++ .../containers/symArrayHD/symArrays.C | 29 + .../containers/symArrayHD/symArrays.H | 35 + .../triSurfaceField/triSurfaceField.C | 119 + .../triSurfaceField/triSurfaceField.H | 177 + .../triSurfaceField/triSurfaceFields.C | 34 + .../triSurfaceField/triSurfaceFields.H | 59 + src/phasicFlow/dictionary/dictionary.C | 819 +++++ src/phasicFlow/dictionary/dictionary.H | 344 ++ src/phasicFlow/dictionary/entry/dataEntry.C | 375 ++ src/phasicFlow/dictionary/entry/dataEntry.H | 163 + src/phasicFlow/dictionary/entry/iEntry.C | 185 + src/phasicFlow/dictionary/entry/iEntry.H | 160 + .../dictionary/twoPartEntry/twoPartEntry.C | 48 + .../dictionary/twoPartEntry/twoPartEntry.H | 70 + src/phasicFlow/eventSubscriber/eventMessage.H | 116 + .../eventSubscriber/eventObserver.C | 56 + .../eventSubscriber/eventObserver.H | 65 + .../eventSubscriber/eventSubscriber.C | 92 + .../eventSubscriber/eventSubscriber.H | 64 + src/phasicFlow/globals/error.C | 96 + src/phasicFlow/globals/error.H | 68 + src/phasicFlow/globals/globalSettings.H | 35 + src/phasicFlow/globals/pFlowMacros.H | 80 + src/phasicFlow/globals/vocabs.H | 58 + src/phasicFlow/random/randomReal/RandomReal.C | 53 + src/phasicFlow/random/randomReal/RandomReal.H | 73 + src/phasicFlow/random/randomReal/randomReal.C | 51 + src/phasicFlow/random/randomReal/randomReal.H | 67 + .../random/randomReal/randomReals.C | 23 + .../random/randomReal/randomReals.H | 34 + .../random/randomReal/uniformRandomReal.H | 84 + src/phasicFlow/ranges/combinedRange.H | 151 + src/phasicFlow/ranges/intervalRange.H | 118 + src/phasicFlow/ranges/ranges.H | 45 + src/phasicFlow/ranges/stridedRange.H | 142 + .../repository/IOobject/IOfileHeader.C | 179 + .../repository/IOobject/IOfileHeader.H | 123 + src/phasicFlow/repository/IOobject/IOobject.C | 119 + src/phasicFlow/repository/IOobject/IOobject.H | 184 + .../repository/IOobject/IOobjectTemplates.C | 64 + .../repository/IOobject/objectFile.C | 49 + .../repository/IOobject/objectFile.H | 153 + src/phasicFlow/repository/Time/Time.C | 61 + src/phasicFlow/repository/Time/Time.H | 95 + src/phasicFlow/repository/Time/timeControl.C | 95 + src/phasicFlow/repository/Time/timeControl.H | 157 + .../repository/repository/repository.C | 279 ++ .../repository/repository/repository.H | 204 ++ .../repository/repositoryTemplates.C | 172 + .../repository/systemControl/Control.H | 47 + .../repository/systemControl/systemControl.C | 214 ++ .../repository/systemControl/systemControl.H | 171 + .../repository/systemControl/timeFolder.H | 104 + src/phasicFlow/setFieldList/setFieldEntry.C | 118 + src/phasicFlow/setFieldList/setFieldEntry.H | 120 + .../setFieldList/setFieldEntryTemplates.C | 202 ++ src/phasicFlow/setFieldList/setFieldList.C | 75 + src/phasicFlow/setFieldList/setFieldList.H | 80 + src/phasicFlow/smartPointers/uniquePtr.H | 110 + src/phasicFlow/streams/Stream/Ostream.H | 4 +- src/phasicFlow/streams/TStream/iTstream.C | 60 +- src/phasicFlow/streams/TStream/iTstream.H | 2 +- src/phasicFlow/streams/TStream/oTstream.C | 40 +- src/phasicFlow/streams/TStream/oTstream.H | 4 +- src/phasicFlow/streams/iStream/iIstream.C | 30 +- src/phasicFlow/streams/streams.C | 6 +- src/phasicFlow/streams/streams.H | 18 +- src/phasicFlow/structuredData/box/box.C | 139 + src/phasicFlow/structuredData/box/box.H | 115 + src/phasicFlow/structuredData/iBox/iBox.C | 162 + src/phasicFlow/structuredData/iBox/iBox.H | 122 + src/phasicFlow/structuredData/iBox/iBoxs.C | 34 + src/phasicFlow/structuredData/line/line.C | 131 + src/phasicFlow/structuredData/line/line.H | 139 + .../PeakableRegion/PeakableRegion.C | 63 + .../PeakableRegion/PeakableRegion.H | 90 + .../peakableRegion/boxRegion/boxRegion.C | 63 + .../peakableRegion/boxRegion/boxRegion.H | 62 + .../peakableRegion/peakableRegion.C | 60 + .../peakableRegion/peakableRegion.H | 82 + .../peakableRegionInstantiate.C | 27 + .../peakableRegion/peakableRegions.C | 27 + .../peakableRegion/peakableRegions.H | 45 + .../sphereRegion/sphereRegion.C | 90 + .../sphereRegion/sphereRegion.H | 66 + .../pointStructure/pointStructure.C | 476 +++ .../pointStructure/pointStructure.H | 357 ++ .../pointStructure/pointStructureKernels.H | 144 + .../pointStructure/selectors/boxAll/boxAll.C | 58 + .../pointStructure/selectors/boxAll/boxAll.H | 81 + .../pStructSelector/pStructSelector.C | 62 + .../pStructSelector/pStructSelector.H | 78 + .../selectors/rangeAll/rangeAll.C | 68 + .../selectors/rangeAll/rangeAll.H | 87 + .../trisurfaceStructure/bitTransfer.H | 71 + .../trisurfaceStructure/multiTriSurface.C | 235 ++ .../trisurfaceStructure/multiTriSurface.H | 183 + .../trisurfaceStructure/stlFile.C | 357 ++ .../trisurfaceStructure/stlFile.H | 119 + .../trisurfaceStructure/triSurface.C | 232 ++ .../trisurfaceStructure/triSurface.H | 288 ++ .../trisurfaceStructure/triSurfaceKernels.H | 56 + .../trisurfaceStructure/triangleFunctions.H | 39 + .../types/basicTypes/bTypesFunctions.H | 2 +- src/phasicFlow/types/basicTypes/math.H | 2 +- 178 files changed, 32208 insertions(+), 84 deletions(-) create mode 100644 src/phasicFlow/Kokkos/KokkosTypes.H create mode 100644 src/phasicFlow/Kokkos/KokkosUtilities.H create mode 100644 src/phasicFlow/Kokkos/ViewAlgorithms.H create mode 100644 src/phasicFlow/Kokkos/baseAlgorithms.H create mode 100644 src/phasicFlow/Kokkos/baseAlgorithmsFwd.H create mode 100644 src/phasicFlow/Timer/Timer.C create mode 100644 src/phasicFlow/Timer/Timer.H create mode 100644 src/phasicFlow/Timer/Timers.C create mode 100644 src/phasicFlow/Timer/Timers.H create mode 100644 src/phasicFlow/algorithms/algorithmFunctions.H create mode 100644 src/phasicFlow/algorithms/cudaAlgorithms.H create mode 100644 src/phasicFlow/algorithms/kokkosAlgorithms.H create mode 100644 src/phasicFlow/algorithms/stdAlgorithms.H create mode 100644 src/phasicFlow/commandLine/CLI/App.hpp create mode 100644 src/phasicFlow/commandLine/CLI/CLI.hpp create mode 100644 src/phasicFlow/commandLine/CLI/Config.hpp create mode 100644 src/phasicFlow/commandLine/CLI/ConfigFwd.hpp create mode 100644 src/phasicFlow/commandLine/CLI/Error.hpp create mode 100644 src/phasicFlow/commandLine/CLI/Formatter.hpp create mode 100644 src/phasicFlow/commandLine/CLI/FormatterFwd.hpp create mode 100644 src/phasicFlow/commandLine/CLI/LICENSE create mode 100644 src/phasicFlow/commandLine/CLI/Macros.hpp create mode 100644 src/phasicFlow/commandLine/CLI/Option.hpp create mode 100644 src/phasicFlow/commandLine/CLI/Split.hpp create mode 100644 src/phasicFlow/commandLine/CLI/StringTools.hpp create mode 100644 src/phasicFlow/commandLine/CLI/Timer.hpp create mode 100644 src/phasicFlow/commandLine/CLI/TypeTools.hpp create mode 100644 src/phasicFlow/commandLine/CLI/Validators.hpp create mode 100644 src/phasicFlow/commandLine/CLI/Version.hpp create mode 100644 src/phasicFlow/commandLine/commandLine.C create mode 100644 src/phasicFlow/commandLine/commandLine.H create mode 100644 src/phasicFlow/containers/Field/Field.C create mode 100644 src/phasicFlow/containers/Field/Field.H create mode 100644 src/phasicFlow/containers/Field/Fields.C create mode 100644 src/phasicFlow/containers/Field/Fields.H create mode 100644 src/phasicFlow/containers/List/List/List.H create mode 100644 src/phasicFlow/containers/List/List/ListI.H create mode 100644 src/phasicFlow/containers/List/ListPtr/ListPtr.H create mode 100644 src/phasicFlow/containers/List/ListPtr/ListPtrI.H create mode 100644 src/phasicFlow/containers/List/Lists.H create mode 100644 src/phasicFlow/containers/Map/Map/Map.H create mode 100644 src/phasicFlow/containers/Map/Map/MapI.H create mode 100644 src/phasicFlow/containers/Map/MapPtr/MapPtr.H create mode 100644 src/phasicFlow/containers/Map/MapPtr/MapPtrI.H create mode 100644 src/phasicFlow/containers/Map/Maps.H create mode 100644 src/phasicFlow/containers/Map/hashMap/hashMap.H create mode 100644 src/phasicFlow/containers/Map/hashMap/hashMapI.H create mode 100644 src/phasicFlow/containers/Set/Set.H create mode 100644 src/phasicFlow/containers/Vector/Vector.C create mode 100644 src/phasicFlow/containers/Vector/Vector.H create mode 100644 src/phasicFlow/containers/Vector/VectorAlgorithm.H create mode 100644 src/phasicFlow/containers/Vector/VectorFwd.H create mode 100644 src/phasicFlow/containers/Vector/VectorI.H create mode 100644 src/phasicFlow/containers/Vector/VectorMath.H create mode 100644 src/phasicFlow/containers/Vector/Vectors.C create mode 100644 src/phasicFlow/containers/Vector/Vectors.H create mode 100644 src/phasicFlow/containers/VectorHD/VectorDual.H create mode 100644 src/phasicFlow/containers/VectorHD/VectorDualAlgorithms.H create mode 100644 src/phasicFlow/containers/VectorHD/VectorDuals.H create mode 100644 src/phasicFlow/containers/VectorHD/VectorSingle.H create mode 100644 src/phasicFlow/containers/VectorHD/VectorSingleAlgorithms.H create mode 100644 src/phasicFlow/containers/VectorHD/VectorSingles.H create mode 100644 src/phasicFlow/containers/bitsetHD/bitsetHD.H create mode 100644 src/phasicFlow/containers/bitsetHD/bitsetHDs.C create mode 100644 src/phasicFlow/containers/indexContainer/indexContainer.C create mode 100644 src/phasicFlow/containers/indexContainer/indexContainer.H create mode 100644 src/phasicFlow/containers/pointField/pointField.C create mode 100644 src/phasicFlow/containers/pointField/pointField.H create mode 100644 src/phasicFlow/containers/pointField/pointFieldAlgorithms.H create mode 100644 src/phasicFlow/containers/pointField/pointFields.C create mode 100644 src/phasicFlow/containers/pointField/pointFields.H create mode 100644 src/phasicFlow/containers/span/span.H create mode 100644 src/phasicFlow/containers/symArrayHD/symArrayHD.H create mode 100644 src/phasicFlow/containers/symArrayHD/symArrays.C create mode 100644 src/phasicFlow/containers/symArrayHD/symArrays.H create mode 100644 src/phasicFlow/containers/triSurfaceField/triSurfaceField.C create mode 100644 src/phasicFlow/containers/triSurfaceField/triSurfaceField.H create mode 100644 src/phasicFlow/containers/triSurfaceField/triSurfaceFields.C create mode 100644 src/phasicFlow/containers/triSurfaceField/triSurfaceFields.H create mode 100644 src/phasicFlow/dictionary/dictionary.C create mode 100644 src/phasicFlow/dictionary/dictionary.H create mode 100644 src/phasicFlow/dictionary/entry/dataEntry.C create mode 100644 src/phasicFlow/dictionary/entry/dataEntry.H create mode 100644 src/phasicFlow/dictionary/entry/iEntry.C create mode 100644 src/phasicFlow/dictionary/entry/iEntry.H create mode 100644 src/phasicFlow/dictionary/twoPartEntry/twoPartEntry.C create mode 100644 src/phasicFlow/dictionary/twoPartEntry/twoPartEntry.H create mode 100644 src/phasicFlow/eventSubscriber/eventMessage.H create mode 100644 src/phasicFlow/eventSubscriber/eventObserver.C create mode 100644 src/phasicFlow/eventSubscriber/eventObserver.H create mode 100644 src/phasicFlow/eventSubscriber/eventSubscriber.C create mode 100644 src/phasicFlow/eventSubscriber/eventSubscriber.H create mode 100644 src/phasicFlow/globals/error.C create mode 100644 src/phasicFlow/globals/error.H create mode 100755 src/phasicFlow/globals/globalSettings.H create mode 100755 src/phasicFlow/globals/pFlowMacros.H create mode 100755 src/phasicFlow/globals/vocabs.H create mode 100644 src/phasicFlow/random/randomReal/RandomReal.C create mode 100644 src/phasicFlow/random/randomReal/RandomReal.H create mode 100644 src/phasicFlow/random/randomReal/randomReal.C create mode 100644 src/phasicFlow/random/randomReal/randomReal.H create mode 100644 src/phasicFlow/random/randomReal/randomReals.C create mode 100644 src/phasicFlow/random/randomReal/randomReals.H create mode 100644 src/phasicFlow/random/randomReal/uniformRandomReal.H create mode 100644 src/phasicFlow/ranges/combinedRange.H create mode 100644 src/phasicFlow/ranges/intervalRange.H create mode 100644 src/phasicFlow/ranges/ranges.H create mode 100644 src/phasicFlow/ranges/stridedRange.H create mode 100644 src/phasicFlow/repository/IOobject/IOfileHeader.C create mode 100644 src/phasicFlow/repository/IOobject/IOfileHeader.H create mode 100644 src/phasicFlow/repository/IOobject/IOobject.C create mode 100644 src/phasicFlow/repository/IOobject/IOobject.H create mode 100644 src/phasicFlow/repository/IOobject/IOobjectTemplates.C create mode 100644 src/phasicFlow/repository/IOobject/objectFile.C create mode 100644 src/phasicFlow/repository/IOobject/objectFile.H create mode 100644 src/phasicFlow/repository/Time/Time.C create mode 100644 src/phasicFlow/repository/Time/Time.H create mode 100644 src/phasicFlow/repository/Time/timeControl.C create mode 100644 src/phasicFlow/repository/Time/timeControl.H create mode 100644 src/phasicFlow/repository/repository/repository.C create mode 100644 src/phasicFlow/repository/repository/repository.H create mode 100644 src/phasicFlow/repository/repository/repositoryTemplates.C create mode 100644 src/phasicFlow/repository/systemControl/Control.H create mode 100644 src/phasicFlow/repository/systemControl/systemControl.C create mode 100644 src/phasicFlow/repository/systemControl/systemControl.H create mode 100644 src/phasicFlow/repository/systemControl/timeFolder.H create mode 100644 src/phasicFlow/setFieldList/setFieldEntry.C create mode 100644 src/phasicFlow/setFieldList/setFieldEntry.H create mode 100644 src/phasicFlow/setFieldList/setFieldEntryTemplates.C create mode 100644 src/phasicFlow/setFieldList/setFieldList.C create mode 100644 src/phasicFlow/setFieldList/setFieldList.H create mode 100644 src/phasicFlow/smartPointers/uniquePtr.H create mode 100644 src/phasicFlow/structuredData/box/box.C create mode 100644 src/phasicFlow/structuredData/box/box.H create mode 100644 src/phasicFlow/structuredData/iBox/iBox.C create mode 100644 src/phasicFlow/structuredData/iBox/iBox.H create mode 100644 src/phasicFlow/structuredData/iBox/iBoxs.C create mode 100755 src/phasicFlow/structuredData/line/line.C create mode 100755 src/phasicFlow/structuredData/line/line.H create mode 100644 src/phasicFlow/structuredData/peakableRegion/PeakableRegion/PeakableRegion.C create mode 100644 src/phasicFlow/structuredData/peakableRegion/PeakableRegion/PeakableRegion.H create mode 100644 src/phasicFlow/structuredData/peakableRegion/boxRegion/boxRegion.C create mode 100644 src/phasicFlow/structuredData/peakableRegion/boxRegion/boxRegion.H create mode 100644 src/phasicFlow/structuredData/peakableRegion/peakableRegion/peakableRegion.C create mode 100644 src/phasicFlow/structuredData/peakableRegion/peakableRegion/peakableRegion.H create mode 100644 src/phasicFlow/structuredData/peakableRegion/peakableRegionInstantiate.C create mode 100644 src/phasicFlow/structuredData/peakableRegion/peakableRegions.C create mode 100644 src/phasicFlow/structuredData/peakableRegion/peakableRegions.H create mode 100644 src/phasicFlow/structuredData/peakableRegion/sphereRegion/sphereRegion.C create mode 100644 src/phasicFlow/structuredData/peakableRegion/sphereRegion/sphereRegion.H create mode 100644 src/phasicFlow/structuredData/pointStructure/pointStructure.C create mode 100644 src/phasicFlow/structuredData/pointStructure/pointStructure.H create mode 100644 src/phasicFlow/structuredData/pointStructure/pointStructureKernels.H create mode 100644 src/phasicFlow/structuredData/pointStructure/selectors/boxAll/boxAll.C create mode 100644 src/phasicFlow/structuredData/pointStructure/selectors/boxAll/boxAll.H create mode 100644 src/phasicFlow/structuredData/pointStructure/selectors/pStructSelector/pStructSelector.C create mode 100644 src/phasicFlow/structuredData/pointStructure/selectors/pStructSelector/pStructSelector.H create mode 100644 src/phasicFlow/structuredData/pointStructure/selectors/rangeAll/rangeAll.C create mode 100644 src/phasicFlow/structuredData/pointStructure/selectors/rangeAll/rangeAll.H create mode 100644 src/phasicFlow/structuredData/trisurfaceStructure/bitTransfer.H create mode 100644 src/phasicFlow/structuredData/trisurfaceStructure/multiTriSurface.C create mode 100644 src/phasicFlow/structuredData/trisurfaceStructure/multiTriSurface.H create mode 100644 src/phasicFlow/structuredData/trisurfaceStructure/stlFile.C create mode 100644 src/phasicFlow/structuredData/trisurfaceStructure/stlFile.H create mode 100644 src/phasicFlow/structuredData/trisurfaceStructure/triSurface.C create mode 100644 src/phasicFlow/structuredData/trisurfaceStructure/triSurface.H create mode 100644 src/phasicFlow/structuredData/trisurfaceStructure/triSurfaceKernels.H create mode 100644 src/phasicFlow/structuredData/trisurfaceStructure/triangleFunctions.H diff --git a/src/phasicFlow/Kokkos/KokkosTypes.H b/src/phasicFlow/Kokkos/KokkosTypes.H new file mode 100644 index 00000000..63ff7d40 --- /dev/null +++ b/src/phasicFlow/Kokkos/KokkosTypes.H @@ -0,0 +1,135 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __KokkosTypes_H__ +#define __KokkosTypes_H__ + + +#include +#include +#include + + +namespace pFlow +{ + +class DeviceSide{}; +class HostSide{}; + +template +struct selectSide{}; + +using HostSpace = Kokkos::HostSpace; +using Serial = Kokkos::Serial; + +#ifdef _OPENMP +using OpenMP = Kokkos::OpenMP; +#endif + +using DefaultHostExecutionSpace = Kokkos::DefaultHostExecutionSpace; +using DefaultExecutionSpace = Kokkos::DefaultExecutionSpace; + + + +template + using kPair = Kokkos::pair; + +using range = kPair; + +using range64 = kPair; + +template + using ViewTypeScalar = Kokkos::View; + +template + using ViewType1D = Kokkos::View; + +template + using ViewType3D = Kokkos::View; + +template + using unorderedMap = Kokkos::UnorderedMap; + +template + using unorderedSet = Kokkos::UnorderedMap; + +template + using deviceHashMap= Kokkos::UnorderedMap; + +template + using hostHashMap= Kokkos::UnorderedMap; + +template + using deviceHashSet= Kokkos::UnorderedMap; + +template + using hostHashSet = Kokkos::UnorderedMap; + +// a 1D array (vector) with default device (memory space and execution space) +template + using deviceViewTypeScalar = Kokkos::View; + +template + using deviceViewType1D = Kokkos::View; + +template + using deviceViewType2D = Kokkos::View; + + +// a 1D array (vector with host memeory space) +template + using hostViewTypeScalar = Kokkos::View; + +template + using hostViewType1D = Kokkos::View; + +template + using hostViewType2D = Kokkos::View; + + +#ifdef __CUDACC__ +using Cuda = Kokkos::Cuda; +template + using cudaViewTypeScalar = Kokkos::View; + +template + using cudaViewType1D = Kokkos::View; + +template + using cudaViewType2D = Kokkos::View; +#endif + + +template +using deviceAtomicViewType1D = + Kokkos::View< + T*, + Kokkos::MemoryTraits::value?0:Kokkos::Atomic>>; + +template +using deviceAtomicViewType3D = + Kokkos::View< + T***, + Kokkos::MemoryTraits::value?0:Kokkos::Atomic>>; + + +} // pFlow + +#endif //__KokkosTypes_H__ diff --git a/src/phasicFlow/Kokkos/KokkosUtilities.H b/src/phasicFlow/Kokkos/KokkosUtilities.H new file mode 100644 index 00000000..972565f5 --- /dev/null +++ b/src/phasicFlow/Kokkos/KokkosUtilities.H @@ -0,0 +1,92 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __KokkosUtilities_H__ +#define __KokkosUtilities_H__ + + +#include "KokkosTypes.H" + + +namespace pFlow +{ + +template +INLINE_FUNCTION_H +bool constexpr isHostAccessible() +{ + return Kokkos::SpaceAccessibility::accessible; +} + +template +INLINE_FUNCTION_H +bool constexpr areAccessible() +{ + return Kokkos::SpaceAccessibility::accessible; +} + +template < + typename Type, + typename... Properties> +INLINE_FUNCTION_H +void realloc( ViewType1D& view, int32 len) +{ + Kokkos::realloc(view, len); +} + +template < + typename Type, + typename... Properties> +INLINE_FUNCTION_H +void reallocNoInit(ViewType1D& view, int32 len) +{ + using ViewType = ViewType1D; + word vl = view.label(); + view = ViewType(); // Deallocate first + view = ViewType( + Kokkos::view_alloc( + Kokkos::WithoutInitializing, + vl), + len); +} + +template < + typename Type, + typename... Properties> +INLINE_FUNCTION_H +void reallocFill( ViewType1D& view, int32 len, Type val) +{ + reallocNoInit(view, len); + Kokkos::deep_copy(view, val); +} + + +template +INLINE_FUNCTION_H +void swapViews(ViewType& v1, ViewType &v2) +{ + auto tmp = v1; + v1 = v2; + v2 = tmp; +} + +} // pFlow + +#endif //__KokkosUtilities_H__ diff --git a/src/phasicFlow/Kokkos/ViewAlgorithms.H b/src/phasicFlow/Kokkos/ViewAlgorithms.H new file mode 100644 index 00000000..4d944a87 --- /dev/null +++ b/src/phasicFlow/Kokkos/ViewAlgorithms.H @@ -0,0 +1,593 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __ViewAlgorithms_H__ +#define __ViewAlgorithms_H__ + + +#include "numericConstants.H" +#include "KokkosUtilities.H" +#include "kokkosAlgorithms.H" +#include "stdAlgorithms.H" +#include "cudaAlgorithms.H" + + +namespace pFlow +{ + +inline const size_t maxSizeToSerial__ = 64; + +template +INLINE_FUNCTION_H +int32 count( + const ViewType1D& view, + int32 start, + int32 end, + const T& val) +{ + using ExecutionSpace = typename ViewType1D::execution_space; + + int32 numElems = end-start; + + if constexpr( isHostAccessible()) + { + if(numElems( + view.data()+start, + numElems, + val); + } + } + + return pFlow::algorithms::KOKKOS::count( + view.data()+start, + numElems, + val); +} + +template +INLINE_FUNCTION_H +void fill +( + ViewType1D& view, + range span, + T val +) +{ + using ExecutionSpace = typename ViewType1D::execution_space; + + + if constexpr( isHostAccessible()) + { + int32 numElems = span.second-span.first; + if( numElems( + view.data()+span.first, + numElems, + val); + return; + } + } + + auto subV = Kokkos::subview(view, span); + Kokkos::deep_copy(subV, val); +} + +template +void fill +( + ViewType1D& view, + int32 start, + int32 end, + T val +) +{ + fill(view, range(start,end),val); +} + +template< + typename Type, + typename... properties> +void fillSequence( + ViewType1D& view, + int32 start, + int32 end, + const Type startVal + ) +{ + + using ExecutionSpace = typename ViewType1D::execution_space; + int32 numElems = end-start; + + if constexpr( isHostAccessible()) + { + if(numElems( + view.data()+start, + numElems, + startVal); + return ; + } + } + + pFlow::algorithms::KOKKOS::fillSequence( + view.data()+start, + numElems, + startVal); + + return ; +} + + +template< + typename Type, + typename... properties, + typename indexType, + typename... indexProperties> +bool fillSelected( + ViewType1D view, + const ViewType1D indices, + const int32 numElems, + const Type val, + typename std::enable_if_t< + areAccessible< + typename ViewType1D::execution_space, + typename ViewType1D::memory_space>(), + bool> = true ) +{ + + using ExecutionSpace = typename ViewType1D::execution_space; + + if constexpr( isHostAccessible()) + { + if(numElems( + view.data(), + indices.data(), + numElems, + val); + return true; + } + } + + pFlow::algorithms::KOKKOS::fillSelected( + view.data(), + indices.data(), + numElems, + val); + + return true; +} + +template< + typename Type, + typename... properties, + typename indexType, + typename... indexProperties> + //typename valType> //, + //typename... valProperties> +bool fillSelected( + ViewType1D view, + const ViewType1D indices, + const ViewType1D vals, + const int32 numElems , + typename std::enable_if_t< + areAccessible< + typename ViewType1D::execution_space, + typename ViewType1D::memory_space>(), + bool> = true ) +{ + + using ExecutionSpace = typename ViewType1D::execution_space; + + + + if constexpr( isHostAccessible()) + { + if(numElems( + view.data(), + indices.data(), + vals.data(), + numElems + ); + return true; + } + } + + + pFlow::algorithms::KOKKOS::fillSelected( + view.data(), + indices.data(), + vals.data(), + numElems + ); + + return true; +} + + +template +INLINE_FUNCTION_H +T min( + const ViewType1D& view, + int32 start, + int32 end) +{ + + using ExecutionSpace = typename ViewType1D::execution_space; + + int32 numElems = end-start; + + if constexpr( isHostAccessible()) + { + if(numElems( + view.data()+start, + numElems); + } + } + + return + pFlow::algorithms::KOKKOS::min( + view.data()+start, + numElems); +} + +template +INLINE_FUNCTION_H +T max( + const ViewType1D& view, + int32 start, + int32 end) +{ + + using ExecutionSpace = typename ViewType1D::execution_space; + + int32 numElems = end-start; + + if constexpr( isHostAccessible()) + { + if(numElems( + view.data()+start, + numElems); + } + } + + return + pFlow::algorithms::KOKKOS::max( + view.data()+start, + numElems); +} + +template < + typename dType, + typename... dProperties, + typename sType, + typename... sProperties> +INLINE_FUNCTION_H +void copy( + const ViewType1D& dst, + const ViewType1D& src + ) +{ + Kokkos::deep_copy(dst,src); +} + +template < + typename dType, + typename... dProperties, + typename sType, + typename... sProperties> +INLINE_FUNCTION_H +void copy( + const ViewType1D& dst, + int32 dStart, + const ViewType1D& src, + int32 sStart, + int32 sEnd + ) +{ + + range sSpan(sStart,sEnd); + range dSpan(dStart,dStart+(sEnd-sStart)); + + auto srcSub = Kokkos::subview(src, sSpan); + auto dstSub = Kokkos::subview(dst, dSpan); + + Kokkos::deep_copy(dstSub,srcSub); +} + +template < + typename dType, + typename sType, + typename... sProperties> +INLINE_FUNCTION_H +void getNth( + dType& dst, + const ViewType1D& src, + const int32 n + ) +{ + range span(n,n+1); + auto subV = Kokkos::subview(src, span); + hostViewType1D dstView("getNth",1); + Kokkos::deep_copy(dstView,subV); + dst = *dstView.data(); +} + + +template +INLINE_FUNCTION_H +void sort( + ViewType1D& view, + int32 start, + int32 end) +{ + + using ExecutionSpace = typename ViewType1D::execution_space; + + int32 numElems = end-start; + + if constexpr( isHostAccessible()) + { + if(numElems( + view.data()+start, + numElems); + return; + } + else + { + pFlow::algorithms::STD::sort( + view.data()+start, + numElems); + return; + } + } + +#ifdef __CUDACC__ + + pFlow::algorithms::CUDA::sort( + view.data()+start, + numElems); +#else + static_assert("sort on device is not defined!"); + +#endif + + return; +} + +template +INLINE_FUNCTION_H +void sort( + ViewType1D& view, + int32 start, + int32 end, + CompareFunc compare) +{ + + using ExecutionSpace = typename ViewType1D::execution_space; + + int32 numElems = end-start; + + if constexpr( isHostAccessible()) + { + if(numElems( + view.data()+start, + numElems, + compare); + return; + } + else + { + pFlow::algorithms::STD::sort( + view.data()+start, + numElems, + compare); + return; + } + } + +#ifdef __CUDACC__ + + pFlow::algorithms::CUDA::sort( + view.data()+start, + numElems, + compare); +#else + static_assert("sort on device is not defined!"); + +#endif + + return; +} + +template< + typename Type, + typename... properties, + typename permType, + typename... permProperties> +void permuteSort( + const ViewType1D& view, + int32 start, + int32 end, + ViewType1D& permuteView, + int32 permStart, + typename std::enable_if_t< + areAccessible< + typename ViewType1D::execution_space, + typename ViewType1D::memory_space>(), + bool> = true ) +{ + using ExecutionSpace = typename ViewType1D::execution_space; + + int32 numElems = end-start; + + if constexpr( isHostAccessible()) + { + if(numElems( + view.data()+start, + permuteView.data()+permStart, + numElems ); + return; + } + else + { + pFlow::algorithms::STD::permuteSort( + view.data()+start, + permuteView.data()+permStart, + numElems); + return; + } + } + +#ifdef __CUDACC__ + + pFlow::algorithms::CUDA::permuteSort( + view.data()+start, + permuteView.data()+permStart, + numElems); +#else + static_assert("sort on device is not defined!"); + +#endif + +} + +template< + typename Type, + typename... properties> +INLINE_FUNCTION_HD +int32 binarySearch( + const ViewType1D& view, + int32 start, + int32 end, + const Type& val) +{ + + if(end<=start)return -1; + + if(auto res = + pFlow::algorithms::binarySearch(view.data()+start,end-start,val); res>=0) { + return res+start; + } + else{ + return res; + } +} + +template< + typename Type, + typename... properties, + typename dType, + typename... dProperties> +void exclusiveScan( + const ViewType1D& view, + int32 start, + int32 end, + ViewType1D& dView, + int32 dStart, + typename std::enable_if_t< + areAccessible< + typename ViewType1D::execution_space, + typename ViewType1D::memory_space>(), + bool> = true ) +{ + using ExecutionSpace = typename ViewType1D::execution_space; + + int32 numElems = end-start; + if constexpr( isHostAccessible()) + { + if(numElems( + view.data()+start, + dView.data()+dStart, + numElems); + return; + } + } + + pFlow::algorithms::KOKKOS::exclusiveScan( + view.data()+start, + dView.data()+dStart, + numElems); +} + + +template< + typename Type, + typename... properties, + typename dType, + typename... dProperties> +void inclusiveScan( + const ViewType1D& view, + int32 start, + int32 end, + ViewType1D& dView, + int32 dStart, + typename std::enable_if_t< + areAccessible< + typename ViewType1D::execution_space, + typename ViewType1D::memory_space>(), + bool> = true ) +{ + using ExecutionSpace = typename ViewType1D::execution_space; + + int32 numElems = end-start; + if constexpr( isHostAccessible()) + { + if(numElems( + view.data()+start, + dView.data()+dStart, + numElems); + return; + } + } + + pFlow::algorithms::KOKKOS::inclusiveScan( + view.data()+start, + dView.data()+dStart, + numElems); +} + +} // pFlow + + +#endif // Viewalgorithms diff --git a/src/phasicFlow/Kokkos/baseAlgorithms.H b/src/phasicFlow/Kokkos/baseAlgorithms.H new file mode 100644 index 00000000..2446509c --- /dev/null +++ b/src/phasicFlow/Kokkos/baseAlgorithms.H @@ -0,0 +1,245 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __baseAlgorithms_H__ +#define __baseAlgorithms_H__ + + +#include "numericConstants.H" + +inline const size_t sizeToSerial__ = 64; + +namespace pFlow +{ + +// counts the number of elements that matches val +// the execution space is selected based on the View::execution_spcae +/*template +INLINE_FUNCTION_H +size_t count( + const ViewType1D& view, + size_t start, + size_t end, + const T& val + ) +{ + + auto RP = Kokkos::RangePolicy< + Kokkos::IndexType, + typename ViewType1D::execution_space >(start, end); + + size_t totalNum=0; + Kokkos::parallel_reduce( + "baseAlgorithms-count", + RP, + LAMBDA_HD(label i, size_t & valueToUpdate){ + if( equal(view[i], val) ) valueToUpdate += 1; + }, totalNum ); + + return totalNum; +}*/ + + +template +INLINE_FUNCTION_H +T min( const ViewType1D& view, size_t start, size_t end ) +{ + + T minValue = largestPositive(); + + auto RP = Kokkos::RangePolicy< + Kokkos::IndexType, + typename ViewType1D::execution_space >(start, end); + + Kokkos::parallel_reduce("baseAlgorithms-min", + RP, + LAMBDA_HD(label i, T& valueToUpdate){ + valueToUpdate = min(view[i],valueToUpdate); + }, + Kokkos :: Min < T >( minValue ) + ); + return minValue; +} + +template +INLINE_FUNCTION_H +T max( const ViewType1D& view, size_t start, size_t end ) +{ + + T maxValue = largestNegative(); + + auto RP = Kokkos::RangePolicy< + Kokkos::IndexType, + typename ViewType1D::execution_space >(start, end); + + Kokkos::parallel_reduce("baseAlgorithms-max", + RP, + LAMBDA_HD(label i, T& valueToUpdate){ + valueToUpdate = max(view[i],valueToUpdate); + }, + Kokkos::Max( maxValue ) + ); + return maxValue; +} + +template +INLINE_FUNCTION_H +T min_serial(const ViewType1D& view, size_t start, size_t end) +{ + T minValue = largestPositive(); + for(label i=start; i +INLINE_FUNCTION_H +T max_serial(const ViewType1D& view, size_t start, size_t end) +{ + T maxValue = largestNegative(); + for(label i=start; i +void apply_to_each(const ViewType1D& view, size_t start, size_t end, UnaryFunction func) +{ + auto RP = Kokkos::RangePolicy< + Kokkos::IndexType, + typename ViewType1D::execution_space >(start, end); + + Kokkos::parallel_for("baseAlgorithms-for_each", + RP, + LAMBDA_HD(label i){ + view[i] = func(i); + } + ); +} + + +template +void insertSetElementH +( + ViewType1D& view, + hostViewType1D