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

Read a set of Euler angles from a file. More...

#include <EulerAngleFileReader.h>

Inheritance diagram for EulerAngleFileReader:
[legend]

Public Member Functions

 EulerAngleFileReader (const InputParameters &parameters)
 
virtual const EulerAnglesgetEulerAngles (unsigned int) const
 
virtual unsigned int getGrainNum () const
 
virtual void initialize ()
 
virtual void execute ()
 
virtual void finalize ()
 

Protected Member Functions

void readFile ()
 

Protected Attributes

FileName _file_name
 
std::vector< EulerAngles_angles
 

Detailed Description

Read a set of Euler angles from a file.

Definition at line 25 of file EulerAngleFileReader.h.

Constructor & Destructor Documentation

◆ EulerAngleFileReader()

EulerAngleFileReader::EulerAngleFileReader ( const InputParameters &  parameters)

Definition at line 26 of file EulerAngleFileReader.C.

27  : EulerAngleProvider(params), _file_name(getParam<FileName>("file_name"))
28 {
29  readFile();
30 }
EulerAngleProvider(const InputParameters &parameters)

Member Function Documentation

◆ execute()

virtual void EulerAngleFileReader::execute ( )
inlinevirtual

Definition at line 34 of file EulerAngleFileReader.h.

34 {}

◆ finalize()

virtual void EulerAngleFileReader::finalize ( )
inlinevirtual

Definition at line 35 of file EulerAngleFileReader.h.

35 {}

◆ getEulerAngles()

const EulerAngles & EulerAngleFileReader::getEulerAngles ( unsigned int  i) const
virtual

Implements EulerAngleProvider.

Definition at line 39 of file EulerAngleFileReader.C.

40 {
41  mooseAssert(i < getGrainNum(), "Requesting Euler angles for an invalid grain id");
42  return _angles[i];
43 }
virtual unsigned int getGrainNum() const
std::vector< EulerAngles > _angles

◆ getGrainNum()

unsigned int EulerAngleFileReader::getGrainNum ( ) const
virtual

Implements EulerAngleProvider.

Definition at line 33 of file EulerAngleFileReader.C.

Referenced by getEulerAngles().

34 {
35  return _angles.size();
36 }
std::vector< EulerAngles > _angles

◆ initialize()

virtual void EulerAngleFileReader::initialize ( )
inlinevirtual

Definition at line 33 of file EulerAngleFileReader.h.

33 {}

◆ readFile()

void EulerAngleFileReader::readFile ( )
protected

Definition at line 46 of file EulerAngleFileReader.C.

Referenced by EulerAngleFileReader().

47 {
48  // Read in Euler angles from _file_name
49  std::ifstream inFile(_file_name.c_str());
50  if (!inFile)
51  mooseError("Can't open ", _file_name);
52 
53  // Skip first 4 lines
54  for (unsigned int i = 0; i < 4; ++i)
55  inFile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
56 
57  // The angle files contain a fourth column with weights that we ignore in this version
58  Real weight;
59 
60  // Loop over grains
61  EulerAngles a;
62  while (inFile >> a.phi1 >> a.Phi >> a.phi2 >> weight)
63  _angles.push_back(EulerAngles(a));
64 }
Euler angle triplet.
Definition: EulerAngles.h:22
std::vector< EulerAngles > _angles

Member Data Documentation

◆ _angles

std::vector<EulerAngles> EulerAngleFileReader::_angles
protected

Definition at line 41 of file EulerAngleFileReader.h.

Referenced by getEulerAngles(), getGrainNum(), and readFile().

◆ _file_name

FileName EulerAngleFileReader::_file_name
protected

Definition at line 40 of file EulerAngleFileReader.h.

Referenced by readFile().


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