https://mooseframework.inl.gov
Loading...
Searching...
No Matches
EulerAngleFileReader.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
12#include <fstream>
13
15
18{
20 params.addClassDescription("Read Euler angle data from a file and provide it to other objects.");
21 params.addRequiredParam<FileName>("file_name", "Euler angle data file name");
22 return params;
23}
24
26 : EulerAngleProvider(params), _file_name(getParam<FileName>("file_name"))
27{
28 readFile();
29}
30
31void
33{
34 // Read in Euler angles from _file_name
35 std::ifstream inFile(_file_name.c_str());
36 if (!inFile)
37 mooseError("Can't open ", _file_name);
38
39 // Skip first 4 lines
40 for (unsigned int i = 0; i < 4; ++i)
41 inFile.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
42
43 // The angle files contain a fourth column with weights that we ignore in this version
44 Real weight;
45
46 // Loop over grains
48 while (inFile >> a.phi1 >> a.Phi >> a.phi2 >> weight)
49 _angles.push_back(EulerAngles(a));
50}
registerMooseObject("SolidMechanicsApp", EulerAngleFileReader)
Read a set of Euler angles from a file.
EulerAngleFileReader(const InputParameters &parameters)
static InputParameters validParams()
Abstract base class for user objects that implement the Euler Angle provider interface.
std::vector< EulerAngles > & _angles
static InputParameters validParams()
Euler angle triplet.
Definition EulerAngles.h:25
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void mooseError(Args &&... args) const