Esempio n. 1
0
void
SolidMechanicsApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  syntax.registerActionSyntax("EmptyAction", "BCs/CavityPressure");
  syntax.registerActionSyntax("CavityPressureAction", "BCs/CavityPressure/*");
  syntax.registerActionSyntax("CavityPressurePPAction", "BCs/CavityPressure/*");
  syntax.registerActionSyntax("CavityPressureUOAction", "BCs/CavityPressure/*");

  syntax.registerActionSyntax("EmptyAction", "BCs/Pressure");
  syntax.registerActionSyntax("PressureAction", "BCs/Pressure/*");

  syntax.registerActionSyntax("SolidMechanicsAction", "SolidMechanics/*");

  syntax.registerActionSyntax("JIntegralAction", "JIntegral","add_user_object");
  syntax.registerActionSyntax("JIntegralAction", "JIntegral","add_aux_variable");
  syntax.registerActionSyntax("JIntegralAction", "JIntegral","add_aux_kernel");
  syntax.registerActionSyntax("JIntegralAction", "JIntegral","add_postprocessor");

  registerAction(PressureAction, "add_bc");
  registerAction(CavityPressureAction, "add_bc");
  registerAction(CavityPressurePPAction, "add_postprocessor");
  registerAction(CavityPressureUOAction, "add_user_object");
  registerAction(SolidMechanicsAction, "add_kernel");
  registerAction(JIntegralAction, "add_user_object");
  registerAction(JIntegralAction, "add_aux_variable");
  registerAction(JIntegralAction, "add_aux_kernel");
  registerAction(JIntegralAction, "add_postprocessor");
}
Esempio n. 2
0
void
TensorMechanicsApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  syntax.registerActionSyntax("EmptyAction", "BCs/CavityPressure");
  syntax.registerActionSyntax("CavityPressureAction", "BCs/CavityPressure/*");
  syntax.registerActionSyntax("CavityPressurePPAction", "BCs/CavityPressure/*");
  syntax.registerActionSyntax("CavityPressureUOAction", "BCs/CavityPressure/*");

  syntax.registerActionSyntax("TensorMechanicsAction", "Kernels/TensorMechanics");
  syntax.registerActionSyntax("DynamicTensorMechanicsAction", "Kernels/DynamicTensorMechanics");
  syntax.registerActionSyntax("PoroMechanicsAction", "Kernels/PoroMechanics");
  syntax.registerActionSyntax("TensorMechanicsAxisymmetricRZAction", "Kernels/StressDivergence2DAxisymmetricRZ");
  syntax.registerActionSyntax("TensorMechanicsRSphericalAction", "Kernels/StressDivergence1DRSpherical");

  syntax.registerActionSyntax("EmptyAction", "BCs/Pressure");
  syntax.registerActionSyntax("PressureAction", "BCs/Pressure/*");

  registerAction(CavityPressureAction, "add_bc");
  registerAction(CavityPressurePPAction, "add_postprocessor");
  registerAction(CavityPressureUOAction, "add_user_object");
  registerAction(TensorMechanicsAction, "add_kernel");
  registerAction(DynamicTensorMechanicsAction, "add_kernel");
  registerAction(PoroMechanicsAction, "add_kernel");
  registerAction(TensorMechanicsAxisymmetricRZAction, "add_kernel");
  registerAction(TensorMechanicsRSphericalAction, "add_kernel");
  registerAction(PressureAction, "add_bc");
}
Esempio n. 3
0
void
MooseTestApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{

#undef registerAction
#define registerAction(tplt, action) action_factory.reg<tplt>(stringifyName(tplt), action)

  // and add more
  registerAction(ConvDiffMetaAction, "meta_action");
  registerAction(AddLotsOfAuxVariablesAction, "meta_action");

  registerAction(AddLotsOfDiffusion, "add_variable");
  registerAction(AddLotsOfDiffusion, "add_kernel");
  registerAction(AddLotsOfDiffusion, "add_bc");


  syntax.registerActionSyntax("ConvDiffMetaAction", "ConvectionDiffusion");
  syntax.registerActionSyntax("AddAuxVariableAction", "MoreAuxVariables/*", "add_aux_variable");
  syntax.registerActionSyntax("AddLotsOfAuxVariablesAction", "LotsOfAuxVariables/*", "add_variable");

  registerAction(ApplyCoupledVariablesTestAction, "meta_action");
  syntax.registerActionSyntax("ApplyCoupledVariablesTestAction", "ApplyInputParametersTest");

  syntax.registerActionSyntax("AddLotsOfDiffusion", "Testing/LotsOfDiffusion/*");

#undef registerAction
#define registerAction(tplt, action) action_factory.regLegacy<tplt>(stringifyName(tplt), action)
}
Esempio n. 4
0
void
MooseTestApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  // and add more
  registerAction(ConvDiffMetaAction, "meta_action");
  registerAction(AddLotsOfAuxVariablesAction, "meta_action");
  syntax.registerActionSyntax("ConvDiffMetaAction", "ConvectionDiffusion");
  syntax.registerActionSyntax("AddAuxVariableAction", "MoreAuxVariables/*", "add_aux_variable");
  syntax.registerActionSyntax("AddLotsOfAuxVariablesAction", "LotsOfAuxVariables/*", "add_variable");
}
Esempio n. 5
0
// @Function compile file
void compile(char* fname)
{
	if (-1 == syntax.init_syntax(fname))
	{
		return;
	}

	syntax.translation_unit();
	printf("%s compile success", fname);
}
Esempio n. 6
0
 void visit(Syntax Node) override {
   if (didReuseNode(Node.getId())) {
     // Node has been reused, add it to the list
     auto Start = Node.getAbsolutePositionBeforeLeadingTrivia();
     auto End = Node.getAbsoluteEndPositionAfterTrailingTrivia();
     ReusedRegions.push_back({Start, End});
   } else {
     SyntaxVisitor::visit(Node);
   }
 }
