Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ 4 : /* */ 5 : /* Copyright 2017 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #pragma once 10 : 11 : #include "Moose.h" 12 : #include "libmesh/point.h" 13 : #include "libmesh/point_locator_base.h" 14 : 15 : namespace libMesh 16 : { 17 : class MeshBase; 18 : } 19 : class PointLocatorRegularOrthogonalData; 20 : 21 : class PointLocatorRegularOrthogonal : public PointLocatorBase 22 : { 23 : public: 24 : /** 25 : * Constructor. Needs the \p mesh in which the points 26 : * should be located. Optionally takes a master 27 : * interpolator. This master helps in saving memory 28 : * by reducing the number of root element tables in use. Only the 29 : * master locator holds a root element table, the others simply 30 : * use the master's table. 31 : */ 32 : PointLocatorRegularOrthogonal(const MeshBase & mesh, const PointLocatorBase * master = nullptr); 33 : 34 : virtual ~PointLocatorRegularOrthogonal(); 35 : 36 : /** 37 : * Clears the locator. This function frees dynamic memory with "delete" for the master. 38 : */ 39 : virtual void clear() override; 40 : 41 : /// Do not use this init method, use the one below. 42 : virtual void init() override; 43 : 44 : /** 45 : * Initializes the locator, so that the \p operator() methods can 46 : * be used. This method allocates dynamic memory with "new". 47 : */ 48 : void init(const std::vector<unsigned int> & cell_count, 49 : const Point & min_corner, 50 : const Point & max_corner); 51 : 52 : /** 53 : * Locates the element in which the point with global coordinates 54 : * \p p is located, optionally restricted to a set of allowed subdomains. 55 : */ 56 : virtual const Elem * 57 : operator()(const Point & p, 58 : const std::set<subdomain_id_type> * allowed_subdomains = nullptr) const override; 59 : 60 : /** 61 : * Locates a set of elements in proximity to the point with global coordinates 62 : * \p p Pure virtual. Optionally allows the user to restrict the subdomains searched. 63 : */ 64 : virtual void 65 : operator()(const Point & p, 66 : std::set<const Elem *> & candidate_elements, 67 : const std::set<subdomain_id_type> * allowed_subdomains = nullptr) const override; 68 : 69 : /** 70 : * Enables out-of-mesh mode. In this mode, if asked to find a point 71 : * that is contained in no mesh at all, the point locator will 72 : * return a NULL pointer instead of crashing. Per default, this 73 : * mode is off. 74 : */ 75 383 : virtual void enable_out_of_mesh_mode() override { _out_of_mesh_mode = true; } 76 : 77 : /** 78 : * Disables out-of-mesh mode (default). If asked to find a point 79 : * that is contained in no mesh at all, the point locator will now 80 : * crash. 81 : */ 82 0 : virtual void disable_out_of_mesh_mode() override { _out_of_mesh_mode = false; } 83 : 84 : protected: 85 : /// true if out-of-mesh mode is enabled 86 : bool _out_of_mesh_mode; 87 : 88 : /// internal data object, shared between master and servants 89 : PointLocatorRegularOrthogonalData * _data; 90 : };