1111
1212#include " Moose.h"
1313
14- // libMesh
1514#include " libmesh/point.h"
1615#include " libmesh/periodic_boundary_base.h"
1716
17+ #include < array>
1818#include < vector>
1919
2020class FEProblemBase ;
2121class Function ;
2222
2323/* *
24- * Periodic boundary for calculation periodic BC on domains where the translation is given by
25- * functions
24+ * Periodic boundary for calculation periodic BC on domains where the
25+ * translation is given by Function objects
2626 */
2727class FunctionPeriodicBoundary : public libMesh ::PeriodicBoundaryBase
2828{
2929public:
3030 /* *
31- * Initialize the periodic boundary with three functions
31+ * Initialize the periodic with the functions and inverse functions, one
32+ * for each dimension needed
3233 */
33- FunctionPeriodicBoundary (FEProblemBase & subproblem, std::vector<std::string> fn_names);
34+ FunctionPeriodicBoundary (FEProblemBase & subproblem,
35+ const std::vector<std::string> & fn_names,
36+ const std::vector<std::string> & inv_fn_names);
3437
3538 /* *
3639 * Copy constructor for creating the periodic boundary and inverse periodic boundary
3740 *
3841 * @param o - Periodic boundary being copied
42+ * @param t - Transformation direction
3943 */
40- FunctionPeriodicBoundary (const FunctionPeriodicBoundary & o);
44+ FunctionPeriodicBoundary (const FunctionPeriodicBoundary & o, TransformationType t = FORWARD );
4145
4246 /* *
4347 * Get the translation based on point 'pt'
@@ -46,26 +50,17 @@ class FunctionPeriodicBoundary : public libMesh::PeriodicBoundaryBase
4650 */
4751 virtual libMesh::Point get_corresponding_pos (const libMesh::Point & pt) const override ;
4852
49- /* *
50- * Required interface, this class must be able to clone itself
51- */
5253 virtual std::unique_ptr<libMesh::PeriodicBoundaryBase> clone (TransformationType t) const override ;
5354
54- protected:
55- // /// The dimension of the problem (says which _tr_XYZ member variables are active)
56- unsigned int _dim;
57-
58- // / Pointer to Function for x-component of the boundary
59- const Function * const _tr_x;
55+ private:
56+ static std::array<const Function *, 3 > getFunctions (FEProblemBase & problem,
57+ const std::vector<std::string> & names);
6058
61- // / Pointer to Function for y-component of the boundary
62- const Function * const _tr_y ;
59+ // / The dimension of the problem (says which of _tr and _inv_tr are active)
60+ const unsigned int _dim ;
6361
64- // / Pointer to Function for z-component of the boundary
65- const Function * const _tr_z;
66-
67- /* *
68- * An initialization method to make certain that initialSetup() of a function prior to value()
69- */
70- void init ();
62+ // / Pointers to translation functions in each dimension
63+ const std::array<const Function *, 3 > _tr;
64+ // / Pointers to inverse translation functions in each dimension
65+ const std::array<const Function *, 3 > _inv_tr;
7166};
0 commit comments