Esempio n. 7
0
void
TensorMechanicsApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  syntax.registerActionSyntax("TensorMechanicsAction", "Kernels/TensorMechanics");

  syntax.registerActionSyntax("EmptyAction", "BCs/PressureTM");
  syntax.registerActionSyntax("PressureActionTM", "BCs/PressureTM/*");

  registerAction(TensorMechanicsAction, "add_kernel");
  registerAction(PressureActionTM, "add_bc");
}
Esempio n. 8
0
void
RichardsApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  syntax.registerActionSyntax("Q2PAction", "Q2P", "add_kernel");
  syntax.registerActionSyntax("Q2PAction", "Q2P", "add_aux_variable");
  syntax.registerActionSyntax("Q2PAction", "Q2P", "add_function");
  syntax.registerActionSyntax("Q2PAction", "Q2P", "add_postprocessor");

  registerAction(Q2PAction, "add_kernel");
  registerAction(Q2PAction, "add_aux_variable");
  registerAction(Q2PAction, "add_function");
  registerAction(Q2PAction, "add_postprocessor");
}
Esempio n. 9
0
void
XFEMApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  registerTask("setup_xfem", false);
  registerAction(XFEMAction, "setup_xfem");
  syntax.addDependency("setup_xfem","setup_adaptivity");
  registerAction(XFEMAction, "add_aux_variable");
  registerAction(XFEMAction, "add_aux_kernel");

  syntax.registerActionSyntax("XFEMAction", "XFEM");
  syntax.registerActionSyntax("AddUserObjectAction", "XFEM/*");

}
Esempio n. 10
0
void
TensorMechanicsApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  syntax.registerActionSyntax("TensorMechanicsAction", "Kernels/TensorMechanics");
  syntax.registerActionSyntax("PoroMechanicsAction", "Kernels/PoroMechanics");
  syntax.registerActionSyntax("TensorMechanicsAxisymmetricRZAction", "Kernels/AxisymmetricRZ");

  syntax.registerActionSyntax("EmptyAction", "BCs/Pressure");
  syntax.registerActionSyntax("PressureAction", "BCs/Pressure/*");

  registerAction(TensorMechanicsAction, "add_kernel");
  registerAction(PoroMechanicsAction, "add_kernel");
  registerAction(TensorMechanicsAxisymmetricRZAction, "add_kernel");
  registerAction(PressureAction, "add_bc");
}
Esempio n. 11
0
Syntax syntax::format(Syntax Tree) {
  switch (Tree.getKind()) {
  case SyntaxKind::StructDecl: {
    auto Struct = Tree.castTo<StructDeclSyntax>();
    auto LeftBrace = Struct.getLeftBraceToken();
    if (!LeftBrace->LeadingTrivia.contains(TriviaKind::Newline)) {
      auto NewLeading = Trivia::newlines(1) + LeftBrace->LeadingTrivia;

      const auto NewMembers =
        format(Struct.getMembers()).castTo<DeclMembersSyntax>();

      LeftBrace = LeftBrace->withLeadingTrivia(NewLeading);

      return Struct.withMembers(NewMembers).withLeftBrace(LeftBrace);
    }
    break;
  }
  case SyntaxKind::DeclMembers: {
    auto Members = Tree.castTo<DeclMembersSyntax>();
    // TODO
    break;
  }
  default:
    return Tree;
  }

  return Tree;
}
Esempio n. 12
0
void
ContactApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  registerSyntax("ContactAction", "Contact/*");

  registerSyntax("ContactPenetrationAuxAction", "Contact/*");
  registerSyntax("ContactPenetrationVarAction", "Contact/*");

  registerSyntax("ContactPressureAuxAction", "Contact/*");
  registerSyntax("ContactPressureVarAction", "Contact/*");

  registerSyntax("NodalAreaAction", "Contact/*");
  registerSyntax("NodalAreaVarAction", "Contact/*");

  registerAction(ContactAction, "add_aux_kernel");
  registerAction(ContactAction, "add_aux_variable");
  registerAction(ContactAction, "add_dirac_kernel");

  registerTask("output_penetration_info_vars", false);
  registerAction(ContactAction, "output_penetration_info_vars");
  syntax.addDependency("output_penetration_info_vars", "add_output");

  registerAction(ContactPenetrationAuxAction, "add_aux_kernel");
  registerAction(ContactPenetrationVarAction, "add_aux_variable");

  registerAction(ContactPressureAuxAction, "add_aux_kernel");
  registerAction(ContactPressureVarAction, "add_aux_variable");

  registerAction(NodalAreaAction, "add_user_object");
  registerAction(NodalAreaVarAction, "add_aux_variable");
}
Esempio n. 13
0
void
ZapdosApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  // add actions
  registerAction(AddLotsOfDiffusion, "add_variable");
  registerAction(AddLotsOfDiffusion, "add_kernel");
  registerAction(AddLotsOfDiffusion, "add_bc");
  syntax.registerActionSyntax("AddLotsOfDiffusion", "LotsOfDiffusion");
  registerAction(AddLotsOfCoeffDiffusion, "add_variable");
  registerAction(AddLotsOfCoeffDiffusion, "add_kernel");
  registerAction(AddLotsOfCoeffDiffusion, "add_bc");
  syntax.registerActionSyntax("AddLotsOfCoeffDiffusion", "LotsOfCoeffDiffusion");
  registerAction(AddLotsOfVariables, "add_variable");
  registerAction(AddLotsOfVariables, "add_kernel");
  registerAction(AddLotsOfVariables, "add_bc");
  syntax.registerActionSyntax("AddLotsOfVariables", "LotsOfVariables");
  registerAction(AddLotsOfSources, "add_variable");
  registerAction(AddLotsOfSources, "add_kernel");
  registerAction(AddLotsOfSources, "add_bc");
  syntax.registerActionSyntax("AddLotsOfSources", "LotsOfSources");
  registerAction(AddLotsOfTimeDerivatives, "add_variable");
  registerAction(AddLotsOfTimeDerivatives, "add_kernel");
  registerAction(AddLotsOfTimeDerivatives, "add_bc");
  syntax.registerActionSyntax("AddLotsOfTimeDerivatives", "LotsOfTimeDerivatives");
  registerAction(AddLotsOfEFieldAdvection, "add_variable");
  registerAction(AddLotsOfEFieldAdvection, "add_kernel");
  registerAction(AddLotsOfEFieldAdvection, "add_bc");
  syntax.registerActionSyntax("AddLotsOfEFieldAdvection", "LotsOfEFieldAdvection");
  registerAction(AddLotsOfPotentialDrivenArtificialDiff, "add_variable");
  registerAction(AddLotsOfPotentialDrivenArtificialDiff, "add_kernel");
  registerAction(AddLotsOfPotentialDrivenArtificialDiff, "add_bc");
  syntax.registerActionSyntax("AddLotsOfPotentialDrivenArtificialDiff", "LotsOfPotentialDrivenArtificialDiff");
}
Esempio n. 14
0
void
ChemicalReactionsApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{

#undef registerAction
#define registerAction(tplt, action) action_factory.reg<tplt>(stringifyName(tplt), action)


  syntax.registerActionSyntax("AddPrimarySpeciesAction", "ReactionNetwork");
  syntax.registerActionSyntax("AddSecondarySpeciesAction", "ReactionNetwork/AqueousEquilibriumReactions");
  syntax.registerActionSyntax("AddSecondarySpeciesAction", "ReactionNetwork/SolidKineticReactions");
  syntax.registerActionSyntax("AddCoupledEqSpeciesKernelsAction", "ReactionNetwork/AqueousEquilibriumReactions");
  syntax.registerActionSyntax("AddCoupledEqSpeciesAuxKernelsAction", "ReactionNetwork/AqueousEquilibriumReactions");
  syntax.registerActionSyntax("AddCoupledSolidKinSpeciesKernelsAction", "ReactionNetwork/SolidKineticReactions");
  syntax.registerActionSyntax("AddCoupledSolidKinSpeciesAuxKernelsAction", "ReactionNetwork/SolidKineticReactions");
  registerAction(AddPrimarySpeciesAction, "add_variable");
  registerAction(AddSecondarySpeciesAction, "add_aux_variable");
  registerAction(AddCoupledEqSpeciesKernelsAction, "add_kernel");
  registerAction(AddCoupledEqSpeciesAuxKernelsAction, "add_aux_kernel");
  registerAction(AddCoupledSolidKinSpeciesKernelsAction, "add_kernel");
  registerAction(AddCoupledSolidKinSpeciesAuxKernelsAction, "add_aux_kernel");

#undef registerAction
#define registerAction(tplt, action) action_factory.regLegacy<tplt>(stringifyName(tplt), action)
}
Esempio n. 15
0
void
TrexApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  //syntax.registerActionSyntax(<File Name>, <input block/name>); 
  //registerAction(<File Name>, <type>);

  syntax.registerActionSyntax("ImageGrainVariableAction", "AuxVariables/ImageGrainVariable");
  registerAction(ImageGrainVariableAction, "add_aux_variable");

  syntax.registerActionSyntax("ImageGrainICsAction", "ICs/ImageGrainICs");
  registerAction(ImageGrainICsAction, "add_ic");

  syntax.registerActionSyntax("PointValueOnLineAction", "Postprocessors/PointValueOnLine");
  registerAction(PointValueOnLineAction, "add_postprocessor");

  syntax.registerActionSyntax("PolycrystalKernelTensorAction", "Kernels/PolycrystalKernelAniso");
  registerAction(PolycrystalKernelTensorAction, "add_kernel");
}
Esempio n. 16
0
void
MooseTestApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  // and add more
  registerAction(ConvDiffMetaAction, "meta_action");
  registerAction(AddLotsOfAuxVariablesAction, "meta_action");

  registerAction(AddLotsOfDiffusion, "add_variable");
  registerAction(AddLotsOfDiffusion, "add_kernel");
  registerAction(AddLotsOfDiffusion, "add_bc");


  syntax.registerActionSyntax("ConvDiffMetaAction", "ConvectionDiffusion");
  syntax.registerActionSyntax("AddAuxVariableAction", "MoreAuxVariables/*", "add_aux_variable");
  syntax.registerActionSyntax("AddLotsOfAuxVariablesAction", "LotsOfAuxVariables/*", "add_variable");

  registerAction(ApplyCoupledVariablesTestAction, "meta_action");
  syntax.registerActionSyntax("ApplyCoupledVariablesTestAction", "ApplyInputParametersTest");

  syntax.registerActionSyntax("AddLotsOfDiffusion", "Testing/LotsOfDiffusion/*");
}
Esempio n. 17
0
void
FluidPropertiesApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  registerSyntaxTask(
      "AddFluidPropertiesAction", "Modules/FluidProperties/*", "add_fluid_properties");

  registerMooseObjectTask("add_fluid_properties", FluidProperties, false);

  syntax.addDependency("add_fluid_properties", "init_displaced_problem");

  registerAction(AddFluidPropertiesAction, "add_fluid_properties");
}
Esempio n. 18
0
void
HeatConductionApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
#undef registerAction
#define registerAction(tplt, action) action_factory.reg<tplt>(stringifyName(tplt), action)

    // This registers an action to add the "slave_flux" vector to the system at the right time
    registerTask("add_slave_flux_vector", false);
    addTaskDependency("add_slave_flux_vector", "ready_to_init");
    addTaskDependency("init_problem", "add_slave_flux_vector");
    registerAction(AddSlaveFluxVectorAction, "add_slave_flux_vector");
    syntax.registerActionSyntax("AddSlaveFluxVectorAction", "ThermalContact/*");


    syntax.registerActionSyntax("ThermalContactAuxBCsAction",       "ThermalContact/*", "add_aux_kernel");
    syntax.registerActionSyntax("ThermalContactAuxVarsAction",      "ThermalContact/*", "add_aux_variable");
    syntax.registerActionSyntax("ThermalContactBCsAction",          "ThermalContact/*", "add_bc");
    syntax.registerActionSyntax("ThermalContactDiracKernelsAction", "ThermalContact/*", "add_dirac_kernel");
    syntax.registerActionSyntax("ThermalContactMaterialsAction",    "ThermalContact/*", "add_material");

    registerAction(ThermalContactAuxBCsAction,       "add_aux_kernel");
    registerAction(ThermalContactAuxVarsAction,      "add_aux_variable");
    registerAction(ThermalContactBCsAction,          "add_bc");
    registerAction(ThermalContactDiracKernelsAction, "add_dirac_kernel");
    registerAction(ThermalContactMaterialsAction,    "add_material");

