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 24 of file ComputeGrainCenterUserObject.h.

Constructor & Destructor Documentation

◆ ComputeGrainCenterUserObject()

ComputeGrainCenterUserObject::ComputeGrainCenterUserObject ( const InputParameters &  parameters)

Definition at line 24 of file ComputeGrainCenterUserObject.C.

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

Member Function Documentation

◆ execute()

void ComputeGrainCenterUserObject::execute ( )
virtual

Definition at line 46 of file ComputeGrainCenterUserObject.C.

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

◆ finalize()

void ComputeGrainCenterUserObject::finalize ( )
virtual

Definition at line 59 of file ComputeGrainCenterUserObject.C.

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

◆ getGrainCenters()

const std::vector< Point > & ComputeGrainCenterUserObject::getGrainCenters ( ) const

Definition at line 87 of file ComputeGrainCenterUserObject.C.

88 {
89  return _grain_centers;
90 }

◆ getGrainVolumes()

const std::vector< Real > & ComputeGrainCenterUserObject::getGrainVolumes ( ) const

Definition at line 81 of file ComputeGrainCenterUserObject.C.

82 {
83  return _grain_volumes;
84 }

◆ initialize()

void ComputeGrainCenterUserObject::initialize ( )
virtual

Definition at line 39 of file ComputeGrainCenterUserObject.C.

40 {
41  for (unsigned int i = 0; i < _ncomp; ++i)
42  _grain_data[i] = 0;
43 }
std::vector< Real > _grain_data
storing volumes and centers of all the grains

◆ threadJoin()

void ComputeGrainCenterUserObject::threadJoin ( const UserObject &  y)
virtual

Definition at line 73 of file ComputeGrainCenterUserObject.C.

74 {
75  const ComputeGrainCenterUserObject & pps = static_cast<const ComputeGrainCenterUserObject &>(y);
76  for (unsigned int i = 0; i < _ncomp; ++i)
77  _grain_data[i] += pps._grain_data[i];
78 }
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

◆ _grain_centers

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

Definition at line 45 of file ComputeGrainCenterUserObject.h.

Referenced by finalize(), and getGrainCenters().

◆ _grain_data

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

storing volumes and centers of all the grains

Definition at line 43 of file ComputeGrainCenterUserObject.h.

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

◆ _grain_volumes

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

Definition at line 44 of file ComputeGrainCenterUserObject.h.

Referenced by finalize(), and getGrainVolumes().

◆ _ncomp

unsigned int ComputeGrainCenterUserObject::_ncomp
protected

Definition at line 41 of file ComputeGrainCenterUserObject.h.

Referenced by initialize(), and threadJoin().

◆ _ncrys

unsigned int ComputeGrainCenterUserObject::_ncrys
protected

Definition at line 39 of file ComputeGrainCenterUserObject.h.

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

◆ _qp

unsigned int ComputeGrainCenterUserObject::_qp
protected

Definition at line 38 of file ComputeGrainCenterUserObject.h.

Referenced by execute().

◆ _vals

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

Definition at line 40 of file ComputeGrainCenterUserObject.h.

Referenced by ComputeGrainCenterUserObject(), and execute().


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