diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb2241acfd..77ea59320c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ env: # A workflow is made up of one or more jobs that can run sequentially or in parallel jobs: ############################################################################### - Linux-float: + Linux-sycl: if: ${{ github.event_name != 'workflow_dispatch' }} runs-on: ubuntu-22.04 env: @@ -51,6 +51,11 @@ jobs: libfontconfig1-dev `# From here required for vcpkg opencascade`\ libx11-dev \ libgl-dev + wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt update + sudo apt install intel-basekit \ + intel-oneapi-runtime-opencl - uses: hendrikmuhs/ccache-action@v1.2 with: @@ -59,7 +64,7 @@ jobs: - uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} with: committish: ${{ env.VCPKG_VERSION }} - cache: false + cache-version: ${{env.VCPKG_VERSION}} - name: Install dependencies run: | @@ -73,24 +78,70 @@ jobs: boost-geometry \ simbody \ gtest \ - xsimd \ - pybind11 \ - opencascade + pybind11 - - name: Generate buildsystem using float (No test) + - name: Generate buildsystem run: | + # sycl environment has to be setup for each session + source /opt/intel/oneapi/setvars.sh --include-intel-llvm cmake -G Ninja \ -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_C_COMPILER=icx -D CMAKE_CXX_COMPILER=icpx \ -D CMAKE_TOOLCHAIN_FILE="${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake" \ -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -D SPHINXSYS_USE_FLOAT=ON \ - -D SPHINXSYS_MODULE_OPENCASCADE=ON \ -D SPHINXSYS_CI=ON \ + -D SPHINXSYS_USE_SYCL=ON \ + -D TEST_STATE_RECORDING=OFF \ -S ${{github.workspace}} \ -B ${{github.workspace}}/build - - name: Build using float - run: cmake --build build --config Release --verbose + - name: Build libraries and tests which are using SYCL + run: | + # sycl environment has to be setup for each session + source /opt/intel/oneapi/setvars.sh --include-intel-llvm + cmake --build build --config Release --verbose + + - name: Test with the first try + id: first-try + run: | + source /opt/intel/oneapi/setvars.sh --include-intel-llvm + cd build/tests/tests_sycl + ctest --output-on-failure --timeout 1000 + continue-on-error: true + + - name: Test with the second try for failed cases + id: second-try + if: ${{ steps.first-try.outcome == 'failure' }} + run: | + source /opt/intel/oneapi/setvars.sh --include-intel-llvm + cd build/tests/tests_sycl + ctest --rerun-failed --output-on-failure --timeout 1000 + continue-on-error: true + + - name: Test with the third try for failed cases + id: third-try + if: ${{ steps.second-try.outcome == 'failure' }} + run: | + source /opt/intel/oneapi/setvars.sh --include-intel-llvm + cd build/tests/tests_sycl + ctest --rerun-failed --output-on-failure --timeout 1000 + continue-on-error: true + + - name: Test with the fourth try for failed cases + id: fourth-try + if: ${{ steps.third-try.outcome == 'failure' }} + run: | + source /opt/intel/oneapi/setvars.sh --include-intel-llvm + cd build/tests/tests_sycl + ctest --rerun-failed --output-on-failure --timeout 1000 + continue-on-error: true + + - name: Test with the last try for failed cases + if: ${{ steps.fourth-try.outcome == 'failure' }} + run: | + source /opt/intel/oneapi/setvars.sh --include-intel-llvm + cd build/tests/tests_sycl + ctest --rerun-failed --output-on-failure --timeout 1000 ############################################################################### Linux-build: diff --git a/.gitignore b/.gitignore index ecdad57838..ddf793482e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ ##### VS Code # VS Code setting up .vscode +*.json +CMakePresets.json ##### Windows # Windows thumbnail cache files diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fd5328cbc..e6ab2ece88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ option(SPHINXSYS_DEVELOPER_MODE "Developer mode has more flags active for code q option(SPHINXSYS_USE_FLOAT "Build using float (single-precision floating-point format) as primary type" OFF) option(SPHINXSYS_USE_SIMD "Build using SIMD instructions" OFF) option(SPHINXSYS_MODULE_OPENCASCADE "Build extension relying on OpenCASCADE" OFF) +option(SPHINXSYS_USE_SYCL "Build using SYCL acceleration or not" OFF) # ------ Global properties (Some cannot be set on INTERFACE targets) set(CMAKE_VERBOSE_MAKEFILE OFF CACHE BOOL "Enable verbose compilation commands for Makefile and Ninja" FORCE) # Extra fluff needed for Ninja: https://github.com/ninja-build/ninja/issues/900 @@ -49,6 +50,14 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # target_compile_options(sphinxsys_core INTERFACE $<$:-Wpedantic>) # For strict C++ standard compliance # TODO: endif() +if(SPHINXSYS_USE_SYCL) + if(NOT SPHINXSYS_USE_FLOAT) + set(SPHINXSYS_USE_FLOAT ON) + message("-- Float is used as required by SPHinXsysSYCL.") + endif() +endif() + +target_compile_definitions(sphinxsys_core INTERFACE SPHINXSYS_USE_SYCL=$) target_compile_definitions(sphinxsys_core INTERFACE SPHINXSYS_USE_FLOAT=$) # ------ Dependencies @@ -98,6 +107,21 @@ if(TARGET Boost::program_options) target_link_libraries(sphinxsys_core INTERFACE Boost::program_options) endif() +if(SPHINXSYS_USE_SYCL) + set(SPHINXSYS_USE_SYCL ON) + if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + message(FATAL_ERROR "-- SPHinXsysSYCL is only supported with IntelLLVM compiler.") + endif() + + if(NOT SPHINXSYS_SYCL_TARGETS) + set(SPHINXSYS_SYCL_TARGETS spir64_x86_64) + endif() + + message("-- Set SPHinXsysSYCL target as ${SPHINXSYS_SYCL_TARGETS}") + target_compile_options(sphinxsys_core INTERFACE -fsycl -fsycl-targets=${SPHINXSYS_SYCL_TARGETS} -Wno-unknown-cuda-version) + target_link_options(sphinxsys_core INTERFACE -fsycl -fsycl-targets=${SPHINXSYS_SYCL_TARGETS} -Wno-unknown-cuda-version) +endif() + # ------ Setup the concrete libraries add_subdirectory(src) add_subdirectory(modules) diff --git a/README.md b/README.md index 167e3d0875..29146f0496 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ # ![SPHinXsys Logo](assets/logo.png) SPHinXsys -**Notice on repository transfer to SPHinXsys team** +## Notice on the transformation to heterogeneous computational platform -In order to promoting open-source democratization, -this repository will be transferred to the SPHinXsys team -in the next few weeks. -After the transfer, the decision-making process for SPHinXsys will be made by a number of project leaders from different institutions. +SPHinXsys is set to undergo a major transformation, moving from traditional CPU parallelism to a new era of heterogeneous parallelism, where compute-intensive tasks can harness the power of both CPUs and GPUs. This evolution will be driven by SYCL (via Intel's DPC++), enabling us to leverage heterogeneous architectures with standard C++. Importantly, this transformation will be achieved with minimal disruption to the existing codebase, ensuring seamless continuity for current users. + +The groundwork for this shift is already laid out. A 2D dambreak test case has been added to the `test/test_sycl` folder, showcasing the capabilities of our specially designed framework. What's unique about this framework is that it allows for the development and testing of numerical methods even in environments without GPUs or DPC++ installed. If these methods are crafted following our specified guidelines and prove functional, they will seamlessly operate in environments equipped with DPC++ and GPU support. + +By embracing this new paradigm, SPHinXsys is positioning itself at the forefront of multi-physics modeling, where performance meets versatility. **Project status** [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) @@ -19,7 +20,14 @@ After the transfer, the decision-making process for SPHinXsys will be made by a [![YouTube](https://img.shields.io/badge/YouTube-FF0000.svg?style=flat&logo=YouTube&logoColor=white)](https://www.youtube.com/channel/UCexdJbxOn9dvim6Jg1dnCFQ) [![Bilibili](https://img.shields.io/badge/bilibili-%E5%93%94%E5%93%A9%E5%93%94%E5%93%A9-critical)](https://space.bilibili.com/1761273682/video) -## Description +## Master and stable branches + +The most active development (or default) branch of this repository is `master`. +This branch gives the updated development of SPHinXsys using heterogeneous (using TBB and SYCL) parallelism. + +The most stable branch of the repository is `version1.0`, which is based on CPU (using TBB) parallelism. + +## Repository Description SPHinXsys (pronunciation: s'fink-sis) is an acronym from **S**moothed **P**article **H**ydrodynamics for **in**dustrial comple**X** **sys**tems. The multi-physics library uses SPH (smoothed particle hydrodynamics) as the underlying numerical method @@ -46,6 +54,8 @@ Here, we present several short examples in flow, solid dynamics, fluid structure + + ## Fully compatible to classical FVM method @@ -61,36 +71,28 @@ The only difference is that SPHinXsys reads a predefined mesh, other than genera ## Target-driven optimization -The unique target-driven optimization is able to achieve the optimization target and physical solution all-in-once, +The unique target-driven optimization is able to achieve the optimization target and physical solution all-in-once, which is able to accelerate optimization process greatly. -The following gives an example of optimizing the conductivity distribution +The following gives an example of optimizing the conductivity distribution for a thermal domain problem targeting minimum average temperature. Note that the physical solution of the thermal domain (right) and the optimal distribution of conductivity (left) -are obtained at the same time when optimization is finished. -Also note that the entire optimization process is very fast and +are obtained at the same time when optimization is finished. +Also note that the entire optimization process is very fast and only several times slower than that for a single physical solution with given conductivity distribution. ## Python interface -While SPHinXsys is written in C++, it provides a python interface for users to write python scripts to control the simulation, +While SPHinXsys is written in C++, it provides a python interface for users to write python scripts to control the simulation, including carry out regression tests for continuous integration (CI) and other tasks. One example is given below for the dambreak case. -Please check the source code of -[2D Dambreak case with python interface](https://github.com/Xiangyu-Hu/SPHinXsys/tree/master/tests/2d_examples/test_2d_dambreak_python) +Please check the source code of +[2D Dambreak case with python interface](https://github.com/Xiangyu-Hu/SPHinXsys/tree/master/tests/2d_examples/test_2d_dambreak_python) for the usage. -## Heterogenous computing - -Recently, we have a preview release for the heterogeneous computing version of SPHinXsys. -By using SYCL, a royalty-free open standard developed by the Khronos Group that allows developers -to program heterogeneous architectures in standard C++, SPHinXsys is able to utilize the power of GPU. -Please check the [Preview Release](https://github.com/Xiangyu-Hu/SPHinXsys/releases/tag/v1.0-beta.08-sycl) -and the [SYCL branch](https://github.com/Xiangyu-Hu/SPHinXsys/tree/sycl) for details. - ## Publications Main publication on the library: @@ -114,10 +116,10 @@ For a Docker image, check . ## Interaction with SPHinXsys and the team -Thank you for using and supporting our open-source project! +Thank you for using and supporting our open-source project! We value each feedback. -#### For SPHinXsys users: +#### For SPHinXsys users Your input is crucial to us. We encourage you to report any issues you encounter with the library, including: @@ -128,7 +130,7 @@ Your input is crucial to us. We encourage you to report any issues you encounter We particularly appreciate feedback stemming from practical simulations or projects, as these insights are essential for improving SPHinXsys. -#### For SPHinXsys developers: +#### For SPHinXsys developers If you don't have a GitHub account yet, please register for one. Fork the SPHinXsys repository to add new features or improve existing ones. Once your changes are ready, commit them and initiate a pull request to have your contributions merged into the main repository. diff --git a/modules/opencascade/opencascade/relax_dynamics_surface.cpp b/modules/opencascade/opencascade/relax_dynamics_surface.cpp index f3c3c15aa1..351e9f976c 100644 --- a/modules/opencascade/opencascade/relax_dynamics_surface.cpp +++ b/modules/opencascade/opencascade/relax_dynamics_surface.cpp @@ -11,8 +11,8 @@ namespace relax_dynamics { //=================================================================================================// ShapeSurfaceBounding2::ShapeSurfaceBounding2(RealBody &real_body_) - : LocalDynamics(real_body_), DataDelegateSimple(real_body_), - pos_(*particles_->getVariableDataByName("Position")) + : LocalDynamics(real_body_), + pos_(particles_->getVariableDataByName("Position")) { shape_ = &real_body_.getInitialShape(); } @@ -24,7 +24,7 @@ void ShapeSurfaceBounding2::update(size_t index_i, Real dt) //=================================================================================================// RelaxationStepInnerFirstHalf:: RelaxationStepInnerFirstHalf(BaseInnerRelation &inner_relation) - : BaseDynamics(inner_relation.getSPHBody()), real_body_(inner_relation.real_body_), + : BaseDynamics(), real_body_(inner_relation.real_body_), inner_relation_(inner_relation), relaxation_acceleration_inner_(inner_relation) {} //=================================================================================================// void RelaxationStepInnerFirstHalf::exec(Real dt) @@ -37,7 +37,7 @@ void RelaxationStepInnerFirstHalf::exec(Real dt) //=================================================================================================// RelaxationStepInnerSecondHalf:: RelaxationStepInnerSecondHalf(BaseInnerRelation &inner_relation) - : BaseDynamics(inner_relation.getSPHBody()), real_body_(inner_relation.real_body_), + : BaseDynamics(), real_body_(inner_relation.real_body_), get_time_step_square_(*real_body_), update_particle_position_(*real_body_), surface_bounding_(*real_body_) { @@ -52,10 +52,10 @@ void RelaxationStepInnerSecondHalf::exec(Real dt) //=================================================================================================// SurfaceNormalDirection::SurfaceNormalDirection(SPHBody &sph_body) - : DataDelegateSimple(sph_body), LocalDynamics(sph_body), + : LocalDynamics(sph_body), surface_shape_(DynamicCast(this, &sph_body.getInitialShape())), - pos_(*particles_->getVariableDataByName("Position")), - n_(*particles_->registerSharedVariable("NormalDirection")) {} + pos_(particles_->getVariableDataByName("Position")), + n_(particles_->registerStateVariable("NormalDirection")) {} //=================================================================================================// void SurfaceNormalDirection::update(size_t index_i, Real dt) diff --git a/modules/opencascade/opencascade/relax_dynamics_surface.h b/modules/opencascade/opencascade/relax_dynamics_surface.h index 8fc2e81ad7..4d19b5de3d 100644 --- a/modules/opencascade/opencascade/relax_dynamics_surface.h +++ b/modules/opencascade/opencascade/relax_dynamics_surface.h @@ -41,8 +41,7 @@ class SurfaceShape; namespace relax_dynamics { -class ShapeSurfaceBounding2 : public LocalDynamics, - public DataDelegateSimple +class ShapeSurfaceBounding2 : public LocalDynamics { public: ShapeSurfaceBounding2(RealBody &real_body_); @@ -50,7 +49,7 @@ class ShapeSurfaceBounding2 : public LocalDynamics, void update(size_t index_i, Real dt = 0.0); protected: - StdLargeVec &pos_; + Vecd *pos_; Shape *shape_; }; @@ -86,7 +85,7 @@ class RelaxationStepInnerSecondHalf : public BaseDynamics * @class SurfaceNormalDirection * @brief get the normal direction of surface particles. */ -class SurfaceNormalDirection : public DataDelegateSimple, public LocalDynamics +class SurfaceNormalDirection : public LocalDynamics { public: explicit SurfaceNormalDirection(SPHBody &sph_body); @@ -95,7 +94,7 @@ class SurfaceNormalDirection : public DataDelegateSimple, public LocalDynamics protected: SurfaceShape *surface_shape_; - StdLargeVec &pos_, &n_; + Vecd *pos_, *n_; }; } // namespace relax_dynamics diff --git a/modules/structural_simulation/structural_simulation_class.cpp b/modules/structural_simulation/structural_simulation_class.cpp index 7a59a36778..613c5fc27a 100755 --- a/modules/structural_simulation/structural_simulation_class.cpp +++ b/modules/structural_simulation/structural_simulation_class.cpp @@ -22,7 +22,7 @@ BodyPartFromMesh::BodyPartFromMesh(SPHBody &body, SharedPtr t SolidBodyFromMesh::SolidBodyFromMesh( SPHSystem &system, SharedPtr triangle_mesh_shape, Real resolution, - SharedPtr material_model, StdLargeVec &pos_0, StdLargeVec &volume) + SharedPtr material_model, Vecd *pos_0, Real *volume) : SolidBody(system, triangle_mesh_shape) { defineAdaptationRatios(1.15, system.resolution_ref_ / resolution); @@ -33,7 +33,7 @@ SolidBodyFromMesh::SolidBodyFromMesh( SolidBodyForSimulation::SolidBodyForSimulation( SPHSystem &system, SharedPtr triangle_mesh_shape, Real resolution, - Real physical_viscosity, SharedPtr material_model, StdLargeVec &pos_0, StdLargeVec &volume) + Real physical_viscosity, SharedPtr material_model, Vecd *pos_0, Real *volume) : solid_body_from_mesh_(system, triangle_mesh_shape, resolution, material_model, pos_0, volume), inner_body_relation_(solid_body_from_mesh_), initial_normal_direction_(SimpleDynamics(solid_body_from_mesh_)), @@ -103,7 +103,7 @@ void relaxParticlesSingleResolution(bool write_particle_relaxation_data, std::cout << "The physics relaxation process of the imported model finished !" << std::endl; } -std::tuple, StdLargeVec> generateAndRelaxParticlesFromMesh( +std::tuple generateAndRelaxParticlesFromMesh( SharedPtr triangle_mesh_shape, Real resolution, bool particle_relaxation, bool write_particle_relaxation_data) { BoundingBox bb = triangle_mesh_shape->getBounds(); @@ -120,7 +120,7 @@ std::tuple, StdLargeVec> generateAndRelaxParticlesFromMe relaxParticlesSingleResolution(write_particle_relaxation_data, model, inner_relation); } - return std::tuple, StdLargeVec>(model.getBaseParticles().ParticlePositions(), model.getBaseParticles().VolumetricMeasures()); + return std::tuple(model.getBaseParticles().ParticlePositions(), model.getBaseParticles().VolumetricMeasures()); } BodyPartByParticle *createBodyPartFromMesh(SPHBody &body, const StlList &stl_list, size_t body_index, SharedPtr tmesh) @@ -199,6 +199,7 @@ StructuralSimulation::StructuralSimulation(const StructuralSimulationInput &inpu system_(SPHSystem(BoundingBox(Vec3d::Zero(), Vec3d::Zero()), system_resolution_)), scale_system_boundaries_(input.scale_system_boundaries_), io_environment_(system_), + physical_time_(*system_.getSystemVariableDataByName("PhysicalTime")), // optional: boundary conditions non_zero_gravity_(input.non_zero_gravity_), @@ -325,12 +326,12 @@ void StructuralSimulation::initializeElasticSolidBodies() // we delete the .stl ending temp_name.erase(temp_name.size() - 4); // create the initial particles from the triangle mesh shape with particle relaxation option - std::tuple, StdLargeVec> particles = + std::tuple particles = generateAndRelaxParticlesFromMesh(body_mesh_list_[i], resolution_list_[i], particle_relaxation_list_[i], write_particle_relaxation_data_); // get the particles' initial position and their volume - StdLargeVec &pos_0 = std::get<0>(particles); - StdLargeVec &volume = std::get<1>(particles); + Vecd *pos_0 = std::get<0>(particles); + Real *volume = std::get<1>(particles); // create the SolidBodyForSimulation solid_body_list_.emplace_back(makeShared( @@ -405,7 +406,8 @@ void StructuralSimulation::initializeGravity() { SharedPtr gravity_ptr = makeShared(non_zero_gravity_[gravity_index_i].second); gravity_list_.emplace_back(non_zero_gravity_[gravity_index_i].second); - initialize_gravity_.emplace_back(makeShared>(*solid_body_list_[i]->getSolidBodyFromMesh(), gravity_list_.back())); + initialize_gravity_.emplace_back(makeShared>>( + *solid_body_list_[i]->getSolidBodyFromMesh(), gravity_list_.back())); gravity_index_i++; } } @@ -674,7 +676,7 @@ void StructuralSimulation::executeContactFactorSummation() int index = (i - number_of_general_contacts) / 2; Real start_time = time_dep_contacting_body_pairs_list_[index].second[0]; Real end_time = time_dep_contacting_body_pairs_list_[index].second[1]; - if (GlobalStaticVariables::physical_time_ >= start_time && GlobalStaticVariables::physical_time_ <= end_time) + if (physical_time_ >= start_time && physical_time_ <= end_time) { contact_density_list_[i]->exec(); } @@ -699,7 +701,7 @@ void StructuralSimulation::executeContactForce() int index = (i - number_of_general_contacts) / 2; Real start_time = time_dep_contacting_body_pairs_list_[index].second[0]; Real end_time = time_dep_contacting_body_pairs_list_[index].second[1]; - if (GlobalStaticVariables::physical_time_ >= start_time && GlobalStaticVariables::physical_time_ <= end_time) + if (physical_time_ >= start_time && physical_time_ <= end_time) { contact_force_list_[i]->exec(); } @@ -806,7 +808,7 @@ void StructuralSimulation::executeContactUpdateConfiguration() int index = (i - number_of_general_contacts) / 2; Real start_time = time_dep_contacting_body_pairs_list_[index].second[0]; Real end_time = time_dep_contacting_body_pairs_list_[index].second[1]; - if (GlobalStaticVariables::physical_time_ >= start_time && GlobalStaticVariables::physical_time_ <= end_time) + if (physical_time_ >= start_time && physical_time_ <= end_time) { contact_list_[i]->updateConfiguration(); } @@ -816,7 +818,7 @@ void StructuralSimulation::executeContactUpdateConfiguration() void StructuralSimulation::initializeSimulation() { - GlobalStaticVariables::physical_time_ = 0.0; + physical_time_ = 0.0; /** INITIALIZE SYSTEM */ system_.initializeSystemCellLinkedLists(); @@ -829,7 +831,7 @@ void StructuralSimulation::initializeSimulation() void StructuralSimulation::runSimulationStep(Real &dt, Real &integration_time) { if (iteration_ % 100 == 0) - std::cout << "N=" << iteration_ << " Time: " << GlobalStaticVariables::physical_time_ << " dt: " << dt << "\n"; + std::cout << "N=" << iteration_ << " Time: " << physical_time_ << " dt: " << dt << "\n"; /** UPDATE NORMAL DIRECTIONS */ executeUpdateElasticNormalDirection(); @@ -873,7 +875,7 @@ void StructuralSimulation::runSimulationStep(Real &dt, Real &integration_time) iteration_++; dt = system_.getSmallestTimeStepAmongSolidBodies(); integration_time += dt; - GlobalStaticVariables::physical_time_ += dt; + physical_time_ += dt; /** UPDATE BODIES CELL LINKED LISTS */ executeUpdateCellLinkedList(); @@ -893,7 +895,7 @@ void StructuralSimulation::runSimulation(Real end_time) TickCount t1 = TickCount::now(); TimeInterval interval; /** Main loop */ - while (GlobalStaticVariables::physical_time_ < end_time) + while (physical_time_ < end_time) { Real integration_time = 0.0; while (integration_time < output_period) @@ -916,7 +918,7 @@ void StructuralSimulation::runSimulation(Real end_time) double StructuralSimulation::runSimulationFixedDurationJS(int number_of_steps) { BodyStatesRecordingToVtp write_states(system_); - GlobalStaticVariables::physical_time_ = 0.0; + physical_time_ = 0.0; /** Statistics for computing time. */ write_states.writeToFile(0); @@ -947,10 +949,11 @@ double StructuralSimulation::runSimulationFixedDurationJS(int number_of_steps) Real StructuralSimulation::getMaxDisplacement(int body_index) { - StdLargeVec &pos = solid_body_list_[body_index].get()->getElasticSolidParticles()->ParticlePositions(); - StdLargeVec &pos0 = *solid_body_list_[body_index].get()->getElasticSolidParticles()->registerSharedVariableFrom("InitialPosition", "Position"); + BaseParticles *base_particles = solid_body_list_[body_index].get()->getElasticSolidParticles(); + Vecd *pos = base_particles->ParticlePositions(); + Vecd *pos0 = base_particles->registerStateVariableFrom("InitialPosition", "Position"); Real displ_max = 0; - for (size_t i = 0; i < pos0.size(); i++) + for (size_t i = 0; i < base_particles->TotalRealParticles(); i++) { Real displ = (pos[i] - pos0[i]).norm(); if (displ > displ_max) @@ -965,7 +968,7 @@ StructuralSimulationJS::StructuralSimulationJS(const StructuralSimulationInput & dt(0.0) { write_states_.writeToFile(0); - GlobalStaticVariables::physical_time_ = 0.0; + physical_time_ = 0.0; } void StructuralSimulationJS::runSimulationFixedDuration(int number_of_steps) diff --git a/modules/structural_simulation/structural_simulation_class.h b/modules/structural_simulation/structural_simulation_class.h index 7dea5734f2..4a3c15db25 100755 --- a/modules/structural_simulation/structural_simulation_class.h +++ b/modules/structural_simulation/structural_simulation_class.h @@ -80,7 +80,7 @@ class SolidBodyFromMesh : public SolidBody { public: SolidBodyFromMesh(SPHSystem &system, SharedPtr triangle_mesh_shape, Real resolution, - SharedPtr material_model, StdLargeVec &pos_0, StdLargeVec &volume); + SharedPtr material_model, Vec3d *pos_0, Real *volume); ~SolidBodyFromMesh(){}; }; @@ -100,7 +100,7 @@ class SolidBodyForSimulation // no particle reload --> direct generator SolidBodyForSimulation( SPHSystem &system, SharedPtr triangle_mesh_shape, Real resolution, - Real physical_viscosity, SharedPtr material_model, StdLargeVec &pos_0, StdLargeVec &volume); + Real physical_viscosity, SharedPtr material_model, Vec3d *pos_0, Real *volume); ~SolidBodyForSimulation(){}; SolidBodyFromMesh *getSolidBodyFromMesh() { return &solid_body_from_mesh_; }; @@ -200,6 +200,7 @@ class StructuralSimulation SPHSystem system_; Real scale_system_boundaries_; IOEnvironment io_environment_; + Real &physical_time_; StdVec> solid_body_list_; StdVec>> particle_normal_update_; @@ -210,7 +211,7 @@ class StructuralSimulation // for initializeATimeStep StdVec gravity_list_; - StdVec>> initialize_gravity_; + StdVec>>> initialize_gravity_; StdVec non_zero_gravity_; // for ExternalForceInBoundingBox StdVec>> force_bounding_box_; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9911d830e3..6ac0a2f67f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,11 @@ file(GLOB_RECURSE SPHINXSYS_SHARED_HEADERS CONFIGURE_DEPENDS shared/*.h shared/*.hpp) file(GLOB_RECURSE SPHINXSYS_SHARED_SOURCES CONFIGURE_DEPENDS shared/*.cpp) +if(SPHINXSYS_USE_SYCL) +file(GLOB_RECURSE SPHINXSYS_SYCL_HEADERS CONFIGURE_DEPENDS src_sycl/*.h src_sycl/*.hpp) +file(GLOB_RECURSE SPHINXSYS_SYCL_SOURCES CONFIGURE_DEPENDS src_sycl/*.cpp) +endif() + if(SPHINXSYS_2D) add_library(sphinxsys_2d) #Make sure in-tree projects can reference this as SPHinXsys::sphinxsys_2d @@ -8,25 +13,39 @@ if(SPHINXSYS_2D) add_library(SPHinXsys::sphinxsys_2d ALIAS sphinxsys_2d) file(GLOB_RECURSE SPHINXSYS_2D_HEADERS CONFIGURE_DEPENDS for_2D_build/*.h for_2D_build/*.hpp) - target_sources(sphinxsys_2d PUBLIC ${SPHINXSYS_SHARED_HEADERS} ${SPHINXSYS_2D_HEADERS}) - + file(GLOB_RECURSE SPHINXSYS_2D_SOURCES CONFIGURE_DEPENDS for_2D_build/*.cpp) + foreach(FILEPATH ${SPHINXSYS_SHARED_HEADERS}) get_filename_component(DIR ${FILEPATH} DIRECTORY) list(APPEND SPHINXSYS_2D_INCLUDE_DIRS ${DIR}) endforeach() + foreach(FILEPATH ${SPHINXSYS_2D_HEADERS}) get_filename_component(DIR ${FILEPATH} DIRECTORY) list(APPEND SPHINXSYS_2D_INCLUDE_DIRS ${DIR}) - endforeach() + endforeach() + + if(SPHINXSYS_USE_SYCL) + foreach(FILEPATH ${SPHINXSYS_SYCL_HEADERS}) + get_filename_component(DIR ${FILEPATH} DIRECTORY) + list(APPEND SPHINXSYS_2D_INCLUDE_DIRS ${DIR}) + endforeach() + + target_sources(sphinxsys_2d PUBLIC ${SPHINXSYS_SHARED_HEADERS} ${SPHINXSYS_2D_HEADERS} ${SPHINXSYS_SYCL_HEADERS}) + target_sources(sphinxsys_2d PRIVATE ${SPHINXSYS_SHARED_SOURCES} ${SPHINXSYS_2D_SOURCES} ${SPHINXSYS_SYCL_SOURCES}) + else() + target_sources(sphinxsys_2d PUBLIC ${SPHINXSYS_SHARED_HEADERS} ${SPHINXSYS_2D_HEADERS}) + target_sources(sphinxsys_2d PRIVATE ${SPHINXSYS_SHARED_SOURCES} ${SPHINXSYS_2D_SOURCES}) + endif() + + list(REMOVE_DUPLICATES SPHINXSYS_2D_INCLUDE_DIRS) + foreach(DIR ${SPHINXSYS_2D_INCLUDE_DIRS}) target_include_directories(sphinxsys_2d PUBLIC $) endforeach() target_include_directories(sphinxsys_2d PUBLIC $) - file(GLOB_RECURSE SPHINXSYS_2D_SOURCES CONFIGURE_DEPENDS for_2D_build/*.cpp) - target_sources(sphinxsys_2d PRIVATE ${SPHINXSYS_SHARED_SOURCES} ${SPHINXSYS_2D_SOURCES}) - target_link_libraries(sphinxsys_2d PUBLIC sphinxsys_core) endif() @@ -38,25 +57,37 @@ if(SPHINXSYS_3D) add_library(SPHinXsys::sphinxsys_3d ALIAS sphinxsys_3d) file(GLOB_RECURSE SPHINXSYS_3D_HEADERS CONFIGURE_DEPENDS for_3D_build/*.h for_3D_build/*.hpp) - target_sources(sphinxsys_3d PUBLIC ${SPHINXSYS_SHARED_HEADERS} ${SPHINXSYS_3D_HEADERS}) - + file(GLOB_RECURSE SPHINXSYS_3D_SOURCES CONFIGURE_DEPENDS for_3D_build/*.cpp) foreach(FILEPATH ${SPHINXSYS_SHARED_HEADERS}) - get_filename_component(DIR ${FILEPATH} DIRECTORY) - list(APPEND SPHINXSYS_3D_INCLUDE_DIRS ${DIR}) + get_filename_component(DIR ${FILEPATH} DIRECTORY) + list(APPEND SPHINXSYS_3D_INCLUDE_DIRS ${DIR}) endforeach() + foreach(FILEPATH ${SPHINXSYS_3D_HEADERS}) - get_filename_component(DIR ${FILEPATH} DIRECTORY) - list(APPEND SPHINXSYS_3D_INCLUDE_DIRS ${DIR}) + get_filename_component(DIR ${FILEPATH} DIRECTORY) + list(APPEND SPHINXSYS_3D_INCLUDE_DIRS ${DIR}) endforeach() + + if(SPHINXSYS_USE_SYCL) + foreach(FILEPATH ${SPHINXSYS_SYCL_HEADERS}) + get_filename_component(DIR ${FILEPATH} DIRECTORY) + list(APPEND SPHINXSYS_3D_INCLUDE_DIRS ${DIR}) + endforeach() + + target_sources(sphinxsys_3d PUBLIC ${SPHINXSYS_SHARED_HEADERS} ${SPHINXSYS_3D_HEADERS} ${SPHINXSYS_SYCL_HEADERS}) + target_sources(sphinxsys_3d PRIVATE ${SPHINXSYS_SHARED_SOURCES} ${SPHINXSYS_3D_SOURCES} ${SPHINXSYS_SYCL_SOURCES}) + else() + target_sources(sphinxsys_3d PUBLIC ${SPHINXSYS_SHARED_HEADERS} ${SPHINXSYS_3D_HEADERS}) + target_sources(sphinxsys_3d PRIVATE ${SPHINXSYS_SHARED_SOURCES} ${SPHINXSYS_3D_SOURCES}) + endif() + list(REMOVE_DUPLICATES SPHINXSYS_3D_INCLUDE_DIRS) + foreach(DIR ${SPHINXSYS_3D_INCLUDE_DIRS}) target_include_directories(sphinxsys_3d PUBLIC $) endforeach() target_include_directories(sphinxsys_3d PUBLIC $) - file(GLOB_RECURSE SPHINXSYS_3D_SOURCES CONFIGURE_DEPENDS for_3D_build/*.cpp) - target_sources(sphinxsys_3d PRIVATE ${SPHINXSYS_SHARED_SOURCES} ${SPHINXSYS_3D_SOURCES}) - target_link_libraries(sphinxsys_3d PUBLIC sphinxsys_core) endif() diff --git a/src/for_2D_build/common/data_type.h b/src/for_2D_build/common/data_type.h index 917f61f2da..f1a425efa4 100644 --- a/src/for_2D_build/common/data_type.h +++ b/src/for_2D_build/common/data_type.h @@ -30,6 +30,7 @@ #define DATA_TYPE_2D_H #include "base_data_type.h" +#include "geometric_primitive.h" #include "scalar_functions.h" namespace SPH @@ -37,7 +38,6 @@ namespace SPH using Arrayi = Array2i; using Vecd = Vec2d; using Matd = Mat2d; -using AlignedBox = AlignedBox2d; using AngularVecd = Real; using Rotation = Rotation2d; using BoundingBox = BaseBoundingBox; diff --git a/src/for_2D_build/io_system/io_vtk_fvm_2d.cpp b/src/for_2D_build/io_system/io_vtk_fvm_2d.cpp index 78e3bd2844..661e56eed5 100644 --- a/src/for_2D_build/io_system/io_vtk_fvm_2d.cpp +++ b/src/for_2D_build/io_system/io_vtk_fvm_2d.cpp @@ -1,5 +1,5 @@ +#include "io_vtk.hpp" #include "io_vtk_fvm.h" - namespace SPH { //=================================================================================================// @@ -66,7 +66,9 @@ void BodyStatesRecordingInMeshToVtp::writeWithFileName(const std::string &sequen // Write face attribute data out_file << "\n"; - body->writeParticlesToVtpFile(out_file); + + BaseParticles &particles = body->getBaseParticles(); + writeParticlesToVtk(out_file, particles); out_file << "\n"; diff --git a/src/for_2D_build/meshes/base_mesh_2d.cpp b/src/for_2D_build/meshes/base_mesh_2d.cpp index 3985460ab7..4210447b10 100644 --- a/src/for_2D_build/meshes/base_mesh_2d.cpp +++ b/src/for_2D_build/meshes/base_mesh_2d.cpp @@ -3,21 +3,11 @@ namespace SPH { //=============================================================================================// -Array2i BaseMesh::transfer1DtoMeshIndex(const Array2i &mesh_size, size_t i) +Arrayi Mesh::transfer1DtoMeshIndex(const Arrayi &mesh_size, size_t i) const { size_t row_size = mesh_size[1]; size_t column = i / row_size; - return Array2i(column, i - column * row_size); -} -//=============================================================================================// -size_t BaseMesh::transferMeshIndexTo1D(const Array2i &mesh_size, const Array2i &mesh_index) -{ - return mesh_index[0] * mesh_size[1] + mesh_index[1]; -} -//=============================================================================================// -size_t BaseMesh::transferMeshIndexToMortonOrder(const Array2i &mesh_index) -{ - return MortonCode(mesh_index[0]) | (MortonCode(mesh_index[1]) << 1); + return Arrayi(column, i - column * row_size); } } // namespace SPH //=============================================================================================// diff --git a/src/for_2D_build/particle_generator/particle_generator_lattice_2d.cpp b/src/for_2D_build/particle_generator/particle_generator_lattice_2d.cpp index 3f682a7f54..062296cf2e 100644 --- a/src/for_2D_build/particle_generator/particle_generator_lattice_2d.cpp +++ b/src/for_2D_build/particle_generator/particle_generator_lattice_2d.cpp @@ -11,9 +11,9 @@ namespace SPH //=================================================================================================// void ParticleGenerator::prepareGeometricData() { - BaseMesh mesh(domain_bounds_, lattice_spacing_, 0); + Mesh mesh(domain_bounds_, lattice_spacing_, 0); Real particle_volume = lattice_spacing_ * lattice_spacing_; - Arrayi number_of_lattices = mesh.AllCellsFromAllGridPoints(mesh.AllGridPoints()); + Arrayi number_of_lattices = mesh.AllCells(); for (int i = 0; i < number_of_lattices[0]; ++i) for (int j = 0; j < number_of_lattices[1]; ++j) { @@ -32,12 +32,12 @@ void ParticleGenerator::prepareGeometricData() { // Calculate the total volume and // count the number of cells inside the body volume, where we might put particles. - std::unique_ptr mesh(new BaseMesh(domain_bounds_, lattice_spacing_, 0)); - Arrayi number_of_lattices = mesh->AllCellsFromAllGridPoints(mesh->AllGridPoints()); + Mesh mesh(domain_bounds_, lattice_spacing_, 0); + Arrayi number_of_lattices = mesh.AllCells(); for (int i = 0; i < number_of_lattices[0]; ++i) for (int j = 0; j < number_of_lattices[1]; ++j) { - Vecd particle_position = mesh->CellPositionFromIndex(Arrayi(i, j)); + Vecd particle_position = mesh.CellPositionFromIndex(Arrayi(i, j)); if (initial_shape_.checkNotFar(particle_position, lattice_spacing_)) { if (initial_shape_.checkContain(particle_position)) @@ -63,7 +63,7 @@ void ParticleGenerator::prepareGeometricData() for (int i = 0; i < number_of_lattices[0]; ++i) for (int j = 0; j < number_of_lattices[1]; ++j) { - Vecd particle_position = mesh->CellPositionFromIndex(Arrayi(i, j)); + Vecd particle_position = mesh.CellPositionFromIndex(Arrayi(i, j)); if (initial_shape_.checkNotFar(particle_position, lattice_spacing_)) { if (initial_shape_.checkContain(particle_position)) diff --git a/src/for_3D_build/common/data_type.h b/src/for_3D_build/common/data_type.h index 680a06dbf7..288fc2d852 100644 --- a/src/for_3D_build/common/data_type.h +++ b/src/for_3D_build/common/data_type.h @@ -29,6 +29,7 @@ #define DATA_TYPE_3D_H #include "base_data_type.h" +#include "geometric_primitive.h" #include "scalar_functions.h" namespace SPH @@ -36,7 +37,6 @@ namespace SPH using Arrayi = Array3i; using Vecd = Vec3d; using Matd = Mat3d; -using AlignedBox = AlignedBox3d; using AngularVecd = Vec3d; using Rotation = Rotation3d; using BoundingBox = BaseBoundingBox; diff --git a/src/for_3D_build/io_system/io_vtk_fvm_3d.cpp b/src/for_3D_build/io_system/io_vtk_fvm_3d.cpp index 3900e331fb..998d17ec2c 100644 --- a/src/for_3D_build/io_system/io_vtk_fvm_3d.cpp +++ b/src/for_3D_build/io_system/io_vtk_fvm_3d.cpp @@ -1,6 +1,7 @@ +#include "io_vtk.hpp" #include "io_vtk_fvm.h" - #include "mesh_helper.h" + namespace SPH { //=================================================================================================// @@ -31,7 +32,10 @@ void BodyStatesRecordingInMeshToVtu::writeWithFileName(const std::string &sequen // write Particle data to vtu file out_file << "\n"; - body->writeParticlesToVtuFile(out_file); + + BaseParticles &particles = body->getBaseParticles(); + writeParticlesToVtk(out_file, particles); + out_file << "\n"; // Write VTU file footer out_file << "\n"; diff --git a/src/for_3D_build/meshes/base_mesh_3d.cpp b/src/for_3D_build/meshes/base_mesh_3d.cpp index d9902fcfe8..7ab5331313 100644 --- a/src/for_3D_build/meshes/base_mesh_3d.cpp +++ b/src/for_3D_build/meshes/base_mesh_3d.cpp @@ -3,25 +3,14 @@ namespace SPH { //=================================================================================================// -Array3i BaseMesh::transfer1DtoMeshIndex(const Array3i &mesh_size, size_t i) +Arrayi Mesh::transfer1DtoMeshIndex(const Arrayi &mesh_size, size_t i) const { size_t row_times_column_size = mesh_size[1] * mesh_size[2]; size_t page = i / row_times_column_size; size_t left_over = (i - page * row_times_column_size); size_t row_size = mesh_size[2]; size_t column = left_over / row_size; - return Array3i(page, column, left_over - column * row_size); + return Arrayi(page, column, left_over - column * row_size); } //=================================================================================================// -size_t BaseMesh::transferMeshIndexTo1D(const Array3i &mesh_size, const Array3i &mesh_index) -{ - return mesh_index[0] * mesh_size[1] * mesh_size[2] + - mesh_index[1] * mesh_size[2] + - mesh_index[2]; -} -//=================================================================================================// -size_t BaseMesh::transferMeshIndexToMortonOrder(const Array3i &mesh_index) -{ - return MortonCode(mesh_index[0]) | (MortonCode(mesh_index[1]) << 1) | (MortonCode(mesh_index[2]) << 2); -} } // namespace SPH diff --git a/src/for_3D_build/meshes/cell_linked_list_3d.cpp b/src/for_3D_build/meshes/cell_linked_list_3d.cpp index b07983f7e3..4f25879bad 100644 --- a/src/for_3D_build/meshes/cell_linked_list_3d.cpp +++ b/src/for_3D_build/meshes/cell_linked_list_3d.cpp @@ -9,7 +9,6 @@ namespace SPH { - //=================================================================================================// void CellLinkedList:: tagBoundingCells(StdVec &cell_data_lists, const BoundingBox &bounding_bounds, int axis) diff --git a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.cpp b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.cpp index c529db2d6e..f24e11bde5 100644 --- a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.cpp +++ b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.cpp @@ -7,24 +7,23 @@ namespace slender_structure_dynamics { //=================================================================================================// BarAcousticTimeStepSize::BarAcousticTimeStepSize(SPHBody &sph_body, Real CFL) - : LocalDynamicsReduce(sph_body), - DataDelegateSimple(sph_body), CFL_(CFL), + : LocalDynamicsReduce(sph_body), CFL_(CFL), elastic_solid_(DynamicCast(this, sph_body.getBaseMaterial())), - vel_(*particles_->getVariableDataByName("Velocity")), - force_(*particles_->getVariableDataByName("Force")), - angular_vel_(*particles_->getVariableDataByName("AngularVelocity")), - dangular_vel_dt_(*particles_->getVariableDataByName("AngularAcceleration")), - force_prior_(*particles_->getVariableDataByName("ForcePrior")), - thickness_(*particles_->getVariableDataByName("Thickness")), - mass_(*particles_->getVariableDataByName("Mass")), + vel_(particles_->getVariableDataByName("Velocity")), + force_(particles_->getVariableDataByName("Force")), + angular_vel_(particles_->getVariableDataByName("AngularVelocity")), + dangular_vel_dt_(particles_->getVariableDataByName("AngularAcceleration")), + force_prior_(particles_->getVariableDataByName("ForcePrior")), + thickness_(particles_->getVariableDataByName("Thickness")), + mass_(particles_->getVariableDataByName("Mass")), rho0_(elastic_solid_.ReferenceDensity()), E0_(elastic_solid_.YoungsModulus()), nu_(elastic_solid_.PoissonRatio()), c0_(elastic_solid_.ReferenceSoundSpeed()), smoothing_length_(sph_body.sph_adaptation_->ReferenceSmoothingLength()), - angular_b_vel_(*particles_->getVariableDataByName("BinormalAngularVelocity")), - dangular_b_vel_dt_(*particles_->getVariableDataByName("BinormalAngularAcceleration")), - width_(*particles_->getVariableDataByName("Width")) {} + angular_b_vel_(particles_->getVariableDataByName("BinormalAngularVelocity")), + dangular_b_vel_dt_(particles_->getVariableDataByName("BinormalAngularAcceleration")), + width_(particles_->getVariableDataByName("Width")) {} //=================================================================================================// Real BarAcousticTimeStepSize::reduce(size_t index_i, Real dt) { @@ -44,56 +43,56 @@ Real BarAcousticTimeStepSize::reduce(size_t index_i, Real dt) BarCorrectConfiguration:: BarCorrectConfiguration(BaseInnerRelation &inner_relation) : LocalDynamics(inner_relation.getSPHBody()), DataDelegateInner(inner_relation), - Vol_(*particles_->getVariableDataByName("VolumetricMeasure")), - B_(*particles_->registerSharedVariable("LinearGradientCorrectionMatrix", IdentityMatrix::value)), - n0_(*particles_->registerSharedVariableFrom("InitialNormalDirection", "NormalDirection")), - transformation_matrix0_(*particles_->getVariableDataByName("TransformationMatrix")) {} + Vol_(particles_->getVariableDataByName("VolumetricMeasure")), + B_(particles_->registerStateVariable("LinearGradientCorrectionMatrix", IdentityMatrix::value)), + n0_(particles_->registerStateVariableFrom("InitialNormalDirection", "NormalDirection")), + transformation_matrix0_(particles_->getVariableDataByName("TransformationMatrix")) {} //=================================================================================================// BarDeformationGradientTensor:: BarDeformationGradientTensor(BaseInnerRelation &inner_relation) : LocalDynamics(inner_relation.getSPHBody()), DataDelegateInner(inner_relation), - Vol_(*particles_->getVariableDataByName("VolumetricMeasure")), - pos_(*particles_->getVariableDataByName("Position")), - pseudo_n_(*particles_->registerSharedVariableFrom("PseudoNormal", "NormalDirection")), - n0_(*particles_->registerSharedVariableFrom("InitialNormalDirection", "NormalDirection")), - B_(*particles_->getVariableDataByName("LinearGradientCorrectionMatrix")), - F_(*particles_->registerSharedVariable("DeformationGradient", IdentityMatrix::value)), - F_bending_(*particles_->registerSharedVariable("BendingDeformationGradient")), - transformation_matrix0_(*particles_->getVariableDataByName("TransformationMatrix")), - pseudo_b_n_(*particles_->registerSharedVariableFrom("PseudoBinormal", "BinormalDirection")), - b_n0_(*particles_->registerSharedVariableFrom("InitialBinormalDirection", "BinormalDirection")), - F_b_bending_(*particles_->registerSharedVariable("BinormalBending")) {} + Vol_(particles_->getVariableDataByName("VolumetricMeasure")), + pos_(particles_->getVariableDataByName("Position")), + pseudo_n_(particles_->registerStateVariableFrom("PseudoNormal", "NormalDirection")), + n0_(particles_->registerStateVariableFrom("InitialNormalDirection", "NormalDirection")), + B_(particles_->getVariableDataByName("LinearGradientCorrectionMatrix")), + F_(particles_->registerStateVariable("DeformationGradient", IdentityMatrix::value)), + F_bending_(particles_->registerStateVariable("BendingDeformationGradient")), + transformation_matrix0_(particles_->getVariableDataByName("TransformationMatrix")), + pseudo_b_n_(particles_->registerStateVariableFrom("PseudoBinormal", "BinormalDirection")), + b_n0_(particles_->registerStateVariableFrom("InitialBinormalDirection", "BinormalDirection")), + F_b_bending_(particles_->registerStateVariable("BinormalBending")) {} //=================================================================================================// BaseBarRelaxation::BaseBarRelaxation(BaseInnerRelation &inner_relation) : LocalDynamics(inner_relation.getSPHBody()), DataDelegateInner(inner_relation), - Vol_(*particles_->getVariableDataByName("VolumetricMeasure")), - thickness_(*particles_->getVariableDataByName("Thickness")), - width_(*particles_->getVariableDataByName("Width")), - pos_(*particles_->getVariableDataByName("Position")), - vel_(*particles_->registerSharedVariable("Velocity")), - force_(*particles_->registerSharedVariable("Force")), - force_prior_(*particles_->registerSharedVariable("ForcePrior")), - n0_(*particles_->registerSharedVariableFrom("InitialNormalDirection", "NormalDirection")), - pseudo_n_(*particles_->registerSharedVariableFrom("PseudoNormal", "NormalDirection")), - dpseudo_n_dt_(*particles_->registerSharedVariable("PseudoNormalChangeRate")), - dpseudo_n_d2t_(*particles_->registerSharedVariable("PseudoNormal2ndOrderTimeDerivative")), - rotation_(*particles_->registerSharedVariable("Rotation")), - angular_vel_(*particles_->registerSharedVariable("AngularVelocity")), - dangular_vel_dt_(*particles_->registerSharedVariable("AngularAcceleration")), - B_(*particles_->getVariableDataByName("LinearGradientCorrectionMatrix")), - F_(*particles_->registerSharedVariable("DeformationGradient", IdentityMatrix::value)), - dF_dt_(*particles_->registerSharedVariable("DeformationRate")), - F_bending_(*particles_->registerSharedVariable("BendingDeformationGradient")), - dF_bending_dt_(*particles_->registerSharedVariable("BendingDeformationRate")), - pseudo_b_n_(*particles_->registerSharedVariableFrom("PseudoBinormal", "BinormalDirection")), - dpseudo_b_n_dt_(*particles_->registerSharedVariable("PseudoBinormalChangeRate")), - dpseudo_b_n_d2t_(*particles_->registerSharedVariable("PseudoBinormal2ndOrderTimeDerivative")), - rotation_b_(*particles_->registerSharedVariable("BinormalRotation")), - angular_b_vel_(*particles_->registerSharedVariable("BinormalAngularVelocity")), - dangular_b_vel_dt_(*particles_->registerSharedVariable("BinormalAngularAcceleration")), - transformation_matrix0_(*particles_->getVariableDataByName("TransformationMatrix")), - F_b_bending_(*particles_->registerSharedVariable("BinormalBending")), - dF_b_bending_dt_(*particles_->registerSharedVariable("BinormalBendingRate")) {} + Vol_(particles_->getVariableDataByName("VolumetricMeasure")), + thickness_(particles_->getVariableDataByName("Thickness")), + width_(particles_->getVariableDataByName("Width")), + pos_(particles_->getVariableDataByName("Position")), + vel_(particles_->registerStateVariable("Velocity")), + force_(particles_->registerStateVariable("Force")), + force_prior_(particles_->registerStateVariable("ForcePrior")), + n0_(particles_->registerStateVariableFrom("InitialNormalDirection", "NormalDirection")), + pseudo_n_(particles_->registerStateVariableFrom("PseudoNormal", "NormalDirection")), + dpseudo_n_dt_(particles_->registerStateVariable("PseudoNormalChangeRate")), + dpseudo_n_d2t_(particles_->registerStateVariable("PseudoNormal2ndOrderTimeDerivative")), + rotation_(particles_->registerStateVariable("Rotation")), + angular_vel_(particles_->registerStateVariable("AngularVelocity")), + dangular_vel_dt_(particles_->registerStateVariable("AngularAcceleration")), + B_(particles_->getVariableDataByName("LinearGradientCorrectionMatrix")), + F_(particles_->registerStateVariable("DeformationGradient", IdentityMatrix::value)), + dF_dt_(particles_->registerStateVariable("DeformationRate")), + F_bending_(particles_->registerStateVariable("BendingDeformationGradient")), + dF_bending_dt_(particles_->registerStateVariable("BendingDeformationRate")), + pseudo_b_n_(particles_->registerStateVariableFrom("PseudoBinormal", "BinormalDirection")), + dpseudo_b_n_dt_(particles_->registerStateVariable("PseudoBinormalChangeRate")), + dpseudo_b_n_d2t_(particles_->registerStateVariable("PseudoBinormal2ndOrderTimeDerivative")), + rotation_b_(particles_->registerStateVariable("BinormalRotation")), + angular_b_vel_(particles_->registerStateVariable("BinormalAngularVelocity")), + dangular_b_vel_dt_(particles_->registerStateVariable("BinormalAngularAcceleration")), + transformation_matrix0_(particles_->getVariableDataByName("TransformationMatrix")), + F_b_bending_(particles_->registerStateVariable("BinormalBending")), + dF_b_bending_dt_(particles_->registerStateVariable("BinormalBendingRate")) {} //=================================================================================================// BarStressRelaxationFirstHalf:: BarStressRelaxationFirstHalf(BaseInnerRelation &inner_relation, @@ -103,22 +102,22 @@ BarStressRelaxationFirstHalf:: rho0_(elastic_solid_.ReferenceDensity()), inv_rho0_(1.0 / rho0_), smoothing_length_(sph_body_.sph_adaptation_->ReferenceSmoothingLength()), numerical_damping_scaling_matrix_(Matd::Identity() * smoothing_length_), - rho_(*particles_->getVariableDataByName("Density")), - mass_(*particles_->getVariableDataByName("Mass")), - global_stress_(*particles_->registerSharedVariable("GlobalStress")), - global_moment_(*particles_->registerSharedVariable("GlobalMoment")), - mid_surface_cauchy_stress_(*particles_->registerSharedVariable("MidSurfaceCauchyStress")), - global_shear_stress_(*particles_->registerSharedVariable("GlobalShearStress")), - n_(*particles_->getVariableDataByName("NormalDirection")), + rho_(particles_->getVariableDataByName("Density")), + mass_(particles_->getVariableDataByName("Mass")), + global_stress_(particles_->registerStateVariable("GlobalStress")), + global_moment_(particles_->registerStateVariable("GlobalMoment")), + mid_surface_cauchy_stress_(particles_->registerStateVariable("MidSurfaceCauchyStress")), + global_shear_stress_(particles_->registerStateVariable("GlobalShearStress")), + n_(particles_->getVariableDataByName("NormalDirection")), E0_(elastic_solid_.YoungsModulus()), G0_(elastic_solid_.ShearModulus()), nu_(elastic_solid_.PoissonRatio()), hourglass_control_(hourglass_control), number_of_gaussian_points_(number_of_gaussian_points), - global_b_stress_(*particles_->registerSharedVariable("GlobalBinormalStress")), - global_b_moment_(*particles_->registerSharedVariable("GlobalBinormalMoment")), - global_b_shear_stress_(*particles_->registerSharedVariable("GlobalBinormalShearStress")), - b_n_(*particles_->getVariableDataByName("BinormalDirection")) + global_b_stress_(particles_->registerStateVariable("GlobalBinormalStress")), + global_b_moment_(particles_->registerStateVariable("GlobalBinormalMoment")), + global_b_shear_stress_(particles_->registerStateVariable("GlobalBinormalShearStress")), + b_n_(particles_->getVariableDataByName("BinormalDirection")) { /** Note that, only three-point and five-point Gaussian quadrature rules are defined. */ switch (number_of_gaussian_points) @@ -290,10 +289,10 @@ void BarStressRelaxationSecondHalf::update(size_t index_i, Real dt) //=================================================================================================// ConstrainBarBodyRegion:: ConstrainBarBodyRegion(BodyPartByParticle &body_part) - : BaseLocalDynamics(body_part), DataDelegateSimple(body_part.getSPHBody()), - vel_(*particles_->getVariableDataByName("Velocity")), - angular_vel_(*particles_->getVariableDataByName("AngularVelocity")), - angular_b_vel_(*particles_->getVariableDataByName("BinormalAngularVelocity")) {} + : BaseLocalDynamics(body_part), + vel_(particles_->getVariableDataByName("Velocity")), + angular_vel_(particles_->getVariableDataByName("AngularVelocity")), + angular_b_vel_(particles_->getVariableDataByName("BinormalAngularVelocity")) {} //=================================================================================================// void ConstrainBarBodyRegion::update(size_t index_i, Real dt) { @@ -303,17 +302,17 @@ void ConstrainBarBodyRegion::update(size_t index_i, Real dt) } //=================================================================================================// ConstrainBarBodyRegionAlongAxis::ConstrainBarBodyRegionAlongAxis(BodyPartByParticle &body_part, int axis) - : BaseLocalDynamics(body_part), DataDelegateSimple(body_part.getSPHBody()), - axis_(axis), pos_(*particles_->getVariableDataByName("Position")), - pos0_(*particles_->registerSharedVariableFrom("InitialPosition", "Position")), - vel_(*particles_->getVariableDataByName("Velocity")), - force_(*particles_->getVariableDataByName("Force")), - rotation_(*particles_->getVariableDataByName("Rotation")), - angular_vel_(*particles_->getVariableDataByName("AngularVelocity")), - dangular_vel_dt_(*particles_->getVariableDataByName("AngularAcceleration")), - rotation_b_(*particles_->getVariableDataByName("BinormalRotation")), - angular_b_vel_(*particles_->getVariableDataByName("BinormalAngularVelocity")), - dangular_b_vel_dt_(*particles_->getVariableDataByName("BinormalAngularAcceleration")) {} + : BaseLocalDynamics(body_part), + axis_(axis), pos_(particles_->getVariableDataByName("Position")), + pos0_(particles_->registerStateVariableFrom("InitialPosition", "Position")), + vel_(particles_->getVariableDataByName("Velocity")), + force_(particles_->getVariableDataByName("Force")), + rotation_(particles_->getVariableDataByName("Rotation")), + angular_vel_(particles_->getVariableDataByName("AngularVelocity")), + dangular_vel_dt_(particles_->getVariableDataByName("AngularAcceleration")), + rotation_b_(particles_->getVariableDataByName("BinormalRotation")), + angular_b_vel_(particles_->getVariableDataByName("BinormalAngularVelocity")), + dangular_b_vel_dt_(particles_->getVariableDataByName("BinormalAngularAcceleration")) {} //=================================================================================================// void ConstrainBarBodyRegionAlongAxis::update(size_t index_i, Real dt) { diff --git a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.h b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.h index c41fe8c9f8..75cd7f9ef4 100644 --- a/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.h +++ b/src/for_3D_build/particle_dynamics/solid_dynamics/slender_structure_dynamics.h @@ -45,19 +45,18 @@ namespace slender_structure_dynamics * @class BarAcousticTimeStepSize * @brief Computing the acoustic time step size for bar */ -class BarAcousticTimeStepSize : public LocalDynamicsReduce, - public DataDelegateSimple +class BarAcousticTimeStepSize : public LocalDynamicsReduce { protected: Real CFL_; ElasticSolid &elastic_solid_; - StdLargeVec &vel_, &force_, &angular_vel_, &dangular_vel_dt_, &force_prior_; - StdLargeVec &thickness_, &mass_; + Vecd *vel_, *force_, *angular_vel_, *dangular_vel_dt_, *force_prior_; + Real *thickness_, *mass_; Real rho0_, E0_, nu_, c0_; Real smoothing_length_; - StdLargeVec &angular_b_vel_, &dangular_b_vel_dt_; - StdLargeVec &width_; + Vecd *angular_b_vel_, *dangular_b_vel_dt_; + Real *width_; public: explicit BarAcousticTimeStepSize(SPHBody &sph_body, Real CFL = 0.6); @@ -95,10 +94,10 @@ class BarCorrectConfiguration : public LocalDynamics, public DataDelegateInner }; protected: - StdLargeVec &Vol_; - StdLargeVec &B_; - StdLargeVec &n0_; - StdLargeVec &transformation_matrix0_; + Real *Vol_; + Matd *B_; + Vecd *n0_; + Matd *transformation_matrix0_; }; /** @@ -139,13 +138,12 @@ class BarDeformationGradientTensor : public LocalDynamics, public DataDelegateIn }; protected: - StdLargeVec &Vol_; - StdLargeVec &pos_, &pseudo_n_, &n0_; - StdLargeVec &B_, &F_, &F_bending_; - StdLargeVec &transformation_matrix0_; - - StdLargeVec &pseudo_b_n_, &b_n0_; - StdLargeVec &F_b_bending_; + Real *Vol_; + Vecd *pos_, *pseudo_n_, *n0_; + Matd *B_, *F_, *F_bending_; + Matd *transformation_matrix0_; + Vecd *pseudo_b_n_, *b_n0_; + Matd *F_b_bending_; }; /** @@ -159,16 +157,16 @@ class BaseBarRelaxation : public LocalDynamics, public DataDelegateInner virtual ~BaseBarRelaxation(){}; protected: - StdLargeVec &Vol_, &thickness_, &width_; - StdLargeVec &pos_, &vel_, &force_, &force_prior_; - StdLargeVec &n0_, &pseudo_n_, &dpseudo_n_dt_, &dpseudo_n_d2t_, &rotation_, - &angular_vel_, &dangular_vel_dt_; - StdLargeVec &B_, &F_, &dF_dt_, &F_bending_, &dF_bending_dt_; - - StdLargeVec &pseudo_b_n_, &dpseudo_b_n_dt_, &dpseudo_b_n_d2t_, &rotation_b_, - &angular_b_vel_, dangular_b_vel_dt_; - StdLargeVec &transformation_matrix0_; - StdLargeVec &F_b_bending_, &dF_b_bending_dt_; + Real *Vol_, *thickness_, *width_; + Vecd *pos_, *vel_, *force_, *force_prior_; + Vecd *n0_, *pseudo_n_, *dpseudo_n_dt_, *dpseudo_n_d2t_, *rotation_, + *angular_vel_, *dangular_vel_dt_; + Matd *B_, *F_, *dF_dt_, *F_bending_, *dF_bending_dt_; + + Vecd *pseudo_b_n_, *dpseudo_b_n_dt_, *dpseudo_b_n_d2t_, *rotation_b_, + *angular_b_vel_, *dangular_b_vel_dt_; + Matd *transformation_matrix0_; + Matd *F_b_bending_, *dF_b_bending_dt_; }; /** @@ -228,9 +226,9 @@ class BarStressRelaxationFirstHalf : public BaseBarRelaxation Real rho0_, inv_rho0_; Real smoothing_length_; Matd numerical_damping_scaling_matrix_; - StdLargeVec &rho_, &mass_; - StdLargeVec &global_stress_, &global_moment_, &mid_surface_cauchy_stress_; - StdLargeVec &global_shear_stress_, &n_; + Real *rho_, *mass_; + Matd *global_stress_, *global_moment_, *mid_surface_cauchy_stress_; + Vecd *global_shear_stress_, *n_; Real E0_, G0_, nu_, hourglass_control_factor_; bool hourglass_control_; @@ -252,9 +250,9 @@ class BarStressRelaxationFirstHalf : public BaseBarRelaxation int number_of_gaussian_points_; - StdLargeVec &global_b_stress_, &global_b_moment_; - StdLargeVec &global_b_shear_stress_; - StdLargeVec &b_n_; + Matd *global_b_stress_, *global_b_moment_; + Vecd *global_b_shear_stress_; + Vecd *b_n_; StdVec gaussian_point_x; StdVec gaussian_point_y; StdVec gaussian_weight_; @@ -309,7 +307,7 @@ class BarStressRelaxationSecondHalf : public BaseBarRelaxation /**@class ConstrainBarBodyRegion * @brief Fix the position and angle of a bar body part. */ -class ConstrainBarBodyRegion : public BaseLocalDynamics, public DataDelegateSimple +class ConstrainBarBodyRegion : public BaseLocalDynamics { public: ConstrainBarBodyRegion(BodyPartByParticle &body_part); @@ -317,7 +315,7 @@ class ConstrainBarBodyRegion : public BaseLocalDynamics, pub void update(size_t index_i, Real dt = 0.0); protected: - StdLargeVec &vel_, &angular_vel_, &angular_b_vel_; + Vecd *vel_, *angular_vel_, *angular_b_vel_; }; /**@class ConstrainBarBodyRegionAlongAxis @@ -325,7 +323,7 @@ class ConstrainBarBodyRegion : public BaseLocalDynamics, pub * The axis must be 0 or 1. * Note that the average values for FSI are prescribed also. */ -class ConstrainBarBodyRegionAlongAxis : public BaseLocalDynamics, public DataDelegateSimple +class ConstrainBarBodyRegionAlongAxis : public BaseLocalDynamics { public: ConstrainBarBodyRegionAlongAxis(BodyPartByParticle &body_part, int axis); @@ -334,10 +332,10 @@ class ConstrainBarBodyRegionAlongAxis : public BaseLocalDynamics &pos_, &pos0_; - StdLargeVec &vel_, &force_; - StdLargeVec &rotation_, &angular_vel_, &dangular_vel_dt_; - StdLargeVec &rotation_b_, &angular_b_vel_, &dangular_b_vel_dt_; + Vecd *pos_, *pos0_; + Vecd *vel_, *force_; + Vecd *rotation_, *angular_vel_, *dangular_vel_dt_; + Vecd *rotation_b_, *angular_b_vel_, *dangular_b_vel_dt_; }; } // namespace slender_structure_dynamics } // namespace SPH diff --git a/src/for_3D_build/particle_generator/particle_generator_lattice_3d.cpp b/src/for_3D_build/particle_generator/particle_generator_lattice_3d.cpp index f7ede7482c..61e8e4ee92 100644 --- a/src/for_3D_build/particle_generator/particle_generator_lattice_3d.cpp +++ b/src/for_3D_build/particle_generator/particle_generator_lattice_3d.cpp @@ -11,9 +11,9 @@ namespace SPH //=================================================================================================// void ParticleGenerator::prepareGeometricData() { - BaseMesh mesh(domain_bounds_, lattice_spacing_, 0); + Mesh mesh(domain_bounds_, lattice_spacing_, 0); Real particle_volume = lattice_spacing_ * lattice_spacing_ * lattice_spacing_; - Arrayi number_of_lattices = mesh.AllCellsFromAllGridPoints(mesh.AllGridPoints()); + Arrayi number_of_lattices = mesh.AllCells(); for (int i = 0; i < number_of_lattices[0]; ++i) for (int j = 0; j < number_of_lattices[1]; ++j) for (int k = 0; k < number_of_lattices[2]; ++k) @@ -33,13 +33,13 @@ void ParticleGenerator::prepareGeometricData() { // Calculate the total volume and // count the number of cells inside the body volume, where we might put particles. - std::unique_ptr mesh(new BaseMesh(domain_bounds_, lattice_spacing_, 0)); - Arrayi number_of_lattices = mesh->AllCellsFromAllGridPoints(mesh->AllGridPoints()); + Mesh mesh(domain_bounds_, lattice_spacing_, 0); + Arrayi number_of_lattices = mesh.AllCells(); for (int i = 0; i < number_of_lattices[0]; ++i) for (int j = 0; j < number_of_lattices[1]; ++j) for (int k = 0; k < number_of_lattices[2]; ++k) { - Vecd particle_position = mesh->CellPositionFromIndex(Arrayi(i, j, k)); + Vecd particle_position = mesh.CellPositionFromIndex(Arrayi(i, j, k)); if (initial_shape_.checkNotFar(particle_position, lattice_spacing_)) { if (initial_shape_.checkContain(particle_position)) @@ -66,7 +66,7 @@ void ParticleGenerator::prepareGeometricData() for (int j = 0; j < number_of_lattices[1]; ++j) for (int k = 0; k < number_of_lattices[2]; ++k) { - Vecd particle_position = mesh->CellPositionFromIndex(Arrayi(i, j, k)); + Vecd particle_position = mesh.CellPositionFromIndex(Arrayi(i, j, k)); if (initial_shape_.checkNotFar(particle_position, lattice_spacing_)) { if (initial_shape_.checkContain(particle_position)) diff --git a/src/for_3D_build/particle_generator/particle_generator_network.h b/src/for_3D_build/particle_generator/particle_generator_network.h index ac566a708b..ddf724549c 100644 --- a/src/for_3D_build/particle_generator/particle_generator_network.h +++ b/src/for_3D_build/particle_generator/particle_generator_network.h @@ -31,7 +31,7 @@ #define PARTICLE_GENERATOR_NETWORK_H #include "base_particle_generator.h" -#include "sph_data_containers.h" +#include "sphinxsys_containers.h" #include "tree_body.h" namespace SPH diff --git a/src/for_3D_build/particles/linear_particles.cpp b/src/for_3D_build/particles/linear_particles.cpp index dc1bef4b91..71ae69149c 100644 --- a/src/for_3D_build/particles/linear_particles.cpp +++ b/src/for_3D_build/particles/linear_particles.cpp @@ -8,8 +8,8 @@ LinearParticles::LinearParticles(SPHBody &sph_body, BaseMaterial *base_material) //=================================================================================================// void LinearParticles::registerLineProperties(StdLargeVec &b_n, StdLargeVec &width) { - b_n_ = registerSharedVariableFrom("BinormalDirection", b_n); - width_ = registerSharedVariableFrom("Width", width); + b_n_ = registerStateVariableFrom("BinormalDirection", b_n); + width_ = registerStateVariableFrom("Width", width); addVariableToReload("BinormalDirection"); addVariableToReload("Width"); addVariableToWrite("BinormalDirection"); @@ -17,15 +17,15 @@ void LinearParticles::registerLineProperties(StdLargeVec &b_n, StdLargeVec //=================================================================================================// void LinearParticles::registerLinePropertiesFromReload() { - b_n_ = registerSharedVariableFromReload("NormalDirection"); - width_ = registerSharedVariableFromReload("Thickness"); + b_n_ = registerStateVariableFromReload("NormalDirection"); + width_ = registerStateVariableFromReload("Thickness"); } //=================================================================================================// void LinearParticles::registerTransformationMatrix() { - transformation_matrix0_ = registerSharedVariable( + transformation_matrix0_ = registerStateVariable( "TransformationMatrix", [&](size_t index_i) -> Matd - { return getTransformationMatrix((*n_)[index_i], (*b_n_)[index_i]); }); + { return getTransformationMatrix(n_[index_i], b_n_[index_i]); }); } //=================================================================================================// } // namespace SPH diff --git a/src/for_3D_build/particles/linear_particles.h b/src/for_3D_build/particles/linear_particles.h index 2bc1d07c81..153129b6f6 100644 --- a/src/for_3D_build/particles/linear_particles.h +++ b/src/for_3D_build/particles/linear_particles.h @@ -40,11 +40,11 @@ class LinearParticles : public SurfaceParticles LinearParticles(SPHBody &sph_body, BaseMaterial *base_material); virtual ~LinearParticles(){}; - StdLargeVec *b_n_; /**< binormal direction */ - StdLargeVec *width_; + Vecd *b_n_; /**< binormal direction */ + Real *width_; /** get particle volume. */ - virtual Real ParticleVolume(size_t index_i) override { return (*Vol_)[index_i] * (*thickness_)[index_i] * (*width_)[index_i]; } + virtual Real ParticleVolume(size_t index_i) override { return Vol_[index_i] * thickness_[index_i] * width_[index_i]; } void registerLineProperties(StdLargeVec &b_n, StdLargeVec &width); void registerLinePropertiesFromReload(); virtual void registerTransformationMatrix() override; diff --git a/src/shared/adaptations/adaptation.cpp b/src/shared/adaptations/adaptation.cpp index 0b6bdaf7b2..eff6578da6 100644 --- a/src/shared/adaptations/adaptation.cpp +++ b/src/shared/adaptations/adaptation.cpp @@ -16,7 +16,7 @@ SPHAdaptation::SPHAdaptation(Real resolution_ref, Real h_spacing_ratio, Real sys h_ref_(h_spacing_ratio_ * spacing_ref_), kernel_ptr_(makeUnique(h_ref_)), sigma0_ref_(computeLatticeNumberDensity(Vecd())), spacing_min_(this->MostRefinedSpacingRegular(spacing_ref_, local_refinement_level_)), - Vol_min_(pow(spacing_min_, Dimensions)), h_ratio_max_(spacing_ref_ / spacing_min_){}; + Vol_min_(pow(spacing_min_, Dimensions)), h_ratio_max_(spacing_ref_ / spacing_min_) {}; //=================================================================================================// Real SPHAdaptation::MostRefinedSpacing(Real coarse_particle_spacing, int local_refinement_level) { @@ -81,9 +81,10 @@ void SPHAdaptation::resetAdaptationRatios(Real h_spacing_ratio, Real new_system_ h_ratio_max_ = spacing_ref_ / spacing_min_; } //=================================================================================================// -UniquePtr SPHAdaptation::createCellLinkedList(const BoundingBox &domain_bounds) +UniquePtr SPHAdaptation:: + createCellLinkedList(const BoundingBox &domain_bounds, BaseParticles &base_particles) { - return makeUnique(domain_bounds, kernel_ptr_->CutOffRadius(), *this); + return makeUnique(domain_bounds, kernel_ptr_->CutOffRadius(), base_particles, *this); } //=================================================================================================// UniquePtr SPHAdaptation::createLevelSet(Shape &shape, Real refinement_ratio) @@ -114,7 +115,7 @@ ParticleWithLocalRefinement:: void ParticleWithLocalRefinement::initializeAdaptationVariables(BaseParticles &base_particles) { SPHAdaptation::initializeAdaptationVariables(base_particles); - h_ratio_ = base_particles.registerSharedVariable( + h_ratio_ = base_particles.registerStateVariable( "SmoothingLengthRatio", [&](size_t i) -> Real { return ReferenceSpacing() / base_particles.ParticleSpacing(i); }); base_particles.addVariableToSort("SmoothingLengthRatio"); @@ -131,10 +132,11 @@ size_t ParticleWithLocalRefinement::getLevelSetTotalLevel() return getCellLinkedListTotalLevel() + 1; } //=================================================================================================// -UniquePtr ParticleWithLocalRefinement::createCellLinkedList(const BoundingBox &domain_bounds) +UniquePtr ParticleWithLocalRefinement:: + createCellLinkedList(const BoundingBox &domain_bounds, BaseParticles &base_particles) { return makeUnique(domain_bounds, kernel_ptr_->CutOffRadius(), - getCellLinkedListTotalLevel(), *this); + getCellLinkedListTotalLevel(), base_particles, *this); } //=================================================================================================// UniquePtr ParticleWithLocalRefinement::createLevelSet(Shape &shape, Real refinement_ratio) diff --git a/src/shared/adaptations/adaptation.h b/src/shared/adaptations/adaptation.h index ab46e5db1e..2f96e98d8c 100644 --- a/src/shared/adaptations/adaptation.h +++ b/src/shared/adaptations/adaptation.h @@ -31,7 +31,8 @@ #include "base_data_package.h" #include "base_kernel.h" -#include "sph_data_containers.h" +#include "base_mesh.h" +#include "sphinxsys_containers.h" namespace SPH { @@ -65,7 +66,7 @@ class SPHAdaptation public: explicit SPHAdaptation(Real resolution_ref, Real h_spacing_ratio = 1.3, Real system_refinement_ratio = 1.0); - virtual ~SPHAdaptation(){}; + virtual ~SPHAdaptation() {}; int LocalRefinementLevel() { return local_refinement_level_; }; Real ReferenceSpacing() { return spacing_ref_; }; @@ -79,9 +80,12 @@ class SPHAdaptation void resetAdaptationRatios(Real h_spacing_ratio, Real new_system_refinement_ratio = 1.0); virtual void initializeAdaptationVariables(BaseParticles &base_particles) {}; - virtual UniquePtr createCellLinkedList(const BoundingBox &domain_bounds); + virtual UniquePtr createCellLinkedList(const BoundingBox &domain_bounds, BaseParticles &base_particles); virtual UniquePtr createLevelSet(Shape &shape, Real refinement_ratio); + template + MeshType createBackGroundMesh(SPHBody &sph_body, Args &&...args); + template void resetKernel(Args &&...args) { @@ -104,20 +108,20 @@ class SPHAdaptation class ParticleWithLocalRefinement : public SPHAdaptation { public: - StdLargeVec *h_ratio_; /**< the ratio between reference smoothing length to variable smoothing length */ + Real *h_ratio_; /**< the ratio between reference smoothing length to variable smoothing length */ ParticleWithLocalRefinement(Real resolution_ref, Real h_spacing_ratio_, Real system_refinement_ratio, int local_refinement_level); - virtual ~ParticleWithLocalRefinement(){}; + virtual ~ParticleWithLocalRefinement() {}; virtual size_t getCellLinkedListTotalLevel(); size_t getLevelSetTotalLevel(); virtual Real SmoothingLengthRatio(size_t particle_index_i) override { - return (*h_ratio_)[particle_index_i]; + return h_ratio_[particle_index_i]; }; virtual void initializeAdaptationVariables(BaseParticles &base_particles) override; - virtual UniquePtr createCellLinkedList(const BoundingBox &domain_bounds) override; + virtual UniquePtr createCellLinkedList(const BoundingBox &domain_bounds, BaseParticles &base_particles) override; virtual UniquePtr createLevelSet(Shape &shape, Real refinement_ratio) override; protected: @@ -136,7 +140,7 @@ class ParticleRefinementByShape : public ParticleWithLocalRefinement ParticleRefinementByShape(Args &&...args) : ParticleWithLocalRefinement(std::forward(args)...){}; - virtual ~ParticleRefinementByShape(){}; + virtual ~ParticleRefinementByShape() {}; virtual Real getLocalSpacing(Shape &shape, const Vecd &position) = 0; protected: @@ -153,7 +157,7 @@ class ParticleRefinementNearSurface : public ParticleRefinementByShape template ParticleRefinementNearSurface(Args &&...args) : ParticleRefinementByShape(std::forward(args)...){}; - virtual ~ParticleRefinementNearSurface(){}; + virtual ~ParticleRefinementNearSurface() {}; virtual Real getLocalSpacing(Shape &shape, const Vecd &position) override; }; @@ -168,7 +172,7 @@ class ParticleRefinementWithinShape : public ParticleRefinementByShape template ParticleRefinementWithinShape(Args &&...args) : ParticleRefinementByShape(std::forward(args)...){}; - virtual ~ParticleRefinementWithinShape(){}; + virtual ~ParticleRefinementWithinShape() {}; virtual Real getLocalSpacing(Shape &shape, const Vecd &position) override; }; diff --git a/src/shared/adaptations/adaptation.hpp b/src/shared/adaptations/adaptation.hpp new file mode 100644 index 0000000000..431cd59ad5 --- /dev/null +++ b/src/shared/adaptations/adaptation.hpp @@ -0,0 +1,18 @@ +#ifndef ADAPTATION_HPP +#define ADAPTATION_HPP + +#include "adaptation.h" +#include "base_body.h" + +namespace SPH +{ +//=================================================================================================// +template +MeshType SPHAdaptation::createBackGroundMesh(SPHBody &sph_body, Args &&...args) +{ + return MeshType(sph_body.getSPHSystemBounds(), kernel_ptr_->CutOffRadius(), 2, + std::forward(args)...); +} +//=================================================================================================// +} // namespace SPH +#endif // ADAPTATION_HPP \ No newline at end of file diff --git a/src/shared/bodies/base_body.cpp b/src/shared/bodies/base_body.cpp index 0084bf6045..71edccef28 100644 --- a/src/shared/bodies/base_body.cpp +++ b/src/shared/bodies/base_body.cpp @@ -9,7 +9,7 @@ namespace SPH //=================================================================================================// SPHBody::SPHBody(SPHSystem &sph_system, Shape &shape, const std::string &name) : sph_system_(sph_system), body_name_(name), newly_updated_(true), - base_particles_(nullptr), is_bound_set_(false), initial_shape_(&shape), + base_particles_(nullptr), is_bound_set_(false), initial_shape_(&shape), total_body_parts_(0), sph_adaptation_(sph_adaptation_ptr_keeper_.createPtr(sph_system.ReferenceResolution())), base_material_(base_material_ptr_keeper_.createPtr()) { @@ -36,6 +36,12 @@ BoundingBox SPHBody::getSPHSystemBounds() return sph_system_.system_domain_bounds_; } //=================================================================================================// +int SPHBody::getNewBodyPartID() +{ + total_body_parts_++; + return total_body_parts_; +}; +//=================================================================================================// SPHSystem &SPHBody::getSPHSystem() { return sph_system_; @@ -74,24 +80,14 @@ BoundingBox SPHBody::getSPHBodyBounds() return is_bound_set_ ? bound_ : initial_shape_->getBounds(); } //=================================================================================================// -void SPHBody::defineAdaptationRatios(Real h_spacing_ratio, Real new_system_refinement_ratio) -{ - sph_adaptation_->resetAdaptationRatios(h_spacing_ratio, new_system_refinement_ratio); -} -//=================================================================================================// -void SPHBody::writeParticlesToVtuFile(std::ostream &output_file) +void SPHBody::registerComputingKernel(execution::Implementation *implementation) { - base_particles_->writeParticlesToVtk(output_file); + all_simple_reduce_computing_kernels_.push_back(implementation); } //=================================================================================================// -void SPHBody::writeParticlesToVtpFile(std::ofstream &output_file) -{ - base_particles_->writeParticlesToVtk(output_file); -} -//=================================================================================================// -void SPHBody::writeParticlesToPltFile(std::ofstream &output_file) +void SPHBody::defineAdaptationRatios(Real h_spacing_ratio, Real new_system_refinement_ratio) { - base_particles_->writeParticlesToPltFile(output_file); + sph_adaptation_->resetAdaptationRatios(h_spacing_ratio, new_system_refinement_ratio); } //=================================================================================================// void SPHBody::writeParticlesToXmlForRestart(std::string &filefullpath) @@ -113,7 +109,8 @@ BaseCellLinkedList &RealBody::getCellLinkedList() { if (!cell_linked_list_created_) { - cell_linked_list_ptr_ = sph_adaptation_->createCellLinkedList(getSPHSystemBounds()); + cell_linked_list_ptr_ = + sph_adaptation_->createCellLinkedList(getSPHSystemBounds(), *base_particles_); cell_linked_list_created_ = true; } return *cell_linked_list_ptr_.get(); @@ -124,15 +121,4 @@ void RealBody::updateCellLinkedList() getCellLinkedList().UpdateCellLists(*base_particles_); } //=================================================================================================// -void RealBody::updateCellLinkedListWithParticleSort(size_t particle_sorting_period) -{ - if (iteration_count_ % particle_sorting_period == 0) - { - base_particles_->sortParticles(getCellLinkedList()); - } - - iteration_count_++; - updateCellLinkedList(); -} -//=================================================================================================// } // namespace SPH diff --git a/src/shared/bodies/base_body.h b/src/shared/bodies/base_body.h index 46c6b46bf0..81639414a7 100644 --- a/src/shared/bodies/base_body.h +++ b/src/shared/bodies/base_body.h @@ -42,9 +42,9 @@ #include "base_particle_generator.h" #include "base_particles.h" #include "cell_linked_list.h" -#include "particle_sorting.h" -#include "sph_data_containers.h" +#include "execution.h" #include "sph_system.h" +#include "sphinxsys_containers.h" #include @@ -76,6 +76,9 @@ class SPHBody bool is_bound_set_; /**< whether the bounding box is set */ BoundingBox bound_; /**< bounding box of the body */ Shape *initial_shape_; /**< initial volumetric geometry enclosing the body */ + int total_body_parts_; + StdVec *> all_simple_reduce_computing_kernels_; + /**< total number of body parts */ public: SPHAdaptation *sph_adaptation_; /**< numerical adaptation policy */ @@ -106,6 +109,9 @@ class SPHBody void setSPHBodyBounds(const BoundingBox &bound); BoundingBox getSPHBodyBounds(); BoundingBox getSPHSystemBounds(); + void registerComputingKernel(execution::Implementation *implementation); + int getNewBodyPartID(); + int getTotalBodyParts() { return total_body_parts_; }; //---------------------------------------------------------------------- // Object factory template functions //---------------------------------------------------------------------- @@ -171,9 +177,6 @@ class SPHBody generateParticles(particle_reserve, std::forward(args)...); }; - virtual void writeParticlesToVtuFile(std::ostream &output_file); - virtual void writeParticlesToVtpFile(std::ofstream &output_file); - virtual void writeParticlesToPltFile(std::ofstream &output_file); virtual void writeParticlesToXmlForRestart(std::string &filefullpath); virtual void readParticlesFromXmlForRestart(std::string &filefullpath); virtual void writeToXmlForReloadParticle(std::string &filefullpath); @@ -189,21 +192,19 @@ class RealBody : public SPHBody { private: UniquePtr cell_linked_list_ptr_; - size_t iteration_count_; bool cell_linked_list_created_; public: template RealBody(Args &&...args) : SPHBody(std::forward(args)...), - iteration_count_(1), cell_linked_list_created_(false) + cell_linked_list_created_(false) { this->getSPHSystem().addRealBody(this); }; virtual ~RealBody(){}; BaseCellLinkedList &getCellLinkedList(); void updateCellLinkedList(); - void updateCellLinkedListWithParticleSort(size_t particle_sort_period); }; } // namespace SPH #endif // BASE_BODY_H diff --git a/src/shared/bodies/base_body_part.h b/src/shared/bodies/base_body_part.h index 86bb2d65e6..ec490a8b31 100644 --- a/src/shared/bodies/base_body_part.h +++ b/src/shared/bodies/base_body_part.h @@ -45,19 +45,23 @@ class BodyPart { public: BodyPart(SPHBody &sph_body, const std::string &body_part_name) - : sph_body_(sph_body), body_part_name_(body_part_name), + : sph_body_(sph_body), part_id_(sph_body.getNewBodyPartID()), + body_part_name_(body_part_name), base_particles_(sph_body.getBaseParticles()), - pos_(*base_particles_.getVariableDataByName("Position")){}; + pos_(base_particles_.getVariableDataByName("Position")){}; virtual ~BodyPart(){}; SPHBody &getSPHBody() { return sph_body_; }; + SPHSystem &getSPHSystem() { return sph_body_.getSPHSystem(); }; std::string getName() { return body_part_name_; }; + int getPartID() { return part_id_; }; protected: SPHBody &sph_body_; + int part_id_; std::string body_part_name_; BaseParticles &base_particles_; - StdLargeVec &pos_; + Vecd *pos_; }; /** diff --git a/src/shared/bodies/complex_bodies/tree_body.cpp b/src/shared/bodies/complex_bodies/tree_body.cpp index b2032931a8..eddec7a2dd 100644 --- a/src/shared/bodies/complex_bodies/tree_body.cpp +++ b/src/shared/bodies/complex_bodies/tree_body.cpp @@ -20,7 +20,7 @@ void TreeBody::buildParticleConfiguration(ParticleConfiguration &particle_config neighboring_ids.push_back(branches_[1]->inner_particles_[0]); neighboring_ids.push_back(branches_[1]->inner_particles_[1]); /** Build configuration. */ - const StdLargeVec &pos = base_particles_->ParticlePositions(); + Vecd *pos = base_particles_->ParticlePositions(); NeighborBuilderInner neighbor_relation_inner(*this); for (size_t n = 0; n != neighboring_ids.size(); ++n) { diff --git a/src/shared/bodies/complex_bodies/unstructured_mesh.cpp b/src/shared/bodies/complex_bodies/unstructured_mesh.cpp index 1e4b965949..bd2e9078df 100644 --- a/src/shared/bodies/complex_bodies/unstructured_mesh.cpp +++ b/src/shared/bodies/complex_bodies/unstructured_mesh.cpp @@ -10,7 +10,8 @@ BaseInnerRelationInFVM::BaseInnerRelationInFVM(RealBody &real_body, ANSYSMesh &a : BaseInnerRelation(real_body), real_body_(&real_body), node_coordinates_(ansys_mesh.node_coordinates_), mesh_topology_(ansys_mesh.mesh_topology_), - Vol_(*base_particles_.getVariableDataByName("VolumetricMeasure")) + pos_(base_particles_.getVariableDataByName("Position")), + Vol_(base_particles_.getVariableDataByName("VolumetricMeasure")) { subscribeToBody(); inner_configuration_.resize(base_particles_.RealParticlesBound(), Neighborhood()); diff --git a/src/shared/bodies/complex_bodies/unstructured_mesh.h b/src/shared/bodies/complex_bodies/unstructured_mesh.h index 23a98ba734..5ba92073ef 100644 --- a/src/shared/bodies/complex_bodies/unstructured_mesh.h +++ b/src/shared/bodies/complex_bodies/unstructured_mesh.h @@ -73,7 +73,8 @@ class BaseInnerRelationInFVM : public BaseInnerRelation virtual ~BaseInnerRelationInFVM(){}; protected: - StdLargeVec &Vol_; + Vecd *pos_; + Real *Vol_; virtual void resetNeighborhoodCurrentSize() override; }; diff --git a/src/shared/bodies/solid_body.cpp b/src/shared/bodies/solid_body.cpp index 0986b84969..77119253de 100644 --- a/src/shared/bodies/solid_body.cpp +++ b/src/shared/bodies/solid_body.cpp @@ -11,8 +11,8 @@ SolidBodyPartForSimbody:: SolidBodyPartForSimbody(SPHBody &body, Shape &body_part_shape) : BodyRegionByParticle(body, body_part_shape), rho0_(DynamicCast(this, body.base_material_)->ReferenceDensity()), - Vol_(*base_particles_.getVariableDataByName("VolumetricMeasure")), - pos_(*base_particles_.getVariableDataByName("Position")) + Vol_(base_particles_.getVariableDataByName("VolumetricMeasure")), + pos_(base_particles_.getVariableDataByName("Position")) { setMassProperties(); } diff --git a/src/shared/bodies/solid_body.h b/src/shared/bodies/solid_body.h index b4b4eb237f..31b6405b68 100644 --- a/src/shared/bodies/solid_body.h +++ b/src/shared/bodies/solid_body.h @@ -78,8 +78,8 @@ class SolidBodyPartForSimbody : public BodyRegionByParticle protected: Real rho0_; - StdLargeVec &Vol_; - StdLargeVec &pos_; + Real *Vol_; + Vecd *pos_; private: void setMassProperties(); diff --git a/src/shared/body_relations/base_body_relation.cpp b/src/shared/body_relations/base_body_relation.cpp index f60d58730a..bde91d2bde 100644 --- a/src/shared/body_relations/base_body_relation.cpp +++ b/src/shared/body_relations/base_body_relation.cpp @@ -18,8 +18,7 @@ RealBodyVector BodyPartsToRealBodies(BodyPartVector body_parts) //=================================================================================================// SPHRelation::SPHRelation(SPHBody &sph_body) : sph_body_(sph_body), - base_particles_(sph_body.getBaseParticles()), - pos_(*base_particles_.getVariableDataByName("Position")) {} + base_particles_(sph_body.getBaseParticles()) {} //=================================================================================================// BaseInnerRelation::BaseInnerRelation(RealBody &real_body) : SPHRelation(real_body), real_body_(&real_body) @@ -49,6 +48,9 @@ BaseContactRelation::BaseContactRelation(SPHBody &sph_body, RealBodyVector conta contact_configuration_.resize(contact_bodies_.size()); for (size_t k = 0; k != contact_bodies_.size(); ++k) { + const std::string name = contact_bodies_[k]->getName(); + contact_particles_.push_back(&contact_bodies_[k]->getBaseParticles()); + contact_adaptations_.push_back(contact_bodies_[k]->sph_adaptation_); contact_configuration_[k].resize(base_particles_.RealParticlesBound(), Neighborhood()); } } diff --git a/src/shared/body_relations/base_body_relation.h b/src/shared/body_relations/base_body_relation.h index 9ae9db31f3..a348dddc59 100644 --- a/src/shared/body_relations/base_body_relation.h +++ b/src/shared/body_relations/base_body_relation.h @@ -34,6 +34,7 @@ #include "base_geometry.h" #include "base_particles.h" #include "cell_linked_list.h" +#include "execution.h" #include "neighborhood.h" namespace SPH @@ -67,11 +68,11 @@ struct SearchDepthAdaptive { Real inv_grid_spacing_; Kernel *kernel_; - StdLargeVec &h_ratio_; + Real *h_ratio_; SearchDepthAdaptive(SPHBody &sph_body, CellLinkedList *target_cell_linked_list) : inv_grid_spacing_(1.0 / target_cell_linked_list->GridSpacing()), kernel_(sph_body.sph_adaptation_->getKernel()), - h_ratio_(*sph_body.getBaseParticles().getVariableDataByName("SmoothingLengthRatio")){}; + h_ratio_(sph_body.getBaseParticles().getVariableDataByName("SmoothingLengthRatio")){}; int operator()(size_t particle_index) const { return 1 + (int)floor(kernel_->CutOffRadius(h_ratio_[particle_index]) * inv_grid_spacing_); @@ -116,7 +117,6 @@ class SPHRelation protected: SPHBody &sph_body_; BaseParticles &base_particles_; - StdLargeVec &pos_; }; /** @@ -125,15 +125,15 @@ class SPHRelation */ class BaseInnerRelation : public SPHRelation { - protected: - virtual void resetNeighborhoodCurrentSize(); - public: RealBody *real_body_; ParticleConfiguration inner_configuration_; /**< inner configuration for the neighbor relations. */ explicit BaseInnerRelation(RealBody &real_body); virtual ~BaseInnerRelation(){}; BaseInnerRelation &getRelation() { return *this; }; + + protected: + virtual void resetNeighborhoodCurrentSize(); }; /** @@ -147,6 +147,8 @@ class BaseContactRelation : public SPHRelation public: RealBodyVector contact_bodies_; + StdVec contact_particles_; + StdVec contact_adaptations_; StdVec contact_configuration_; /**< Configurations for particle interaction between bodies. */ BaseContactRelation(SPHBody &sph_body, RealBodyVector contact_bodies); @@ -154,6 +156,9 @@ class BaseContactRelation : public SPHRelation : BaseContactRelation(sph_body, BodyPartsToRealBodies(contact_body_parts)){}; virtual ~BaseContactRelation(){}; BaseContactRelation &getRelation() { return *this; }; + RealBodyVector getContactBodies() { return contact_bodies_; }; + StdVec getContactParticles() { return contact_particles_; }; + StdVec getContactAdaptations() { return contact_adaptations_; }; }; } // namespace SPH #endif // BASE_BODY_RELATION_H \ No newline at end of file diff --git a/src/shared/body_relations/contact_body_relation.cpp b/src/shared/body_relations/contact_body_relation.cpp index 7346287f0d..62a5b68fed 100644 --- a/src/shared/body_relations/contact_body_relation.cpp +++ b/src/shared/body_relations/contact_body_relation.cpp @@ -2,7 +2,6 @@ #include "all_particles.h" #include "base_particle_dynamics.h" #include "cell_linked_list.hpp" -#include namespace SPH { diff --git a/src/shared/body_relations/contact_body_relation.h b/src/shared/body_relations/contact_body_relation.h index 1bf23a149e..a37e208280 100644 --- a/src/shared/body_relations/contact_body_relation.h +++ b/src/shared/body_relations/contact_body_relation.h @@ -61,6 +61,7 @@ class ContactRelationCrossResolution : public BaseContactRelation } }; virtual ~ContactRelationCrossResolution(){}; + StdVec getContactCellLinkedList() { return target_cell_linked_lists_; } protected: StdVec target_cell_linked_lists_; diff --git a/src/shared/body_relations/inner_body_relation.h b/src/shared/body_relations/inner_body_relation.h index 1b4c63d096..75925c90af 100644 --- a/src/shared/body_relations/inner_body_relation.h +++ b/src/shared/body_relations/inner_body_relation.h @@ -46,8 +46,9 @@ class InnerRelation : public BaseInnerRelation public: explicit InnerRelation(RealBody &real_body); - virtual ~InnerRelation(){}; + virtual ~InnerRelation() {}; + CellLinkedList &getCellLinkedList() { return cell_linked_list_; }; virtual void updateConfiguration() override; }; @@ -68,7 +69,7 @@ class AdaptiveInnerRelation : public BaseInnerRelation public: explicit AdaptiveInnerRelation(RealBody &real_body); - virtual ~AdaptiveInnerRelation(){}; + virtual ~AdaptiveInnerRelation() {}; virtual void updateConfiguration() override; }; @@ -83,7 +84,7 @@ class SelfSurfaceContactRelation : public BaseInnerRelation BodySurfaceLayer body_surface_layer_; explicit SelfSurfaceContactRelation(RealBody &real_body); - virtual ~SelfSurfaceContactRelation(){}; + virtual ~SelfSurfaceContactRelation() {}; virtual void updateConfiguration() override; protected: @@ -107,7 +108,7 @@ class TreeInnerRelation : public InnerRelation public: explicit TreeInnerRelation(RealBody &real_body); - virtual ~TreeInnerRelation(){}; + virtual ~TreeInnerRelation() {}; virtual void updateConfiguration() override; }; diff --git a/src/shared/common/base_data_package.h b/src/shared/common/base_data_package.h index 6d52130474..d86d55636f 100644 --- a/src/shared/common/base_data_package.h +++ b/src/shared/common/base_data_package.h @@ -50,9 +50,12 @@ using DataContainerAddressKeeper = StdVec; /** Generalized data container unique pointer keeper */ template using DataContainerUniquePtrKeeper = UniquePtrsKeeper; +/** Generalized data container allocated data keeper */ +template +using AllocatedData = DataType *; template