Search in sources :

Example 1 with InternalBackendData

use of gov.sandia.n2a.backend.internal.InternalBackendData in project n2a by frothga.

the class Instance method path.

/**
 *        Return a unique name for this instance within the simulation.
 *        Name consists of the equation set name combined with the index of this part,
 *        prefixed by the path to the parent part. In the case of a connection, the name
 *        consists of the path to each of the connected parts.
 */
public String path() {
    // In general, container is never null, as that would only happen if this is the instance of Wrapper.
    boolean top = container instanceof Wrapper || container == null;
    String result;
    if (top)
        result = "";
    else
        result = equations.name;
    InternalBackendData bed = (InternalBackendData) equations.backendData;
    if (bed.index != null && !(this instanceof Population))
        result += get(bed.index);
    if (top)
        return result;
    String prefix = container.path();
    if (prefix.isEmpty())
        return result;
    return prefix + "." + result;
}
Also used : Wrapper(gov.sandia.n2a.backend.internal.Wrapper) Population(gov.sandia.n2a.backend.internal.Population) InternalBackendData(gov.sandia.n2a.backend.internal.InternalBackendData)

Example 2 with InternalBackendData

use of gov.sandia.n2a.backend.internal.InternalBackendData in project n2a by frothga.

the class Instance method dumpValues.

public void dumpValues(boolean global, boolean temp) {
    InternalBackendData bed = (InternalBackendData) equations.backendData;
    List<String> namesFloat;
    List<String> namesType;
    if (global) {
        if (temp) {
            namesFloat = bed.namesGlobalTempFloat;
            namesType = bed.namesGlobalTempObject;
        } else {
            namesFloat = bed.namesGlobalFloat;
            namesType = bed.namesGlobalObject;
        }
    } else // local
    {
        if (temp) {
            namesFloat = bed.namesLocalTempFloat;
            namesType = bed.namesLocalTempObject;
        } else {
            namesFloat = bed.namesLocalFloat;
            namesType = bed.namesLocalObject;
        }
    }
    System.out.print("[");
    if (valuesFloat != null) {
        for (int i = 0; i < valuesFloat.length; i++) {
            System.out.print(namesFloat.get(i) + "=");
            System.out.print(valuesFloat[i]);
            if (i < valuesFloat.length - 1)
                System.out.print(",");
        }
    }
    System.out.print("][");
    if (valuesObject != null) {
        for (int i = 0; i < valuesObject.length; i++) {
            System.out.print(namesType.get(i) + "=");
            System.out.print(valuesObject[i]);
            if (i < valuesObject.length - 1)
                System.out.print(",");
        }
    }
    System.out.print("]");
}
Also used : InternalBackendData(gov.sandia.n2a.backend.internal.InternalBackendData)

Aggregations

InternalBackendData (gov.sandia.n2a.backend.internal.InternalBackendData)2 Population (gov.sandia.n2a.backend.internal.Population)1 Wrapper (gov.sandia.n2a.backend.internal.Wrapper)1