#undef registerAction
#define registerAction(tplt, action) action_factory.regLegacy<tplt>(stringifyName(tplt), action)
}
Esempio n. 19
0
bool SyntaxParsingCache::nodeCanBeReused(const Syntax &Node, size_t NodeStart,
                                         size_t Position,
                                         SyntaxKind Kind) const {
  // Computing the value of NodeStart on the fly is faster than determining a
  // node's absolute position, but make sure the values match in an assertion
  // build
  assert(NodeStart == Node.getAbsolutePositionBeforeLeadingTrivia().getOffset());

  if (NodeStart != Position)
    return false;
  if (Node.getKind() != Kind)
    return false;

  // Node can also not be reused if an edit has been made in the next token's
  // text, e.g. because `private struct Foo {}` parses as a CodeBlockItem with a
  // StructDecl inside and `private struc Foo {}` parses as two CodeBlockItems
  // one for `private` and one for `struc Foo {}`
  size_t NextLeafNodeLength = 0;
  if (auto NextNode = Node.getData().getNextNode()) {
    auto NextLeafNode = NextNode->getFirstToken();
    auto NextRawNode = NextLeafNode->getRaw();
    assert(NextRawNode->isPresent());
    NextLeafNodeLength += NextRawNode->getTokenText().size();
    for (auto TriviaPiece : NextRawNode->getLeadingTrivia()) {
      NextLeafNodeLength += TriviaPiece.getTextLength();
    }
  }

  auto NodeEnd = NodeStart + Node.getTextLength();
  for (auto Edit : Edits) {
    // Check if this node or the trivia of the next node has been edited. If it
    // has, we cannot reuse it.
    if (Edit.intersectsOrTouchesRange(NodeStart, NodeEnd + NextLeafNodeLength))
      return false;
  }

  return true;
}
Esempio n. 20
0
StructDeclSyntax
SyntaxFactory::makeStructDecl(RC<TokenSyntax> StructToken,
                              RC<TokenSyntax> Identifier,
                              Syntax GenericParameters,
                              Syntax WhereClause, RC<TokenSyntax> LeftBrace,
                              Syntax DeclMembers, RC<TokenSyntax> RightBrace) {
  auto Raw = RawSyntax::make(SyntaxKind::StructDecl,
                             {
                               StructToken,
                               Identifier,
                               GenericParameters.getRaw(),
                               WhereClause.getRaw(),
                               LeftBrace,
                               DeclMembers.getRaw(),
                               RightBrace
                             },
                             SourcePresence::Present);
  auto Data = StructDeclSyntaxData::make(Raw);
  return StructDeclSyntax {
    Data,
    Data.get()
  };
}
Esempio n. 21
0
llvm::Optional<Syntax> SyntaxParsingCache::lookUpFrom(const Syntax &Node,
                                                      size_t NodeStart,
                                                      size_t Position,
                                                      SyntaxKind Kind) {
  if (nodeCanBeReused(Node, NodeStart, Position, Kind)) {
    return Node;
  }

  // Compute the child's position on the fly
  size_t ChildStart = NodeStart;
  for (size_t I = 0, E = Node.getNumChildren(); I < E; ++I) {
    llvm::Optional<Syntax> Child = Node.getChild(I);
    if (!Child.hasValue() || Child->isMissing()) {
      continue;
    }
    auto ChildEnd = ChildStart + Child->getTextLength();
    if (ChildStart <= Position && Position < ChildEnd) {
      return lookUpFrom(Child.getValue(), ChildStart, Position, Kind);
    }
    // The next child starts where the previous child ended
    ChildStart = ChildEnd;
  }
  return llvm::None;
}
Esempio n. 22
0
File: parse_op.cpp Progetto: 8l/zl
 virtual void parse_self(const Syntax * p) {
   if (p->is_a("bin"))
     type = Bin;
   else if (p->is_a("prefix"))
     type = Prefix;
   else if (p->is_a("postfix"))
     type = Postfix;
   else if (p->is_a("exp"))
     type = Other;
   else if (p->is_a("special"))
     type = Special;
   else
     abort();
   parse = p->arg(0);           ;
   name = parse->what();
   parse_match_op(p->arg(1));
 }
