https://mooseframework.inl.gov
Protected Member Functions | Protected Attributes | List of all members
EBSDMeshErrorTest Class Reference

#include <EBSDMeshErrorTest.h>

Inheritance diagram for EBSDMeshErrorTest:
[legend]

Protected Member Functions

void SetUp ()
 
template<typename T >
void testParam (unsigned int nparam, const char **param_list, std::string name)
 

Protected Attributes

std::shared_ptr< MooseApp_app
 
Factory_factory
 

Detailed Description

Definition at line 23 of file EBSDMeshErrorTest.h.

Member Function Documentation

◆ SetUp()

void EBSDMeshErrorTest::SetUp ( )
inlineprotected

Definition at line 26 of file EBSDMeshErrorTest.h.

27  {
28  const char * argv[2] = {"foo", "\0"};
29  _app = Moose::createMooseApp("PhaseFieldApp", 1, (char **)argv);
30  _factory = &_app->getFactory();
31  }
std::shared_ptr< MooseApp > createMooseApp(const std::string &default_app_type, int argc, char *argv[])
std::shared_ptr< MooseApp > _app

◆ testParam()

template<typename T >
void EBSDMeshErrorTest::testParam ( unsigned int  nparam,
const char **  param_list,
std::string  name 
)
inlineprotected

Definition at line 34 of file EBSDMeshErrorTest.h.

35  {
36  for (unsigned int i = 0; i < nparam; ++i)
37  {
38  // create a unique name
39  std::ostringstream oss;
40  oss << name << "_" << i;
41 
42  // generate input parameter set
44  params.addPrivateParam("_moose_app", _app.get());
45  params.set<std::string>("_object_name") = oss.str();
46  params.set<std::string>("_type") = "EBSDMeshGenerator";
47 
48  // set a single parameter
49  params.set<T>(param_list[i]) = T(1.0);
50 
51  // set filename (is a required param but not used in these tests)
52  params.set<FileName>("filename") = "DUMMY";
53 
54  try
55  {
56  // construct mesh object
57  auto mesh = std::make_unique<EBSDMeshGenerator>(params);
58  // TODO: fix and uncomment this - it was missing before.
59  // FAIL() << "mesh construction should have failed but didn't";
60  }
61  catch (const std::exception & e)
62  {
63  std::string msg(e.what());
64  ASSERT_TRUE(
65  msg.find("Do not specify mesh geometry information, it is read from the EBSD file.") !=
66  std::string::npos)
67  << "failed with unexpected error: " << msg;
68  }
69  }
70  }
static InputParameters validParams()
void addPrivateParam(const std::string &name, const T &value)
T & set(const std::string &name, bool quiet_mode=false)
MeshBase & mesh
const std::string name
Definition: Setup.h:20
std::shared_ptr< MooseApp > _app

Member Data Documentation

◆ _app

std::shared_ptr<MooseApp> EBSDMeshErrorTest::_app
protected

Definition at line 72 of file EBSDMeshErrorTest.h.

Referenced by SetUp(), and testParam().

◆ _factory

Factory* EBSDMeshErrorTest::_factory
protected

Definition at line 73 of file EBSDMeshErrorTest.h.

Referenced by SetUp().


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