コード例 #1
0
 /**
  * The keyword is generated from the reactants and products using {@link GenerateReactionKeywords}
  *
  * @param reaction The reaction parsed from the text
  * @return the generated keyword
  */
 private String getKeyword(ChemkinReaction reaction) {
   ArrayList<String> reactantNames = createMoleculeArrayList(reaction.getReactants());
   ArrayList<String> productNames = createMoleculeArrayList(reaction.getProducts());
   String reactionEquation = keywordGenerator.getReactionName(reactantNames, productNames);
   String keyword = keywordGenerator.getReactionFullName(reactionEquation);
   return keyword;
 }
コード例 #2
0
  /**
   * From {@link ChemkinReaction} form the {@link ChemkinReactionData} This routine parses through
   * all the coefficient types using createCoeffs: forward, reverse, low, high troe, sri, plog The
   * third body is parsed using createThirdBody
   *
   * @param reaction that has been parsed from the text
   * @return The reaction data
   */
  private ChemkinReactionData create(
      String rxnkeyword, ChemkinReaction reaction, ArrayList<DatabaseObject> coefficients) {
    System.out.println("ChemkinReactionData create: " + rxnkeyword);

    ArrayList<String> reactantNames = createMoleculeArrayList(reaction.getReactants());
    ArrayList<String> productNames = createMoleculeArrayList(reaction.getProducts());

    ArrayList<String> reactantReactionNames = new ArrayList<String>();
    for (String name : reactantNames) {
      String rxnmolname = moleculeNamesTable.get(name);
      reactantReactionNames.add(rxnmolname);
    }

    ArrayList<String> productReactionNames = new ArrayList<String>();
    for (String name : productNames) {
      String rxnmolname = moleculeNamesTable.get(name);
      productReactionNames.add(rxnmolname);
    }
    ChemkinCoefficientsData forwardCoefficients = null;
    if (reaction.getForwardCoefficients() != null) {
      forwardCoefficients = createCoeffs(keyword, rxnkeyword, reaction.getForwardCoefficients());
      forward = true;
      coefficients.add(forwardCoefficients);
    }

    ChemkinCoefficientsData reverseCoefficients = null;
    if (reaction.getReverseCoefficients() != null) {
      reverseCoefficients = createCoeffs(keyword, rxnkeyword, reaction.getReverseCoefficients());
      reverse = true;
      coefficients.add(reverseCoefficients);
    }

    ChemkinCoefficientsData lowCoefficients = null;
    if (reaction.getLowCoefficients() != null) {
      lowCoefficients = createCoeffs(keyword, rxnkeyword, reaction.getLowCoefficients());
      lowCoefficients.setLow(true);
      low = true;
      coefficients.add(lowCoefficients);
    }

    ChemkinCoefficientsData highCoefficients = null;
    if (reaction.getHighCoefficients() != null) {
      highCoefficients = createCoeffs(keyword, rxnkeyword, reaction.getHighCoefficients());
      highCoefficients.setHigh(true);
      high = true;
      coefficients.add(highCoefficients);
    }

    ChemkinCoefficientsData troeCoefficients = null;
    if (reaction.getTroeCoefficients() != null) {
      troeCoefficients = createCoeffs(keyword, rxnkeyword, reaction.getTroeCoefficients());
      troeCoefficients.setTroe(true);
      troe = true;
      coefficients.add(troeCoefficients);
    }

    ChemkinCoefficientsData sriCoefficients = null;
    if (reaction.getSriCoefficients() != null) {
      sriCoefficients = createCoeffs(keyword, rxnkeyword, reaction.getSriCoefficients());
      sriCoefficients.setSri(true);
      sri = true;
      coefficients.add(sriCoefficients);
    }

    // ArrayList<ChemkinCoefficientsData> plogCoefficients = null;
    if (reaction.getPlogCoefficients() != null) {
      plog = true;
      // plogCoefficients = new ArrayList<ChemkinCoefficientsData>();
      for (ChemkinCoefficients plog : reaction.getPlogCoefficients()) {
        ChemkinCoefficientsData plogC = createCoeffs(keyword, rxnkeyword, plog);
        coefficients.add(plogC);
        // plogCoefficients.add(plogC);
        // plogC.setPlog(true);
      }
    }
    ChemkinReactionData data =
        new ChemkinReactionData(
            keyword,
            rxnkeyword,
            reactantReactionNames,
            productReactionNames,
            forward,
            reverse,
            low,
            high,
            troe,
            sri,
            plog);
    if (reaction.getThirdBodyMolecules() != null) {
      addThirdBody(reaction.getThirdBodyMolecules(), data);
    }
    return data;
  }