Esempio n. 23
0
void
PhaseFieldApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  syntax.registerActionSyntax("PolycrystalKernelAction", "Kernels/PolycrystalKernel");
  syntax.registerActionSyntax("PolycrystalVariablesAction", "Variables/PolycrystalVariables");
  syntax.registerActionSyntax("EmptyAction", "ICs/PolycrystalICs");  // placeholder
  syntax.registerActionSyntax("BicrystalCircleGrainICAction", "ICs/PolycrystalICs/BicrystalCircleGrainIC");
  syntax.registerActionSyntax("BicrystalBoundingBoxICAction", "ICs/PolycrystalICs/BicrystalBoundingBoxIC");
  syntax.registerActionSyntax("Tricrystal2CircleGrainsICAction", "ICs/PolycrystalICs/Tricrystal2CircleGrainsIC");
  syntax.registerActionSyntax("PolycrystalHexGrainICAction", "ICs/PolycrystalICs/PolycrystalHexGrainIC");
  syntax.registerActionSyntax("PolycrystalVoronoiICAction", "ICs/PolycrystalICs/PolycrystalVoronoiIC");
  syntax.registerActionSyntax("PolycrystalRandomICAction", "ICs/PolycrystalICs/PolycrystalRandomIC");
  syntax.registerActionSyntax("ReconVarICAction", "ICs/PolycrystalICs/ReconVarIC");

  registerAction(PolycrystalKernelAction, "add_kernel");
  registerAction(PolycrystalVariablesAction, "add_variable");
  registerAction(BicrystalCircleGrainICAction, "add_ic");
  registerAction(BicrystalBoundingBoxICAction, "add_ic");
  registerAction(Tricrystal2CircleGrainsICAction, "add_ic");
  registerAction(PolycrystalHexGrainICAction, "add_ic");
  registerAction(PolycrystalVoronoiICAction, "add_ic");
  registerAction(PolycrystalRandomICAction, "add_ic");
  registerAction(ReconVarICAction, "add_ic");
}
Esempio n. 24
0
void
SolidMechanicsApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  syntax.registerActionSyntax("SolidMechanicsAction", "SolidMechanics/*");

  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_user_object");
  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_aux_variable");
  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_aux_kernel");
  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_postprocessor");
  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_vector_postprocessor");
  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_material");

  registerAction(SolidMechanicsAction, "add_kernel");
  registerAction(DomainIntegralAction, "add_user_object");
  registerAction(DomainIntegralAction, "add_aux_variable");
  registerAction(DomainIntegralAction, "add_aux_kernel");
  registerAction(DomainIntegralAction, "add_postprocessor");
  registerAction(DomainIntegralAction, "add_material");
}
Esempio n. 25
0
void
ExampleApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  /**
   * Registering an Action is a little different than registering the other MOOSE
   * objects.  First, you need to register your Action in the associateSyntax method.
   * Also, you register your Action class with an "action_name" that can be
   * satisfied by executing the Action (running the "act" virtual method).
   */
  registerAction(ConvectionDiffusionAction, "add_kernel");

  /**
   * We need to tell the parser what new section name to look for and what
   * Action object to build when it finds it.  This is done directly on the syntax
   * with the registerActionSyntax method.
   *
   * The section name should be the "full path" of the parsed section but should NOT
   * contain a leading slash.  Wildcard characters can be used to replace a piece of the
   * path.
   */
  syntax.registerActionSyntax("ConvectionDiffusionAction", "ConvectionDiffusion");
}
Esempio n. 26
0
void
addActionTypes(Syntax & syntax)
{
  /**
   * The second param here indicates whether the task must be satisfied or not for a successful run.
   * If set to true, then the ActionWarehouse will attempt to create "Action"s automatically if they have
   * not been explicitly created by the parser or some other mechanism.
   *
   * 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.
   */

  /**************************/
  /**** Register Actions ****/
  /**************************/
  registerMooseObjectTask("create_problem",               Problem,                 true);
  registerMooseObjectTask("setup_executioner",            Executioner,             true);

  // 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("add_mesh_modifier",            MeshModifier,           false);

  registerMooseObjectTask("add_kernel",                   Kernel,                 false);
  appendMooseObjectTask  ("add_kernel",                   EigenKernel);

  registerMooseObjectTask("add_material",                 Material,               false);
  registerMooseObjectTask("add_bc",                       BoundaryCondition,      false);
  registerMooseObjectTask("add_function",                 Function,               false);

  registerMooseObjectTask("add_aux_kernel",               AuxKernel,              false);
  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_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_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);

  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_variable", false);

  registerTask("execute_mesh_modifiers", false);
  registerTask("uniform_refine_mesh", false);
  registerTask("prepare_mesh", false);
  registerTask("setup_mesh_complete", false);  // calls prepare

  registerTask("init_displaced_problem", false);

  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("setup_quadrature", true);

  /// Additional Actions
  registerTask("no_action", false);  // Used for Empty Action placeholders
  registerTask("set_global_params", false);
  registerTask("setup_time_periods", true);
  registerTask("setup_adaptivity", false);
  registerTask("meta_action", false);
  registerTask("setup_debug", 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("setup_material_output", true);
  registerTask("check_output", true);

  /**************************/
  /****** 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)"
"(check_copy_nodal_vars)"
"(setup_mesh)"
"(prepare_mesh)"
"(add_mesh_modifier)"
"(add_mortar_interface)"
"(execute_mesh_modifiers)"
"(uniform_refine_mesh)"
"(setup_mesh_complete)"
"(determine_system_type)"
"(create_problem)"
"(setup_time_integrator)"
"(setup_executioner)"
"(setup_time_stepper)"
"(setup_predictor)"
"(setup_postprocessor_data)"
"(setup_time_periods)"
"(init_displaced_problem)"
"(add_aux_variable, add_variable, add_elemental_field_variable)"
"(setup_variable_complete)"
"(setup_quadrature)"
"(add_function)"
"(add_periodic_bc)"
"(add_user_object)"
"(setup_function_complete)"
"(setup_adaptivity)"
"(set_adaptivity_options)"
"(add_ic)"
"(add_preconditioning, add_constraint, add_split)"
"(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)"
"(setup_material_output)"
"(init_problem)"
"(setup_debug)"
"(add_output)"
"(add_postprocessor)"
"(add_vector_postprocessor)"
"(add_aux_kernel, add_bc, add_damper, add_dirac_kernel, add_kernel, add_dg_kernel, add_scalar_kernel, add_aux_scalar_kernel, add_indicator, add_marker)"
"(add_control)"
"(check_output)"
"(check_integrity)"
);

}
Esempio n. 27
0
int main(int argc, char* argv[])
{
  if (argc != 2) {
      cout << "No input files!" << std::endl;
      return 1;
    }
  ifstream f(argv[1]);
  if (!f) {
      cout << "Cannot open file: " << argv[1] << std::endl;
      return 1;
    }

  QFile file_syntax(":/plsql.rules");
  if (!file_syntax.open(QIODevice::ReadOnly | QIODevice::Text))
  {
      return 1;
  }
  QTextStream syntax_input(&file_syntax);
  Syntax syntax;

  syntax.readRules(syntax_input);
  syntax.print();

  LexicalAnalyzer lexems(f);
//    auto input_name = argv[1];
//    try {
//      while(true) {
//          LexemPtr lexem = lexems.nextLexem();
//          prinLexem(lexem,cout);
//        }
//    } catch (const LexicalExceptionEndOfStream&) {
//      cout << input_name
//             << ':' << lexems.currentReadPos().row
//             << ':' << lexems.currentReadPos().column << ": "
//             <<"End of file reached." << std::endl;
//    } catch (const LexicalException& e) {
//      cout << input_name
//             << ':' << lexems.currentReadPos().row
//             << ':' << lexems.currentReadPos().column << ": "
//             << "Lexical error: " << e.what() << std::endl;
//    }
//    lexems.setCurrentLexemIndex(0);
  try {
    syntax.buildTree(lexems);
  } catch (const SyntaxException& e) {
    cout << e.what() << std::endl;
    return 1;
  } catch (const LexicalException& e) {
    cout << e.what() << std::endl;
    return 1;
  }
  syntax.getCurTree()->print();
  cout << std::endl;

  Context context;

  try {
    context.parseBlocks(syntax.getCurTree());
    context.parseVariablesInCurrentBlocks();
    context.printVariablesInCurrentBlocks();
  } catch (const ContextException& e) {
    cout << e.what() << std::endl;
    return 1;
  }

  CodeGenerator code;
  code.generate(syntax.getCurTree());
  cout << std::endl
       << STR("Generated code:") << std::endl
       << code << std::endl;

  return 0;
}
Esempio n. 28
0
void
SolidMechanicsApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  syntax.registerActionSyntax("EmptyAction", "BCs/CavityPressure");
  syntax.registerActionSyntax("CavityPressureAction", "BCs/CavityPressure/*");
  syntax.registerActionSyntax("CavityPressurePPAction", "BCs/CavityPressure/*");
  syntax.registerActionSyntax("CavityPressureUOAction", "BCs/CavityPressure/*");

  syntax.registerActionSyntax("EmptyAction", "BCs/DisplacementAboutAxis");
  syntax.registerActionSyntax("DisplacementAboutAxisAction", "BCs/DisplacementAboutAxis/*");

  syntax.registerActionSyntax("SolidMechanicsAction", "SolidMechanics/*");

  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_user_object");
  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_aux_variable");
  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_aux_kernel");
  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_postprocessor");
  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_vector_postprocessor");
  syntax.registerActionSyntax("DomainIntegralAction", "DomainIntegral","add_material");

  registerAction(DisplacementAboutAxisAction, "add_bc");
  registerAction(CavityPressureAction, "add_bc");
  registerAction(CavityPressurePPAction, "add_postprocessor");
  registerAction(CavityPressureUOAction, "add_user_object");
  registerAction(SolidMechanicsAction, "add_kernel");
  registerAction(DomainIntegralAction, "add_user_object");
  registerAction(DomainIntegralAction, "add_aux_variable");
  registerAction(DomainIntegralAction, "add_aux_kernel");
  registerAction(DomainIntegralAction, "add_postprocessor");
  registerAction(DomainIntegralAction, "add_material");
}
Esempio n. 29
0
void
PhaseFieldApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
  syntax.registerActionSyntax("BicrystalBoundingBoxICAction", "ICs/PolycrystalICs/BicrystalBoundingBoxIC");
  syntax.registerActionSyntax("BicrystalCircleGrainICAction", "ICs/PolycrystalICs/BicrystalCircleGrainIC");
  syntax.registerActionSyntax("CHPFCRFFSplitKernelAction", "Kernels/CHPFCRFFSplitKernel");
  syntax.registerActionSyntax("CHPFCRFFSplitVariablesAction", "Variables/CHPFCRFFSplitVariables");
  syntax.registerActionSyntax("DisplacementGradientsAction", "Modules/PhaseField/DisplacementGradients");
  syntax.registerActionSyntax("EmptyAction", "ICs/PolycrystalICs");  // placeholder
  syntax.registerActionSyntax("HHPFCRFFSplitKernelAction", "Kernels/HHPFCRFFSplitKernel");
  syntax.registerActionSyntax("HHPFCRFFSplitVariablesAction", "Variables/HHPFCRFFSplitVariables");
  syntax.registerActionSyntax("MatVecRealGradAuxKernelAction", "AuxKernels/MatVecRealGradAuxKernel");
  syntax.registerActionSyntax("MultiAuxVariablesAction", "AuxVariables/MultiAuxVariables");
  syntax.registerActionSyntax("PFCRFFKernelAction", "Kernels/PFCRFFKernel");
  syntax.registerActionSyntax("PFCRFFVariablesAction", "Variables/PFCRFFVariables");
  syntax.registerActionSyntax("PolycrystalElasticDrivingForceAction", "Kernels/PolycrystalElasticDrivingForce");
  syntax.registerActionSyntax("PolycrystalHexGrainICAction", "ICs/PolycrystalICs/PolycrystalHexGrainIC");
  syntax.registerActionSyntax("PolycrystalKernelAction", "Kernels/PolycrystalKernel");
  syntax.registerActionSyntax("PolycrystalRandomICAction", "ICs/PolycrystalICs/PolycrystalRandomIC");
  syntax.registerActionSyntax("PolycrystalVariablesAction", "Variables/PolycrystalVariables");
  syntax.registerActionSyntax("PolycrystalVoronoiICAction", "ICs/PolycrystalICs/PolycrystalVoronoiIC");
  syntax.registerActionSyntax("ReconVarICAction", "ICs/PolycrystalICs/ReconVarIC");
  syntax.registerActionSyntax("RigidBodyMultiKernelAction", "Kernels/RigidBodyMultiKernel");
  syntax.registerActionSyntax("Tricrystal2CircleGrainsICAction", "ICs/PolycrystalICs/Tricrystal2CircleGrainsIC");

  registerAction(BicrystalBoundingBoxICAction, "add_ic");
  registerAction(BicrystalCircleGrainICAction, "add_ic");
  registerAction(CHPFCRFFSplitKernelAction, "add_kernel");
  registerAction(CHPFCRFFSplitVariablesAction, "add_variable");
  registerAction(DisplacementGradientsAction, "add_variable");
  registerAction(DisplacementGradientsAction, "add_material");
  registerAction(DisplacementGradientsAction, "add_kernel");
  registerAction(HHPFCRFFSplitKernelAction, "add_kernel");
  registerAction(HHPFCRFFSplitVariablesAction, "add_variable");
  registerAction(MatVecRealGradAuxKernelAction, "add_aux_kernel");
  registerAction(MultiAuxVariablesAction, "add_aux_variable");
  registerAction(PFCRFFKernelAction, "add_kernel");
  registerAction(PFCRFFVariablesAction, "add_variable");
  registerAction(PolycrystalElasticDrivingForceAction, "add_kernel");
  registerAction(PolycrystalHexGrainICAction, "add_ic");
  registerAction(PolycrystalKernelAction, "add_kernel");
  registerAction(PolycrystalRandomICAction, "add_ic");
  registerAction(PolycrystalVariablesAction, "add_variable");
  registerAction(PolycrystalVoronoiICAction, "add_ic");
  registerAction(ReconVarICAction, "add_ic");
  registerAction(RigidBodyMultiKernelAction, "add_kernel");
  registerAction(Tricrystal2CircleGrainsICAction, "add_ic");
}
Esempio n. 30
0
void
PhaseFieldApp::associateSyntax(Syntax & syntax, ActionFactory & action_factory)
{
#undef registerAction
#define registerAction(tplt, action) action_factory.reg<tplt>(stringifyName(tplt), action)

  syntax.registerActionSyntax("BicrystalBoundingBoxICAction", "ICs/PolycrystalICs/BicrystalBoundingBoxIC");
  syntax.registerActionSyntax("BicrystalCircleGrainICAction", "ICs/PolycrystalICs/BicrystalCircleGrainIC");
  syntax.registerActionSyntax("CHPFCRFFSplitKernelAction", "Kernels/CHPFCRFFSplitKernel");
  syntax.registerActionSyntax("CHPFCRFFSplitVariablesAction", "Variables/CHPFCRFFSplitVariables");
  syntax.registerActionSyntax("EmptyAction", "ICs/PolycrystalICs");  // placeholder
  syntax.registerActionSyntax("HHPFCRFFSplitKernelAction", "Kernels/HHPFCRFFSplitKernel");
  syntax.registerActionSyntax("HHPFCRFFSplitVariablesAction", "Variables/HHPFCRFFSplitVariables");
  syntax.registerActionSyntax("PFCRFFKernelAction", "Kernels/PFCRFFKernel");
  syntax.registerActionSyntax("PFCRFFVariablesAction", "Variables/PFCRFFVariables");
  syntax.registerActionSyntax("PolycrystalElasticDrivingForceAction", "Kernels/PolycrystalElasticDrivingForce");
  syntax.registerActionSyntax("PolycrystalHexGrainICAction", "ICs/PolycrystalICs/PolycrystalHexGrainIC");
  syntax.registerActionSyntax("PolycrystalKernelAction", "Kernels/PolycrystalKernel");
  syntax.registerActionSyntax("PolycrystalRandomICAction", "ICs/PolycrystalICs/PolycrystalRandomIC");
  syntax.registerActionSyntax("PolycrystalVariablesAction", "Variables/PolycrystalVariables");
  syntax.registerActionSyntax("PolycrystalVoronoiICAction", "ICs/PolycrystalICs/PolycrystalVoronoiIC");
  syntax.registerActionSyntax("ReconVarICAction", "ICs/PolycrystalICs/ReconVarIC");
  syntax.registerActionSyntax("Tricrystal2CircleGrainsICAction", "ICs/PolycrystalICs/Tricrystal2CircleGrainsIC");

  registerAction(BicrystalBoundingBoxICAction, "add_ic");
  registerAction(BicrystalCircleGrainICAction, "add_ic");
  registerAction(CHPFCRFFSplitKernelAction, "add_kernel");
  registerAction(CHPFCRFFSplitVariablesAction, "add_variable");
  registerAction(HHPFCRFFSplitKernelAction, "add_kernel");
  registerAction(HHPFCRFFSplitVariablesAction, "add_variable");
  registerAction(PFCRFFKernelAction, "add_kernel");
  registerAction(PFCRFFVariablesAction, "add_variable");
  registerAction(PolycrystalElasticDrivingForceAction, "add_kernel");
  registerAction(PolycrystalHexGrainICAction, "add_ic");
  registerAction(PolycrystalKernelAction, "add_kernel");
  registerAction(PolycrystalRandomICAction, "add_ic");
  registerAction(PolycrystalVariablesAction, "add_variable");
  registerAction(PolycrystalVoronoiICAction, "add_ic");
  registerAction(ReconVarICAction, "add_ic");
  registerAction(Tricrystal2CircleGrainsICAction, "add_ic");

#undef registerAction
#define registerAction(tplt, action) action_factory.regLegacy<tplt>(stringifyName(tplt), action)
}