Skip to content

Commit

Permalink
Add MaterialStates template parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Rombur committed Mar 15, 2024
1 parent 73157ee commit 5c61db4
Show file tree
Hide file tree
Showing 43 changed files with 2,201 additions and 1,014 deletions.
833 changes: 728 additions & 105 deletions application/adamantine.cc

Large diffs are not rendered by default.

160 changes: 89 additions & 71 deletions application/adamantine.hh

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions source/BodyForce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@

namespace adamantine
{
template <int dim, int p_order, typename MemorySpaceType>
GravityForce<dim, p_order, MemorySpaceType>::GravityForce(
MaterialProperty<dim, p_order, MemorySpaceType> &material_properties)
template <int dim, int p_order, typename MaterialStates,
typename MemorySpaceType>
GravityForce<dim, p_order, MaterialStates, MemorySpaceType>::GravityForce(
MaterialProperty<dim, p_order, MaterialStates, MemorySpaceType>
&material_properties)
: _material_properties(material_properties)
{
}

template <int dim, int p_order, typename MemorySpaceType>
template <int dim, int p_order, typename MaterialStates,
typename MemorySpaceType>
dealii::Tensor<1, dim, double>
GravityForce<dim, p_order, MemorySpaceType>::eval(
GravityForce<dim, p_order, MaterialStates, MemorySpaceType>::eval(
typename dealii::Triangulation<dim>::active_cell_iterator const &cell)
{
// Note that the density is independent of the temperature
Expand All @@ -33,5 +36,5 @@ GravityForce<dim, p_order, MemorySpaceType>::eval(
}
} // namespace adamantine

INSTANTIATE_DIM_PORDER_HOST(TUPLE(GravityForce))
INSTANTIATE_DIM_PORDER_DEVICE(TUPLE(GravityForce))
INSTANTIATE_DIM_PORDER_MATERIALSTATES_HOST(TUPLE(GravityForce))
INSTANTIATE_DIM_PORDER_MATERIALSTATES_DEVICE(TUPLE(GravityForce))
13 changes: 8 additions & 5 deletions source/BodyForce.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@ struct BodyForce
};

// Forward declaration
template <int dim, int p_order, typename MemorySpaceType>
template <int dim, int p_order, typename MaterialStates,
typename MemorySpaceType>
class MaterialProperty;

/**
* Gravity's body force.
*/
template <int dim, int p_order, typename MemorySpaceType>
template <int dim, int p_order, typename MaterialStates,
typename MemorySpaceType>
class GravityForce final : public BodyForce<dim>
{
public:
GravityForce(
MaterialProperty<dim, p_order, MemorySpaceType> &material_properties);
GravityForce(MaterialProperty<dim, p_order, MaterialStates, MemorySpaceType>
&material_properties);

dealii::Tensor<1, dim, double>
eval(typename dealii::Triangulation<dim>::active_cell_iterator const &cell)
Expand All @@ -51,7 +53,8 @@ private:
* Gravity in \f$m/s^2\f$
*/
static double constexpr g = 9.80665;
MaterialProperty<dim, p_order, MemorySpaceType> &_material_properties;
MaterialProperty<dim, p_order, MaterialStates, MemorySpaceType>
&_material_properties;
};
} // namespace adamantine

Expand Down
1 change: 1 addition & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set(Adamantine_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/ImplicitOperator.hh
${CMAKE_CURRENT_SOURCE_DIR}/MaterialProperty.hh
${CMAKE_CURRENT_SOURCE_DIR}/MaterialProperty.templates.hh
${CMAKE_CURRENT_SOURCE_DIR}/MaterialStates.hh
${CMAKE_CURRENT_SOURCE_DIR}/MechanicalOperator.hh
${CMAKE_CURRENT_SOURCE_DIR}/MechanicalPhysics.hh
${CMAKE_CURRENT_SOURCE_DIR}/NewtonSolver.hh
Expand Down
10 changes: 6 additions & 4 deletions source/Geometry.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2016 - 2021, the adamantine authors.
/* Copyright (c) 2016 - 2024, the adamantine authors.
*
* This file is subject to the Modified BSD License and may not be distributed
* without copyright and license information. Please refer to the file LICENSE
Expand All @@ -9,6 +9,7 @@
#define GEOMETRY_TEMPLATES_HH

#include <Geometry.hh>
#include <MaterialStates.hh>
#include <instantiation.hh>
#include <types.hh>
#include <utils.hh>
Expand Down Expand Up @@ -143,11 +144,12 @@ void Geometry<dim>::assign_material_state(
{
if (cell->center()[axis<dim>::z] < solid_height)
{
cell->set_user_index(static_cast<int>(MaterialState::solid));
cell->set_user_index(static_cast<int>(SolidLiquidPowder::State::solid));
}
else
{
cell->set_user_index(static_cast<int>(MaterialState::powder));
cell->set_user_index(
static_cast<int>(SolidLiquidPowder::State::powder));
}
}
}
Expand All @@ -156,7 +158,7 @@ void Geometry<dim>::assign_material_state(
// Everything is made of solid material
for (auto cell : _triangulation.active_cell_iterators())
{
cell->set_user_index(static_cast<int>(MaterialState::solid));
cell->set_user_index(static_cast<int>(SolidLiquidPowder::State::solid));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/MaterialProperty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
#include <MaterialProperty.templates.hh>
#include <instantiation.hh>

INSTANTIATE_DIM_PORDER_HOST(TUPLE(MaterialProperty))
INSTANTIATE_DIM_PORDER_DEVICE(TUPLE(MaterialProperty))
INSTANTIATE_DIM_PORDER_MATERIALSTATES_HOST(TUPLE(MaterialProperty))
INSTANTIATE_DIM_PORDER_MATERIALSTATES_DEVICE(TUPLE(MaterialProperty))

0 comments on commit 5c61db4

Please sign in to comment.