www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
MultiBoundingBoxIC Class Reference

MultiBoundingBoxIC allows setting the initial condition of a value inside and outside of a specified box. More...

#include <MultiBoundingBoxIC.h>

Inheritance diagram for MultiBoundingBoxIC:
[legend]

Public Member Functions

 MultiBoundingBoxIC (const InputParameters &parameters)
 
virtual Real value (const Point &p)
 

Protected Attributes

const unsigned int _nbox
 number of boxes More...
 
const unsigned int _dim
 dimensionality of the mesh More...
 
std::vector< Real > _inside
 values inside the boxes More...
 
const Real _outside
 values outside the boxes More...
 
std::vector< Point > _c1
 lists of opposite corners More...
 
std::vector< Point > _c2
 

Detailed Description

MultiBoundingBoxIC allows setting the initial condition of a value inside and outside of a specified box.

The box is aligned with the x,y,z axis... and is specified by passing in the x,y,z coordinates of opposite corners.

Definition at line 24 of file MultiBoundingBoxIC.h.

Constructor & Destructor Documentation

MultiBoundingBoxIC::MultiBoundingBoxIC ( const InputParameters &  parameters)

Definition at line 29 of file MultiBoundingBoxIC.C.

30  : InitialCondition(parameters),
31  _c1(getParam<std::vector<Point>>("corners")),
32  _c2(getParam<std::vector<Point>>("opposite_corners")),
33  _nbox(_c1.size()),
34  _dim(_fe_problem.mesh().dimension()),
35  _inside(getParam<std::vector<Real>>("inside")),
36  _outside(getParam<Real>("outside"))
37 {
38  // we allow passing in a single value used on the inside of all boxes
39  if (_inside.size() == 1)
40  _inside.assign(_nbox, _inside[0]);
41 
42  // make sure inputs are the same length
43  if (_c2.size() != _nbox || _inside.size() != _nbox)
44  mooseError("vector inputs must all be the same size");
45 }
std::vector< Real > _inside
values inside the boxes
const unsigned int _dim
dimensionality of the mesh
std::vector< Point > _c1
lists of opposite corners
const unsigned int _nbox
number of boxes
const Real _outside
values outside the boxes
std::vector< Point > _c2

Member Function Documentation

Real MultiBoundingBoxIC::value ( const Point &  p)
virtual

Definition at line 48 of file MultiBoundingBoxIC.C.

49 {
50  Real value = _outside;
51 
52  for (unsigned int b = 0; b < _nbox; ++b)
53  {
54  if ((_c1[b](0) < _c2[b](0) && p(0) >= _c1[b](0) && p(0) <= _c2[b](0)) ||
55  (_c1[b](0) >= _c2[b](0) && p(0) <= _c1[b](0) && p(0) >= _c2[b](0)))
56  if (_dim <= 1 || (_c1[b](1) < _c2[b](1) && p(1) >= _c1[b](1) && p(1) <= _c2[b](1)) ||
57  (_c1[b](1) >= _c2[b](1) && p(1) <= _c1[b](1) && p(1) >= _c2[b](1)))
58  if (_dim <= 2 || (_c1[b](2) < _c2[b](2) && p(2) >= _c1[b](2) && p(2) <= _c2[b](2)) ||
59  (_c1[b](2) >= _c2[b](2) && p(2) <= _c1[b](2) && p(2) >= _c2[b](2)))
60  {
61  value = _inside[b];
62  break;
63  }
64  }
65 
66  return value;
67 }
std::vector< Real > _inside
values inside the boxes
virtual Real value(const Point &p)
const unsigned int _dim
dimensionality of the mesh
std::vector< Point > _c1
lists of opposite corners
const unsigned int _nbox
number of boxes
const Real _outside
values outside the boxes
std::vector< Point > _c2

Member Data Documentation

std::vector<Point> MultiBoundingBoxIC::_c1
protected

lists of opposite corners

Definition at line 33 of file MultiBoundingBoxIC.h.

Referenced by value().

std::vector<Point> MultiBoundingBoxIC::_c2
protected

Definition at line 34 of file MultiBoundingBoxIC.h.

Referenced by MultiBoundingBoxIC(), and value().

const unsigned int MultiBoundingBoxIC::_dim
protected

dimensionality of the mesh

Definition at line 41 of file MultiBoundingBoxIC.h.

Referenced by value().

std::vector<Real> MultiBoundingBoxIC::_inside
protected

values inside the boxes

Definition at line 44 of file MultiBoundingBoxIC.h.

Referenced by MultiBoundingBoxIC(), and value().

const unsigned int MultiBoundingBoxIC::_nbox
protected

number of boxes

Definition at line 38 of file MultiBoundingBoxIC.h.

Referenced by MultiBoundingBoxIC(), and value().

const Real MultiBoundingBoxIC::_outside
protected

values outside the boxes

Definition at line 47 of file MultiBoundingBoxIC.h.

Referenced by value().


The documentation for this class was generated from the following files: