forked from idaholab/moose
/
Moose.C
578 lines (481 loc) · 23.6 KB
/
Moose.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#include "libmesh/petsc_macro.h"
#include "libmesh/libmesh_config.h"
#include "libmesh/petsc_vector.h"
#include "libmesh/petsc_matrix.h"
#include <petscsnes.h>
#include "Moose.h"
#include "MooseApp.h"
#include "ActionWarehouse.h"
#include "ActionFactory.h"
#include "AuxiliarySystem.h"
#include "Factory.h"
#include "PetscSupport.h"
#include "Syntax.h"
#include "MooseSyntax.h"
#include <unistd.h>
// Define the available execute flags for MOOSE. The flags using a hex value are setup to retain the
// same numbers that were utilized with older versions of MOOSE for keeping existing applications
// working using the deprecated flags. In the future, as in the EXEC_SAME_AS_MULTIAPP flag, there is
// no reason to keep these flags bitwise comparable or to assigned an id because the MultiMooseEnum
// that is used to store these has convenience methods for determining the what flags are active.
const ExecFlagType EXEC_NONE("NONE", 0x00); // 0
const ExecFlagType EXEC_INITIAL("INITIAL", 0x01); // 1
const ExecFlagType EXEC_LINEAR("LINEAR", 0x02); // 2
const ExecFlagType EXEC_NONLINEAR("NONLINEAR", 0x04); // 4
const ExecFlagType EXEC_TIMESTEP_END("TIMESTEP_END", 0x08); // 8
const ExecFlagType EXEC_TIMESTEP_BEGIN("TIMESTEP_BEGIN", 0x10); // 16
const ExecFlagType EXEC_FINAL("FINAL", 0x20); // 32
const ExecFlagType EXEC_FORCED("FORCED", 0x40); // 64
const ExecFlagType EXEC_FAILED("FAILED", 0x80); // 128
const ExecFlagType EXEC_CUSTOM("CUSTOM", 0x100); // 256
const ExecFlagType EXEC_SUBDOMAIN("SUBDOMAIN", 0x200); // 512
const ExecFlagType EXEC_PRE_DISPLACE("PRE_DISPLACE");
const ExecFlagType EXEC_SAME_AS_MULTIAPP("SAME_AS_MULTIAPP");
const ExecFlagType EXEC_PRE_MULTIAPP_SETUP("PRE_MULTIAPP_SETUP");
const ExecFlagType EXEC_TRANSFER("TRANSFER");
void
MooseVecView(NumericVector<Number> & vector)
{
PetscVector<Number> & petsc_vec = static_cast<PetscVector<Number> &>(vector);
VecView(petsc_vec.vec(), 0);
}
void
MooseMatView(SparseMatrix<Number> & mat)
{
PetscMatrix<Number> & petsc_mat = static_cast<PetscMatrix<Number> &>(mat);
MatView(petsc_mat.mat(), 0);
}
namespace Moose
{
void associateSyntaxInner(Syntax & syntax, ActionFactory & action_factory);
void
registerAll(Factory & f, ActionFactory & af, Syntax & s)
{
registerObjects(f, {"MooseApp"});
associateSyntaxInner(s, af);
registerActions(s, af, {"MooseApp"});
registerExecFlags(f);
}
void
registerObjects(Factory & factory)
{
mooseDeprecated("use registerAll instead of registerObjects");
registerObjects(factory, {"MooseApp"});
}
void
registerObjects(Factory & factory, const std::set<std::string> & obj_labels)
{
Registry::registerObjectsTo(factory, obj_labels);
}
void
addActionTypes(Syntax & syntax)
{
/**
* The (optional) last param here indicates whether the task should trigger an Action auto-build.
* If a task is marked as "true". Then MOOSE will attempt to build the associated Action if one is
* not supplied by some other means (usually through the input file or custom Action). Only
* Actions that do not have required parameters and have defaults for all optional parameters can
* be built automatically (See ActionWarehouse.C).
*
* Note: Many of the actions in the "Minimal Problem" section are marked as false. However, we
* can generally force creation of these "Action"s as needed by registering them to syntax that we
* expect to see even if those "Action"s don't normally pick up parameters from the input file.
*/
// clang-format off
/**************************/
/**** Register Actions ****/
/**************************/
registerMooseObjectTask("create_problem", Problem, false);
registerMooseObjectTask("setup_executioner", Executioner, false);
// This task does not construct an object, but it needs all of the parameters that
// would normally be used to construct an object.
registerMooseObjectTask("determine_system_type", Executioner, true);
registerMooseObjectTask("setup_mesh", MooseMesh, false);
registerMooseObjectTask("set_mesh_base", MooseMesh, false);
registerMooseObjectTask("init_mesh", MooseMesh, false);
registerMooseObjectTask("add_mesh_modifier", MeshModifier, false);
registerMooseObjectTask("add_mesh_generator", MeshGenerator, false);
registerMooseObjectTask("add_kernel", Kernel, false);
appendMooseObjectTask ("add_kernel", EigenKernel);
appendMooseObjectTask ("add_kernel", VectorKernel);
appendMooseObjectTask ("add_kernel", ArrayKernel);
registerMooseObjectTask("add_nodal_kernel", NodalKernel, false);
registerMooseObjectTask("add_material", Material, false);
registerMooseObjectTask("add_bc", BoundaryCondition, false);
registerMooseObjectTask("add_function", Function, false);
registerMooseObjectTask("add_distribution", Distribution, false);
registerMooseObjectTask("add_sampler", Sampler, false);
registerMooseObjectTask("add_aux_kernel", AuxKernel, false);
appendMooseObjectTask ("add_aux_kernel", VectorAuxKernel);
registerMooseObjectTask("add_elemental_field_variable", AuxKernel, false);
registerMooseObjectTask("add_scalar_kernel", ScalarKernel, false);
registerMooseObjectTask("add_aux_scalar_kernel", AuxScalarKernel, false);
registerMooseObjectTask("add_dirac_kernel", DiracKernel, false);
registerMooseObjectTask("add_dg_kernel", DGKernel, false);
registerMooseObjectTask("add_interface_kernel", InterfaceKernel, false);
appendMooseObjectTask ("add_interface_kernel", VectorInterfaceKernel);
registerMooseObjectTask("add_constraint", Constraint, false);
registerMooseObjectTask("add_ic", InitialCondition, false);
appendMooseObjectTask ("add_ic", ScalarInitialCondition);
registerMooseObjectTask("add_damper", Damper, false);
registerMooseObjectTask("setup_predictor", Predictor, false);
registerMooseObjectTask("setup_time_stepper", TimeStepper, false);
registerMooseObjectTask("setup_time_integrator", TimeIntegrator, false);
registerMooseObjectTask("add_preconditioning", MoosePreconditioner, false);
registerMooseObjectTask("add_field_split", Split, false);
registerMooseObjectTask("add_user_object", UserObject, false);
appendMooseObjectTask ("add_user_object", Postprocessor);
registerMooseObjectTask("add_postprocessor", Postprocessor, false);
registerMooseObjectTask("add_vector_postprocessor", VectorPostprocessor, false);
registerMooseObjectTask("add_indicator", Indicator, false);
registerMooseObjectTask("add_marker", Marker, false);
registerMooseObjectTask("add_multi_app", MultiApp, false);
registerMooseObjectTask("add_transfer", Transfer, false);
registerMooseObjectTask("add_output", Output, false);
registerMooseObjectTask("add_control", Control, false);
registerMooseObjectTask("add_partitioner", MoosePartitioner, false);
// clang-format on
registerTask("dynamic_object_registration", false);
registerTask("common_output", true);
registerTask("setup_recover_file_base", true);
registerTask("add_bounds_vectors", false);
registerTask("add_periodic_bc", false);
registerTask("add_aux_variable", false);
registerTask("add_external_aux_variables", true);
registerTask("add_variable", false);
registerTask("execute_mesh_modifiers", false);
registerTask("execute_mesh_generators", true);
registerTask("uniform_refine_mesh", false);
registerTask("prepare_mesh", false);
registerTask("delete_remote_elements_post_equation_systems_init", false);
registerTask("setup_mesh_complete", true); // calls prepare
registerTask("add_geometric_rm", false);
registerTask("attach_geometric_rm", true);
registerTask("init_displaced_problem", false);
registerTask("add_algebraic_rm", false);
registerTask("attach_algebraic_rm", true);
registerTask("add_coupling_rm", false);
registerTask("attach_coupling_rm", true);
registerTask("init_problem", true);
registerTask("check_copy_nodal_vars", true);
registerTask("copy_nodal_vars", true);
registerTask("copy_nodal_aux_vars", true);
registerTask("setup_postprocessor_data", false);
registerTask("setup_dampers", true);
registerTask("check_integrity", true);
registerTask("check_integrity_early", true);
registerTask("setup_quadrature", true);
/// Additional Actions
registerTask("no_action", false); // Used for Empty Action placeholders
registerTask("set_global_params", false);
registerTask("setup_adaptivity", false);
registerTask("meta_action", false);
registerTask("setup_residual_debug", false);
registerTask("setup_oversampling", false);
registerTask("deprecated_block", false);
registerTask("set_adaptivity_options", false);
registerTask("add_mortar_interface", false);
// Dummy Actions (useful for sync points in the dependencies)
registerTask("setup_function_complete", false);
registerTask("setup_variable_complete", false);
registerTask("ready_to_init", true);
// Output related actions
registerTask("add_output_aux_variables", true);
registerTask("check_output", true);
registerTask("create_problem_default", true);
registerTask("create_problem_custom", false);
registerTask("create_problem_complete", false);
/**************************/
/****** Dependencies ******/
/**************************/
/**
* The following is the default set of action dependencies for a basic MOOSE problem. The
* formatting of this string is important. Each line represents a set of dependencies that depend
* on the previous line. Items on the same line have equal weight and can be executed in any
* order.
*
* Additional dependencies can be inserted later inside of user applications with calls to
* ActionWarehouse::addDependency("task", "pre_req")
*/
syntax.addDependencySets("(meta_action)"
"(dynamic_object_registration)"
"(common_output)"
"(set_global_params)"
"(setup_recover_file_base)"
"(setup_mesh)"
"(add_mesh_generator)"
"(execute_mesh_generators)"
"(set_mesh_base)"
"(check_copy_nodal_vars)"
"(add_partitioner)"
"(add_geometric_rm)"
"(attach_geometric_rm)"
"(init_mesh)"
"(prepare_mesh)"
"(add_mesh_modifier)"
"(execute_mesh_modifiers)"
"(add_mortar_interface)"
"(uniform_refine_mesh)"
"(setup_mesh_complete)"
"(determine_system_type)"
"(create_problem)"
"(create_problem_custom)"
"(create_problem_default)"
"(create_problem_complete)"
"(setup_postprocessor_data)"
"(setup_time_integrator)"
"(setup_executioner)"
"(check_integrity_early)"
"(setup_predictor)"
"(init_displaced_problem)"
"(add_aux_variable, add_variable, add_elemental_field_variable,"
" add_external_aux_variables)"
"(setup_variable_complete)"
"(setup_quadrature)"
"(add_function)"
"(add_distribution)"
"(add_sampler)"
"(add_periodic_bc)"
"(add_user_object)"
"(setup_function_complete)"
"(setup_adaptivity)"
"(set_adaptivity_options)"
"(add_ic)"
"(add_constraint, add_field_split)"
"(add_preconditioning)"
"(setup_time_stepper)"
"(ready_to_init)"
"(setup_dampers)"
"(setup_residual_debug)"
"(add_bounds_vectors)"
"(add_multi_app)"
"(add_transfer)"
"(copy_nodal_vars, copy_nodal_aux_vars)"
"(add_material)"
"(add_output_aux_variables)"
"(add_algebraic_rm)"
"(add_coupling_rm)"
"(attach_algebraic_rm)"
"(attach_coupling_rm)"
"(init_problem)"
"(delete_remote_elements_post_equation_systems_init)"
"(add_output)"
"(add_postprocessor)"
"(add_vector_postprocessor)" // MaterialVectorPostprocessor requires this
// to be after material objects are created.
"(add_aux_kernel, add_bc, add_damper, add_dirac_kernel, add_kernel,"
" add_nodal_kernel, add_dg_kernel, add_interface_kernel,"
" add_scalar_kernel, add_aux_scalar_kernel, add_indicator, add_marker)"
"(add_control)"
"(check_output)"
"(check_integrity)");
}
/**
* Multiple Action class can be associated with a single input file section, in which case all
* associated Actions will be created and "acted" on when the associated input file section is
* seen.*
*
* Example:
* "setup_mesh" <-----------> SetupMeshAction <---------
* \
* [Mesh]
* /
* "setup_mesh_complete" <---> SetupMeshCompleteAction <-
*
*
* Action classes can also be registered to act on more than one input file section for a different
* task if similar logic can work in multiple cases
*
* Example:
* "add_variable" <----- -> [Variables/ *]
* \ /
* CopyNodalVarsAction
* / \
* "add_aux_variable" <- -> [AuxVariables/ *]
*
*
* Note: Placeholder "no_action" actions must be put in places where it is possible to match an
* object with a star or a more specific parent later on. (i.e. where one needs to negate the
* '*' matching prematurely).
*/
void
registerActions(Syntax & syntax, ActionFactory & action_factory)
{
mooseDeprecated("use registerAll instead of registerActions");
registerActions(syntax, action_factory, {"MooseApp"});
}
void
registerActions(Syntax & syntax,
ActionFactory & action_factory,
const std::set<std::string> & obj_labels)
{
Registry::registerActionsTo(action_factory, obj_labels);
// TODO: Why is this here?
registerTask("finish_input_file_output", false);
}
void
registerExecFlags(Factory & factory)
{
registerExecFlag(EXEC_NONE);
registerExecFlag(EXEC_INITIAL);
registerExecFlag(EXEC_LINEAR);
registerExecFlag(EXEC_NONLINEAR);
registerExecFlag(EXEC_TIMESTEP_END);
registerExecFlag(EXEC_TIMESTEP_BEGIN);
registerExecFlag(EXEC_FINAL);
registerExecFlag(EXEC_FORCED);
registerExecFlag(EXEC_FAILED);
registerExecFlag(EXEC_CUSTOM);
registerExecFlag(EXEC_TRANSFER);
registerExecFlag(EXEC_SUBDOMAIN);
registerExecFlag(EXEC_PRE_DISPLACE);
registerExecFlag(EXEC_SAME_AS_MULTIAPP);
registerExecFlag(EXEC_PRE_MULTIAPP_SETUP);
}
void
associateSyntaxInner(Syntax & syntax, ActionFactory & /*action_factory*/)
{
/**
* Note: the optional third parameter is used to differentiate which task is
* satisfied based on the syntax encountered for classes which are registered
* to satisfy more than one task
*/
registerSyntaxTask("CopyNodalVarsAction", "Variables/*", "check_copy_nodal_vars");
registerSyntaxTask("CopyNodalVarsAction", "Variables/*", "copy_nodal_vars");
registerSyntaxTask("CopyNodalVarsAction", "AuxVariables/*", "check_copy_nodal_vars");
registerSyntaxTask("CopyNodalVarsAction", "AuxVariables/*", "copy_nodal_aux_vars");
registerSyntaxTask("AddKernelAction", "Kernels/*", "add_kernel");
registerSyntaxTask("AddNodalKernelAction", "NodalKernels/*", "add_nodal_kernel");
registerSyntaxTask("AddKernelAction", "AuxKernels/*", "add_aux_kernel");
registerSyntaxTask("AddKernelAction", "Bounds/*", "add_aux_kernel");
registerSyntaxTask("AddScalarKernelAction", "ScalarKernels/*", "add_scalar_kernel");
registerSyntaxTask("AddScalarKernelAction", "AuxScalarKernels/*", "add_aux_scalar_kernel");
registerSyntaxTask("AddBCAction", "BCs/*", "add_bc");
registerSyntax("CreateProblemAction", "Problem");
registerSyntax("DynamicObjectRegistrationAction", "Problem");
registerSyntax("SetupMeshAction", "Mesh");
registerSyntax("SetupMeshCompleteAction", "Mesh");
registerSyntax("CreateDisplacedProblemAction", "Mesh");
registerSyntax("DisplayGhostingAction", "Mesh");
registerSyntax("AddMeshModifierAction", "MeshModifiers/*");
registerSyntax("AddMeshGeneratorAction", "MeshGenerators/*");
registerSyntax("AddFunctionAction", "Functions/*");
syntax.registerSyntaxType("Functions/*", "FunctionName");
registerSyntax("GlobalParamsAction", "GlobalParams");
registerSyntax("AddDistributionAction", "Distributions/*");
registerSyntax("AddSamplerAction", "Samplers/*");
registerSyntax("SetupDebugAction", "Debug");
registerSyntax("SetupResidualDebugAction", "Debug");
/// Variable/AuxVariable Actions
registerSyntax("AddVariableAction", "Variables/*");
syntax.registerSyntaxType("Variables/*", "VariableName");
syntax.registerSyntaxType("Variables/*", "NonlinearVariableName");
registerSyntax("AddICAction", "Variables/*/InitialCondition");
registerSyntax("AddAuxVariableAction", "AuxVariables/*");
syntax.registerSyntaxType("AuxVariables/*", "VariableName");
syntax.registerSyntaxType("AuxVariables/*", "AuxVariableName");
registerSyntax("AddICAction", "AuxVariables/*/InitialCondition");
registerSyntaxTask("EmptyAction", "BCs/Periodic", "no_action"); // placeholder
registerSyntax("AddPeriodicBCAction", "BCs/Periodic/*");
registerSyntaxTask("AddInitialConditionAction", "ICs/*", "add_ic");
registerSyntax("AddMaterialAction", "Materials/*");
registerSyntax("SetupPostprocessorDataAction", "Postprocessors/*");
registerSyntax("AddPostprocessorAction", "Postprocessors/*");
syntax.registerSyntaxType("Postprocessors/*", "PostprocessorName");
syntax.registerSyntaxType("Postprocessors/*", "UserObjectName");
registerSyntax("AddVectorPostprocessorAction", "VectorPostprocessors/*");
syntax.registerSyntaxType("VectorPostprocessors/*", "VectorPostprocessorName");
registerSyntax("AddDamperAction", "Dampers/*");
registerSyntax("AddOutputAction", "Outputs/*");
registerSyntax("CommonOutputAction", "Outputs");
syntax.registerSyntaxType("Outputs/*", "OutputName");
// Note: Preconditioner Actions will be built by this setup action
registerSyntax("SetupPreconditionerAction", "Preconditioning/*");
registerSyntax("AddFieldSplitAction", "Preconditioning/*/*");
registerSyntax("CreateExecutionerAction", "Executioner");
registerSyntax("SetupTimeStepperAction", "Executioner/TimeStepper");
registerSyntax("SetupTimeIntegratorAction", "Executioner/TimeIntegrator");
registerSyntax("SetupQuadratureAction", "Executioner/Quadrature");
registerSyntax("SetupPredictorAction", "Executioner/Predictor");
#ifdef LIBMESH_ENABLE_AMR
registerSyntax("AdaptivityAction", "Executioner/Adaptivity");
#endif
registerSyntax("PartitionerAction", "Mesh/Partitioner");
registerSyntax("AddDiracKernelAction", "DiracKernels/*");
registerSyntax("AddDGKernelAction", "DGKernels/*");
registerSyntax("AddInterfaceKernelAction", "InterfaceKernels/*");
registerSyntax("AddConstraintAction", "Constraints/*");
registerSyntax("AddUserObjectAction", "UserObjects/*");
syntax.registerSyntaxType("UserObjects/*", "UserObjectName");
registerSyntax("AddControlAction", "Controls/*");
registerSyntax("AddBoundsVectorsAction", "Bounds");
registerSyntax("AddNodalNormalsAction", "NodalNormals");
// Indicator
registerSyntax("AddElementalFieldAction", "Adaptivity/Indicators/*");
registerSyntax("AddIndicatorAction", "Adaptivity/Indicators/*");
syntax.registerSyntaxType("Adaptivity/Indicators/*", "IndicatorName");
// Marker
registerSyntax("AddElementalFieldAction", "Adaptivity/Markers/*");
registerSyntax("AddMarkerAction", "Adaptivity/Markers/*");
syntax.registerSyntaxType("Adaptivity/Markers/*", "MarkerName");
// New Adaptivity System
registerSyntax("SetAdaptivityOptionsAction", "Adaptivity");
// Deprecated Block
registerSyntax("DeprecatedBlockAction", "DeprecatedBlock");
// Multi Apps
registerSyntax("AddMultiAppAction", "MultiApps/*");
syntax.registerSyntaxType("MultiApps/*", "MultiAppName");
// Transfers
registerSyntax("AddTransferAction", "Transfers/*");
// Material derivative test
registerSyntaxTask("EmptyAction", "Debug/MaterialDerivativeTest", "no_action"); // placeholder
registerSyntax("MaterialDerivativeTestAction", "Debug/MaterialDerivativeTest/*");
addActionTypes(syntax);
}
void
associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
associateSyntaxInner(syntax, action_factory);
registerActions(syntax, action_factory);
}
void
setSolverDefaults(FEProblemBase & problem)
{
#ifdef LIBMESH_HAVE_PETSC
// May be a touch expensive to create a new DM every time, but probably safer to do it this way
Moose::PetscSupport::petscSetDefaults(problem);
#endif // LIBMESH_HAVE_PETSC
}
MPI_Comm
swapLibMeshComm(MPI_Comm new_comm)
{
#ifdef LIBMESH_HAVE_PETSC
MPI_Comm old_comm = PETSC_COMM_WORLD;
PETSC_COMM_WORLD = new_comm;
return old_comm;
#endif // LIBMESH_HAVE_PETSC
}
static bool _color_console = isatty(fileno(stdout));
bool
colorConsole()
{
return _color_console;
}
bool
setColorConsole(bool use_color, bool force)
{
_color_console = (isatty(fileno(stdout)) || force) && use_color;
return _color_console;
}
bool _warnings_are_errors = false;
bool _deprecated_is_error = false;
bool _throw_on_error = false;
} // namespace Moose