www.mooseframework.org
PolycrystalICTools.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #ifndef POLYCRYSTALICTOOLS_H
8 #define POLYCRYSTALICTOOLS_H
9 
10 #include "Moose.h"
11 #include "libmesh/libmesh.h"
12 #include "InitialCondition.h"
13 
15 {
16 
21 template <typename T>
23 {
24 public:
25  AdjacencyMatrix(unsigned int size) : _size(size), _data(size * size) {}
26 
27  ~AdjacencyMatrix() = default;
28 
29  // Get rid of copy constructors
30  AdjacencyMatrix(const AdjacencyMatrix & f) = delete;
31  AdjacencyMatrix & operator=(const AdjacencyMatrix & f) = delete;
32 
33  // Use only move constructors
34  AdjacencyMatrix(AdjacencyMatrix && f) = default;
35  AdjacencyMatrix & operator=(AdjacencyMatrix && f) = default;
36 
37  T & operator()(unsigned int i, unsigned int j) { return _data[i * _size + j]; }
38  T operator()(unsigned int i, unsigned int j) const { return _data[i * _size + j]; }
39 
40  std::size_t size() const { return _size; }
41  T * rawDataPtr() { return _data.data(); }
42 
43 private:
44  const std::size_t _size;
45  std::vector<T> _data;
46 };
47 
48 std::vector<unsigned int> assignPointsToVariables(const std::vector<Point> & centerpoints,
49  const Real op_num,
50  const MooseMesh & mesh,
51  const MooseVariable & var);
52 
53 unsigned int assignPointToGrain(const Point & p,
54  const std::vector<Point> & centerpoints,
55  const MooseMesh & mesh,
56  const MooseVariable & var,
57  const Real maxsize);
58 
60 buildGrainAdjacencyMatrix(const std::map<dof_id_type, unsigned int> & entity_to_grain,
61  MooseMesh & mesh,
62  const PeriodicBoundaries * pb,
63  unsigned int n_grains,
64  bool is_elemental);
65 
67 buildElementalGrainAdjacencyMatrix(const std::map<dof_id_type, unsigned int> & element_to_grain,
68  MooseMesh & mesh,
69  const PeriodicBoundaries * pb,
70  unsigned int n_grains);
71 
73 buildNodalGrainAdjacencyMatrix(const std::map<dof_id_type, unsigned int> & node_to_grain,
74  MooseMesh & mesh,
75  const PeriodicBoundaries * pb,
76  unsigned int n_grains);
77 
78 std::vector<unsigned int> assignOpsToGrains(AdjacencyMatrix<Real> & adjacency_matrix,
79  unsigned int n_grains,
80  unsigned int n_ops,
81  const MooseEnum & coloring_algorithm);
82 
83 MooseEnum coloringAlgorithms();
84 
85 std::string coloringAlgorithmDescriptions();
86 }
87 
88 #endif // POLYCRYSTALICTOOLS_H
T operator()(unsigned int i, unsigned int j) const
AdjacencyMatrix< Real > buildGrainAdjacencyMatrix(const std::map< dof_id_type, unsigned int > &entity_to_grain, MooseMesh &mesh, const PeriodicBoundaries *pb, unsigned int n_grains, bool is_elemental)
AdjacencyMatrix & operator=(const AdjacencyMatrix &f)=delete
unsigned int assignPointToGrain(const Point &p, const std::vector< Point > &centerpoints, const MooseMesh &mesh, const MooseVariable &var, const Real maxsize)
T & operator()(unsigned int i, unsigned int j)
std::vector< unsigned int > assignPointsToVariables(const std::vector< Point > &centerpoints, const Real op_num, const MooseMesh &mesh, const MooseVariable &var)
AdjacencyMatrix< Real > buildNodalGrainAdjacencyMatrix(const std::map< dof_id_type, unsigned int > &node_to_grain, MooseMesh &mesh, const PeriodicBoundaries *pb, unsigned int n_grains)
MooseEnum coloringAlgorithms()
AdjacencyMatrix< Real > buildElementalGrainAdjacencyMatrix(const std::map< dof_id_type, unsigned int > &element_to_grain, MooseMesh &mesh, const PeriodicBoundaries *pb, unsigned int n_grains)
Simple 2D block matrix indicating graph adjacency.
std::vector< unsigned int > assignOpsToGrains(AdjacencyMatrix< Real > &adjacency_matrix, unsigned int n_grains, unsigned int n_ops, const MooseEnum &coloring_algorithm)
std::string coloringAlgorithmDescriptions()