Java Code Examples for com.sun.jna.ptr.DoubleByReference#getValue()

The following examples show how to use com.sun.jna.ptr.DoubleByReference#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EfdcDLL.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Returns the time step used by the EFDC model in days
 *
 * @return deltaT.getValue()
 */
public double getDeltaT() {
    DoubleByReference deltaT = new DoubleByReference();
    int retVal = nativeDLL.m_openda_wrapper_get_delta_t_(deltaT);
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_DELTA_T call, retVal= " + retVal);
    }
    return deltaT.getValue();
}
 
Example 2
Source File: EfdcDLL.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Returns the reference period as set in the EFDC.INP file in days
 * The EFDC model can only be run in multiples of the reference period
 *
 * @return referencePeriod.getValue()
 */
public double getReferencePeriod() {
    DoubleByReference referencePeriod = new DoubleByReference();
    int retVal = nativeDLL.m_openda_wrapper_get_reference_period_(referencePeriod);
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_REFERENCE_PERIOD call, retVal= " + retVal);
    }
    return referencePeriod.getValue();
}
 
Example 3
Source File: EfdcDLL.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Returns the start time of simulation in MJD (i.e. in GMT timeZone).
 *
 * @return startTime.getValue() + referenceDateInMjd
 */
public double getStartTime() {
    DoubleByReference startTime = new DoubleByReference();
    int retVal = nativeDLL.m_openda_wrapper_get_start_time_(new IntByReference(myModelInstanceId), startTime);
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_START_TIME call, retVal= " + retVal);
    }
    return startTime.getValue() + referenceDateInMjd;
    //return startTime.getValue();
}
 
Example 4
Source File: EfdcDLL.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Returns the end time of simulation in MJD (i.e. in GMT timeZone).
 *
 * @return endTime.getValue() + referenceDateInMjd
 */
public double getEndTime() {
    DoubleByReference endTime = new DoubleByReference();
    int retVal = nativeDLL.m_openda_wrapper_get_end_time_(new IntByReference(myModelInstanceId), endTime);
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_END_TIME call, retVal= " + retVal);
    }
    return endTime.getValue() + referenceDateInMjd;
    //return endTime.getValue();
}
 
Example 5
Source File: EfdcDLL.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Returns the current time of the model in MJD (i.e. in GMT timeZone).
 *
 * @return current time of the model.
 */
public double getCurrentTime() {
    DoubleByReference currentTime = new DoubleByReference();
    //startModelInstanceAccess();
    int retVal = nativeDLL.m_openda_wrapper_get_current_time_(new IntByReference(myModelInstanceId), currentTime);
    //endModelInstanceAccess();
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_CURRENT_TIME call, retVal= " + retVal);
    }
    return currentTime.getValue() + referenceDateInMjd;
    //return currentTime.getValue();
}
 
Example 6
Source File: SimpleModelDLL.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
public double getDeltaT() {
    DoubleByReference deltaT = new DoubleByReference();
    int retVal = nativeDLL.m_simple_model_mp_get_delta_t_(deltaT);
    if (retVal != 0) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_DELTA_T call, retVal= " + retVal);
    }
    return deltaT.getValue();
}
 
Example 7
Source File: SimpleModelDLL.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
public double getStartTime() {
    DoubleByReference startTime = new DoubleByReference();
    int retVal = nativeDLL.m_simple_model_mp_get_start_time_(startTime);
    if (retVal != 0) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_START_TIME call, retVal= " + retVal);
    }
    return startTime.getValue();
}
 
Example 8
Source File: SimpleModelDLL.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
public double getEndTime() {
    DoubleByReference endTime = new DoubleByReference();
    int retVal = nativeDLL.m_simple_model_mp_get_end_time_(endTime);
    if (retVal != 0) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_END_TIME call, retVal= " + retVal);
    }
    return endTime.getValue();
}
 
Example 9
Source File: SimpleModelDLL.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
public double getCurrentTime() {
    DoubleByReference currentTime = new DoubleByReference();
    startModelInstanceAccess();
    int retVal = nativeDLL.m_simple_model_mp_get_current_time_(new IntByReference(myModelInstanceId), currentTime);
    endModelInstanceAccess();
    if (retVal != 0) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_CURRENT_TIME call, retVal= " + retVal);
    }
    return currentTime.getValue();
}