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

This UserObject computes a volumes and centers of grains. More...

#include <ComputeGrainCenterUserObject.h>

Inheritance diagram for ComputeGrainCenterUserObject:
[legend]

Public Member Functions

 ComputeGrainCenterUserObject (const InputParameters &parameters)
 
virtual void initialize ()
 
virtual void execute ()
 
virtual void threadJoin (const UserObject &y)
 
virtual void finalize ()
 
const std::vector< Real > & getGrainVolumes () const
 
const std::vector< Point > & getGrainCenters () const
 

Protected Attributes

unsigned int _qp
 
unsigned int _ncrys
 
std::vector< const VariableValue * > _vals
 
unsigned int _ncomp
 
std::vector< Real > _grain_data
 storing volumes and centers of all the grains More...
 
std::vector< Real > _grain_volumes
 
std::vector< Point > _grain_centers
 

Detailed Description

This UserObject computes a volumes and centers of grains.

Definition at line 21 of file ComputeGrainCenterUserObject.h.

Constructor & Destructor Documentation

ComputeGrainCenterUserObject::ComputeGrainCenterUserObject ( const InputParameters &  parameters)

Definition at line 22 of file ComputeGrainCenterUserObject.C.

23  : ElementUserObject(parameters),
24  _ncrys(coupledComponents("etas")), // determine number of grains from the number of names passed
25  // in. Note this is the actual number -1
26  _vals(_ncrys), // Size variable arrays
27  _ncomp(4 * _ncrys),
31 {
32  for (unsigned int i = 0; i < _ncrys; ++i)
33  _vals[i] = &coupledValue("etas", i);
34 }
std::vector< Real > _grain_data
storing volumes and centers of all the grains
std::vector< const VariableValue * > _vals

Member Function Documentation

void ComputeGrainCenterUserObject::execute ( )
virtual

Definition at line 44 of file ComputeGrainCenterUserObject.C.

45 {
46  for (unsigned int i = 0; i < _ncrys; ++i)
47  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
48  {
49  _grain_data[4 * i + 0] += _JxW[_qp] * _coord[_qp] * (*_vals[i])[_qp];
50  _grain_data[4 * i + 1] += _JxW[_qp] * _coord[_qp] * _q_point[_qp](0) * (*_vals[i])[_qp];
51  _grain_data[4 * i + 2] += _JxW[_qp] * _coord[_qp] * _q_point[_qp](1) * (*_vals[i])[_qp];
52  _grain_data[4 * i + 3] += _JxW[_qp] * _coord[_qp] * _q_point[_qp](2) * (*_vals[i])[_qp];
53  }
54 }
std::vector< Real > _grain_data
storing volumes and centers of all the grains
std::vector< const VariableValue * > _vals
void ComputeGrainCenterUserObject::finalize ( )
virtual

Definition at line 57 of file ComputeGrainCenterUserObject.C.

58 {
59  gatherSum(_grain_data);
60 
61  for (unsigned int i = 0; i < _ncrys; ++i)
62  {
63  _grain_volumes[i] = _grain_data[4 * i + 0];
64  _grain_centers[i](0) = _grain_data[4 * i + 1] / _grain_volumes[i];
65  _grain_centers[i](1) = _grain_data[4 * i + 2] / _grain_volumes[i];
66  _grain_centers[i](2) = _grain_data[4 * i + 3] / _grain_volumes[i];
67  }
68 }
std::vector< Real > _grain_data
storing volumes and centers of all the grains
const std::vector< Point > & ComputeGrainCenterUserObject::getGrainCenters ( ) const

Definition at line 85 of file ComputeGrainCenterUserObject.C.

86 {
87  return _grain_centers;
88 }
const std::vector< Real > & ComputeGrainCenterUserObject::getGrainVolumes ( ) const

Definition at line 79 of file ComputeGrainCenterUserObject.C.

80 {
81  return _grain_volumes;
82 }
void ComputeGrainCenterUserObject::initialize ( )
virtual

Definition at line 37 of file ComputeGrainCenterUserObject.C.

38 {
39  for (unsigned int i = 0; i < _ncomp; ++i)
40  _grain_data[i] = 0;
41 }
std::vector< Real > _grain_data
storing volumes and centers of all the grains
void ComputeGrainCenterUserObject::threadJoin ( const UserObject &  y)
virtual

Definition at line 71 of file ComputeGrainCenterUserObject.C.

72 {
73  const ComputeGrainCenterUserObject & pps = static_cast<const ComputeGrainCenterUserObject &>(y);
74  for (unsigned int i = 0; i < _ncomp; ++i)
75  _grain_data[i] += pps._grain_data[i];
76 }
std::vector< Real > _grain_data
storing volumes and centers of all the grains
This UserObject computes a volumes and centers of grains.

Member Data Documentation

std::vector<Point> ComputeGrainCenterUserObject::_grain_centers
protected

Definition at line 42 of file ComputeGrainCenterUserObject.h.

Referenced by finalize(), and getGrainCenters().

std::vector<Real> ComputeGrainCenterUserObject::_grain_data
protected

storing volumes and centers of all the grains

Definition at line 40 of file ComputeGrainCenterUserObject.h.

Referenced by execute(), finalize(), initialize(), and threadJoin().

std::vector<Real> ComputeGrainCenterUserObject::_grain_volumes
protected

Definition at line 41 of file ComputeGrainCenterUserObject.h.

Referenced by finalize(), and getGrainVolumes().

unsigned int ComputeGrainCenterUserObject::_ncomp
protected

Definition at line 38 of file ComputeGrainCenterUserObject.h.

Referenced by initialize(), and threadJoin().

unsigned int ComputeGrainCenterUserObject::_ncrys
protected

Definition at line 36 of file ComputeGrainCenterUserObject.h.

Referenced by ComputeGrainCenterUserObject(), execute(), and finalize().

unsigned int ComputeGrainCenterUserObject::_qp
protected

Definition at line 35 of file ComputeGrainCenterUserObject.h.

Referenced by execute().

std::vector<const VariableValue *> ComputeGrainCenterUserObject::_vals
protected

Definition at line 37 of file ComputeGrainCenterUserObject.h.

Referenced by ComputeGrainCenterUserObject(), and execute().


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