Skip to content

Commit

Permalink
Move includes after #define in DEM (chaos-polymtl#1223)
Browse files Browse the repository at this point in the history
Description
Quick refactor as done in PR chaos-polymtl#1170 that moves header includes after the #define.
Some @brief has been added here and there at the same time.
  • Loading branch information
acdaigneault authored Aug 6, 2024
1 parent 797e3de commit 9beea0c
Show file tree
Hide file tree
Showing 65 changed files with 458 additions and 636 deletions.
2 changes: 1 addition & 1 deletion include/dem/adaptive_sparse_contacts.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class AdaptiveSparseContacts
* fraction.
* @param[in] advect_particles The flag for the advection of particles.
*/
void
inline void
set_parameters(const double granular_temperature,
const double solid_fraction,
const double advect_particles)
Expand Down
22 changes: 12 additions & 10 deletions include/dem/boundary_cells_info_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@
* the top level of the Lethe distribution.
*
* ---------------------------------------------------------------------
*
*/

#ifndef lethe_boundary_cells_info_struct_h
#define lethe_boundary_cells_info_struct_h

#include <deal.II/base/point.h>
#include <deal.II/base/tensor.h>

#include <deal.II/distributed/tria.h>

#ifndef boundary_cells_info_struct_h
# define boundary_cells_info_struct_h
using namespace dealii;

/**
* This struct handles the information related to the boundary cells which will
* be used for particle-wall contact detection
* @brief Handle the information related to the boundary cells
* which will be used for particle-wall contact detection.
*/

using namespace dealii;

template <int dim>
struct boundary_cells_info_struct
{
Expand All @@ -48,6 +47,10 @@ struct boundary_cells_info_struct
Point<dim> point_on_face;
};

/**
* @brief Handle the information related to the periodic boundary cells
* which will be used for particle-wall contact detection.
*/
template <int dim>
struct periodic_boundaries_cells_info_struct
{
Expand All @@ -73,5 +76,4 @@ struct periodic_boundaries_cells_info_struct
Point<dim> point_on_periodic_face;
};


#endif /* boundary_cells_info_struct_h */
#endif
5 changes: 1 addition & 4 deletions include/dem/contact_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@
* the top level of the Lethe distribution.
*
* ---------------------------------------------------------------------
*
*/

#ifndef lethe_contact_type_h
#define lethe_contact_type_h

/**
* @brief Label for particle-object contact type.
*
*/

enum ContactType
{
local_particle_particle,
Expand All @@ -37,4 +34,4 @@ enum ContactType
particle_line
};

#endif // lethe_contact_type_h
#endif
40 changes: 20 additions & 20 deletions include/dem/data_containers.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
* the top level of the Lethe distribution.
*
* ---------------------------------------------------------------------
*
*/

#ifndef lethe_data_containers_h
#define lethe_data_containers_h

#include <dem/boundary_cells_info_struct.h>
#include <dem/particle_particle_contact_info.h>
#include <dem/particle_point_line_contact_info_struct.h>
Expand All @@ -28,35 +30,31 @@

#include <boost/range/adaptor/map.hpp>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-braces"
#include <ankerl/unordered_dense.h>
#pragma GCC diagnostic pop

#include <iostream>
#include <unordered_map>
#include <vector>

#ifndef lethe_data_containers_h
# define lethe_data_containers_h
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-braces"
#include <ankerl/unordered_dense.h>
#pragma GCC diagnostic pop

/**
* This namespace defines all the data containers and required operations on
* @brief This namespace defines all the data containers and required operations on
* these containers for the DEM solver. At the moment, only overloaded operators
* are here, but eventually all the data containers of the DEM solver will be
* moved here
*/
namespace DEM
{
/**
* Defined global face id as a type to ensure that we know what the
* @brief Defined global face id as a type to ensure that we know what the
* structures use as index. This is more verbose than unsigned int
*/
typedef unsigned int global_face_id;


/**
* Operator overloading to enable using triangulation cells as map keys.
* @brief Operator overloading to enable using triangulation cells as map keys.
*/
using namespace dealii;

Expand All @@ -74,7 +72,7 @@ namespace DEM
};

/**
* Operator overloading to enable using particle iterators as map keys.
* @brief Operator overloading to enable using particle iterators as map keys.
*/

template <int dim>
Expand All @@ -89,7 +87,7 @@ namespace DEM
};

/**
* Operator overloading to enable using triangulation cells as map keys.
* @brief Operator overloading to enable using triangulation cells as map keys.
*/
using namespace dealii;

Expand All @@ -107,12 +105,14 @@ namespace DEM
}
};

// DEM data structure containers
// To improve readability of containers, there's a simple description above
// all declarations which follow these representation :
// <> : map or unordered map
// () : tuple or pair
// [] : vector
/**
* @brief DEM data structure containers
* To improve readability of containers, there's a simple description above
* all declarations which follow these representation :
* <> : map or unordered map
* () : tuple or pair
* [] : vector
*/
template <int dim>
struct dem_data_structures
{
Expand Down
1 change: 0 additions & 1 deletion include/dem/dem.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* the top level of the Lethe distribution.
*
* ---------------------------------------------------------------------
*
*/

#ifndef lethe_dem_h
Expand Down
19 changes: 17 additions & 2 deletions include/dem/dem_action_manager.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#ifndef dem_action_manager_h
#define dem_action_manager_h
/* ---------------------------------------------------------------------
*
* Copyright (C) 2019 - 2024 by the Lethe authors
*
* This file is part of the Lethe library
*
* The Lethe library is free software; you can use it, redistribute
* it, and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* The full text of the license can be found in the file LICENSE at
* the top level of the Lethe distribution.
*
* ---------------------------------------------------------------------
*/

#ifndef lethe_dem_action_manager_h
#define lethe_dem_action_manager_h

/**
* @brief Manage the actions to be performed in the DEM solver and on the DEM
Expand Down
1 change: 0 additions & 1 deletion include/dem/dem_contact_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* the top level of the Lethe distribution.
*
* ---------------------------------------------------------------------
*
*/

#ifndef lethe_dem_contact_manager_h
Expand Down
20 changes: 10 additions & 10 deletions include/dem/post_processing.h → include/dem/dem_post_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@
* the top level of the Lethe distribution.
*
* ---------------------------------------------------------------------
*
*/

#ifndef lethe_dem_post_processing_h
#define lethe_dem_post_processing_h

#include <core/utilities.h>

#include <deal.II/particles/particle_handler.h>

#ifndef dem_post_processing_h
# define dem_post_processing_h

using namespace dealii;


namespace DEM
{
/**
Expand All @@ -40,24 +38,26 @@ namespace DEM
};

/**
* @brief Calculate statistics on a DEM ParticleHandler. At the moment, the following statistics are supported:
* @brief Calculate statistics on a DEM ParticleHandler. At the moment, the
* following statistics are supported:
* - Translational kinetic energy
* - Rotational (angular) kinetic energy
* - Translational velocity
* - Rotational (angular) velocity
*
* @tparam dim Dimensionality of the problem (2D or 3D)
* @tparam dem_statistics_variable Enum variable used to identify which granular statistics is being calculated
* @tparam dem_statistics_variable Enum variable used to identify which
* granular statistics is being calculated
*
* @param particle_handler A reference to the particle handler being used for DEM
* @param particle_handler A reference to the particle handler being used for
* DEM
* @param mpi_communicator The MPI communicator
*/
template <int dim, dem_statistic_variable var>
statistics
calculate_granular_statistics(
const Particles::ParticleHandler<dim> &particle_handler,
const MPI_Comm &mpi_communicator);


} // namespace DEM

#endif
13 changes: 6 additions & 7 deletions include/dem/dem_solver_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@
* the top level of the Lethe distribution.
*
* ---------------------------------------------------------------------
*
*/

#ifndef lethe_dem_solver_parameters_h
#define lethe_dem_solver_parameters_h

#include <core/parameters.h>
#include <core/parameters_lagrangian.h>
#include <core/simulation_control.h>
#include <core/solid_objects_parameters.h>

#ifndef parameters_DEM_h
# define parameters_DEM_h

/**
* Handles all the parameters declared in the parameter handler file
* @brief Handles all the parameters declared in the parameter handler file.
*/

template <int dim>
class DEMSolverParameters
{
Expand Down Expand Up @@ -93,4 +92,4 @@ class DEMSolverParameters
}
};

#endif /* parameters_DEM_h */
#endif
23 changes: 11 additions & 12 deletions include/dem/distributions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@
* the top level of the Lethe distribution.
*
* ---------------------------------------------------------------------
*
*/

#ifndef lethe_distributions_h
#define lethe_distributions_h

#include <cmath>
#include <fstream>
#include <iostream>
#include <random>
#include <string>

#ifndef distributions_h
# define distributions_h

class Distribution
{
public:
Expand Down Expand Up @@ -97,17 +96,17 @@ class NormalDistribution : public Distribution

private:
/**
* Average diameter of the normal distribution.
* @brief Average diameter of the normal distribution.
*/
const double diameter_average;

/**
* Standard deviation of distribution of the normal distribution.
* @brief Standard deviation of distribution of the normal distribution.
*/
const double standard_deviation;

/**
* Random number generator for the diameter selection.
* @brief Random number generator for the diameter selection.
*/
std::mt19937 gen;
};
Expand Down Expand Up @@ -150,7 +149,7 @@ class UniformDistribution : public Distribution

private:
/**
* The diameter value of the distribution.
* @brief The diameter value of the distribution.
*/
const double diameter_value;
};
Expand Down Expand Up @@ -204,16 +203,16 @@ class CustomDistribution : public Distribution
const std::vector<double> diameter_custom_values;

/**
* Vector containing cumulative probabilities associated with de
* @brief Vector containing cumulative probabilities associated with de
* diameter_custom_values vector. The probabilities are based on the volume
* fraction, not the number of particles.
*/
std::vector<double> diameter_custom_cumu_prob;
std::vector<double> diameter_custom_cumul_prob;

/**
* Random number generator for the diameter selection.
* @brief Random number generator for the diameter selection.
*/
std::mt19937 gen;
};

#endif /* distributions_h */
#endif
Loading

0 comments on commit 9beea0c

Please sign in to comment.