Esempio n. 1
0
    public static IReaction        buildFickReactionFromProps(FickProperties props, LinkedList <Medium> mediums)
    {
        FickReaction reaction = new FickReaction();
        Medium       med1     = ReactionEngine.getMediumFromId(props.MediumId1, mediums);
        Medium       med2     = ReactionEngine.getMediumFromId(props.MediumId2, mediums);

        if (med1 == null || med2 == null)
        {
            Debug.Log("failed to build FickReaction from FickProperties beacause one or all the medium id don't exist");
            return(null);
        }
        reaction.setSurface(props.surface);
        reaction.setPermCoef(props.P);
        reaction.setMedium1(med1);
        reaction.setMedium2(med2);
        reaction.setEnergyCost(props.energyCost);

        return(reaction);
    }
Esempio n. 2
0
    //! Return all the FickReactions possible from a Medium list.

    /*!
     *  \param mediums The list of mediums.
     *
     *  \details
     *  This function return all the possible combinaisons of FickReaction in Medium list.
     *
     *  Example :
     *    - Medium1 + Medium2 + Medium3 = FickReaction(1, 2) + FickReaction(1, 3) + FickReaction(2, 3)
     */
    public static LinkedList <FickReaction> getFickReactionsFromMediumList(LinkedList <Medium> mediums)
    {
        FickReaction              newReaction;
        LinkedListNode <Medium>   node;
        LinkedListNode <Medium>   start         = mediums.First;
        LinkedList <FickReaction> fickReactions = new LinkedList <FickReaction>();

        while (start != null)
        {
            node = start.Next;
            while (node != null)
            {
                newReaction = new FickReaction();
                newReaction.setMedium1(start.Value);
                newReaction.setMedium2(node.Value);
                fickReactions.AddLast(newReaction);
                node = node.Next;
            }
            start = start.Next;
        }
        return(fickReactions);
    }
Esempio n. 3
0
    //! Return all the FickReactions possible from a Medium list.
    /*!
      \param mediums The list of mediums.

      \details
      This function return all the possible combinaisons of FickReaction in Medium list.

      Example :
        - Medium1 + Medium2 + Medium3 = FickReaction(1, 2) + FickReaction(1, 3) + FickReaction(2, 3)
      */
    public static LinkedList<FickReaction> getFickReactionsFromMediumList(LinkedList<Medium> mediums)
    {
        FickReaction                newReaction;
        LinkedListNode<Medium>      node;
        LinkedListNode<Medium>      start = mediums.First;
        LinkedList<FickReaction>    fickReactions = new LinkedList<FickReaction>();

        while (start != null)
          {
        node = start.Next;
        while (node != null)
          {
            newReaction = new FickReaction();
            newReaction.setMedium1(start.Value);
            newReaction.setMedium2(node.Value);
            fickReactions.AddLast(newReaction);
            node = node.Next;
          }
        start = start.Next;
          }
        return fickReactions;
    }
Esempio n. 4
0
    public static IReaction buildFickReactionFromProps(FickProprieties props, LinkedList<Medium> mediums)
    {
        FickReaction reaction = new FickReaction();
        Medium med1 = ReactionEngine.getMediumFromId(props.MediumId1, mediums);
        Medium med2 = ReactionEngine.getMediumFromId(props.MediumId2, mediums);

        if (med1 == null || med2 == null)
          {
        Debug.Log("failed to build FickReaction from FickProprieties beacause one or all the medium id don't exist");
        return null;
          }
        reaction.setSurface(props.surface);
        reaction.setPermCoef(props.P);
        reaction.setMedium1(med1);
        reaction.setMedium2(med2);
        reaction.setEnergyCost(props.energyCost);

        return reaction;
    }