https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PolycrystalVoronoi.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "KDTree.h"
14
15// Forward Declarations
16
18{
19public:
21
23
24 virtual void precomputeGrainStructure() override;
25 virtual void getGrainsBasedOnPoint(const Point & point,
26 std::vector<unsigned int> & grains) const override;
27 virtual Real getVariableValue(unsigned int op_index, const Point & p) const override;
28
29 virtual unsigned int getNumGrains() const override { return _grain_num; }
30 virtual std::vector<Point> getGrainCenters() const { return _centerpoints; }
31
32 // Build a KD tree
33 void buildSearchTree();
34
35protected:
37 unsigned int _grain_num;
38
39 const bool _columnar_3D;
40
41 const unsigned int _rand_seed;
42 const Real _int_width;
43
46 Point _range;
47
48 std::vector<Point> _centerpoints;
49
50 const FileName _file_name;
51
52private:
53 Real computeDiffuseInterface(const Point & point,
54 const unsigned int & gr_index,
55 const std::vector<unsigned int> & grain_ids) const;
56 Point findNormalVector(const Point & point, const Point & p1, const Point & p2) const;
57 Point findCenterPoint(const Point & point, const Point & p1, const Point & p2) const;
58 Real findLinePoint(const Point & point,
59 const Point & N,
60 const Point & cntr,
61 const unsigned int dim) const;
62
64 std::unique_ptr<KDTree> _kd_tree;
67 std::vector<dof_id_type> _grain_gtl_ids;
69 std::vector<Point> _new_points;
73 unsigned int _point_patch_size;
75 unsigned int _grain_patch_size;
76};
const Real p
const InputParameters & parameters() const
This object provides the base capability for creating proper polycrystal ICs.
unsigned int _grain_num
The number of grains to create.
Real findLinePoint(const Point &point, const Point &N, const Point &cntr, const unsigned int dim) const
Point findCenterPoint(const Point &point, const Point &p1, const Point &p2) const
const unsigned int _rand_seed
virtual void precomputeGrainStructure() override
This callback is triggered after the object is initialized and may be optionally overridden to do pre...
std::vector< Point > _new_points
Original grain center points and duplicated grain center points.
virtual std::vector< Point > getGrainCenters() const
unsigned int _point_patch_size
The number of nearest points.
static InputParameters validParams()
const FileName _file_name
Real computeDiffuseInterface(const Point &point, const unsigned int &gr_index, const std::vector< unsigned int > &grain_ids) const
bool _use_kdtree
Whether or not to use a KD tree to speedup grain search.
std::vector< dof_id_type > _grain_gtl_ids
The domain is extended to consider periodic boundary conditions.
virtual unsigned int getNumGrains() const override
Must be overridden by the deriving class to provide the number of grains in the polycrystal structure...
Point findNormalVector(const Point &point, const Point &p1, const Point &p2) const
std::vector< Point > _centerpoints
std::unique_ptr< KDTree > _kd_tree
KD tree that is used to speedup grain search.
virtual void getGrainsBasedOnPoint(const Point &point, std::vector< unsigned int > &grains) const override
Method for retrieving active grain IDs based on some point in the mesh.
virtual Real getVariableValue(unsigned int op_index, const Point &p) const override
Returns the variable value for a given op_index and mesh point.
unsigned int _grain_patch_size
The number of neighboring grains.