Java 类com.sun.jna.ptr.IntByReference 实例源码

项目:BIMplatform    文件:IfcEngine.java   
/**
 * Adds an attribute value at the end of an attribute list.
 * 
 * @param list
 * @param valueType
 * @param value
 */
public void sdaiAppend(int list, SdaiTypes valueType, Object value) {
    switch (valueType) {
    case INTEGER:
    case BOOLEAN:
    case LOGICAL:
        IntByReference iVal = new IntByReference((Integer) value);
        engine.sdaiAppend(list, valueType.ordinal(), iVal);
        break;
    case REAL:
        DoubleByReference dVal = new DoubleByReference((Double) value);
        engine.sdaiAppend(list, valueType.ordinal(), dVal);
        break;
    case STRING:
        engine.sdaiAppend(list, valueType.ordinal(), (String) value);
        break;
    default:
        engine.sdaiAppend(list, valueType.ordinal(), (Pointer) value);
        break;
    }
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * Sets all times for a scalar time series parameter.
 *
 * @param parameterNumber
 * @param locationNumber
 * @param times
 */
public void setTimesForExchangeItem(int parameterNumber, int locationNumber, double[] times) {
    int timesCount = times.length;
    // correct for reference date
    double[] myTimes = new double[timesCount];

    for (int i = 0; i < myTimes.length; i++) {
        myTimes[i] = times[i] - referenceDateInMjd;
    }

    int retVal = nativeDLL.m_openda_wrapper_set_times_for_ei_(
            new IntByReference(myModelInstanceId),
            new IntByReference(parameterNumber),
            new IntByReference(locationNumber),
            new IntByReference(timesCount),
            myTimes);
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.SET_TIMES_FOR_EI call, retVal= " + retVal);
    }
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * Sets selected values for a scalar time series parameter.
 *
 * @param parameterNumber
 * @param values
 * @param locationNumber
 * @param layerNumber
 * @param startTime
 * @param endTime
 */
public void setValues(int parameterNumber, double[] values, int locationNumber, int layerNumber, ITime startTime, ITime endTime) {
    int valuesCount = getValuesCount(parameterNumber, locationNumber, startTime, endTime);
    if (valuesCount != values.length) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid number of values in setValues(exchangeItemId=" +
                parameterNumber + "). #Values=" + values.length + ", #expected=" + valuesCount);
    }
    int retVal = nativeDLL.m_openda_wrapper_set_values_for_time_span_(
            new IntByReference(myModelInstanceId),
            new IntByReference(parameterNumber), new IntByReference(locationNumber), new IntByReference(layerNumber),
            new DoubleByReference(startTime.getMJD() - referenceDateInMjd),
            new DoubleByReference(endTime.getMJD() - referenceDateInMjd),
            new IntByReference(valuesCount), values);
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.SET_VALUES_FOR_TIME_SPAN call, retVal= " + retVal);
    }
}
项目:OpenDA    文件:WdmDll.java   
/**
 * Note: this method throws an exception if there is no data available for the given dataSetNumber. So it is needed to check if there is data before calling this method.
 */
public int[] getEndDate(int wdmFileNumber, int dataSetNumber) {
    int[] startDate = new int[6];
    int[] endDate = new int[6];
    Arrays.fill(startDate, 0);
    Arrays.fill(endDate, 0);

    IntByReference returnCode = new IntByReference(-1);
    nativeDLL.wdatim_(new IntByReference(wdmFileNumber), new IntByReference(dataSetNumber),
            startDate, endDate, new IntByReference(), new IntByReference(), returnCode);
    if (returnCode.getValue() != 0) {
        throw new RuntimeException("WdmDll: Invalid result from call to subroutine dll.wdatim_ , returnCode = " + returnCode.getValue());
    }

    return endDate;
}
项目:OpenDA    文件:D3dFlowDll.java   
public static void setStateValues(double[] values) {
    int retVal;
    if (platform == D3dFlowModelConfig.DllType.win32_ifort) {
        retVal = winIfortDll.SE_SET_INSTANCE_CORE_STATE(values,new IntByReference(values.length) );
        if (retVal != 0){
            throw new RuntimeException("setStateValues: failed to set statevalues");
        }
    }else if (platform == D3dFlowModelConfig.DllType.linux64_gnu) {
        retVal = linuxGnuDll.se_set_instance_core_state_(values,new IntByReference(values.length) );
        if (retVal != 0){
            throw new RuntimeException("setStateValues: failed to set statevalues");
        }
    } else {
        throw new RuntimeException("setStateValues: DLL/so type not known for model");
    }
}
项目:OpenDA    文件:D3dFlowDll.java   
public static int getBoundaryExchangeItemID(String boundaryId, int boundaryType) {
    int retVal;
    if (platform == D3dFlowModelConfig.DllType.win32_ifort) {
        retVal = winIfortDll.SE_GET_EXCHANGE_ITEM_ID_CI(
                boundaryId, new IntByReference(boundaryType), boundaryId.length());
    } else if (platform == D3dFlowModelConfig.DllType.linux64_gnu) {
        retVal = linuxGnuDll.se_get_exchange_item_id_ci_(
                boundaryId, new IntByReference(boundaryType), boundaryId.length());
    } else {
        throw new RuntimeException("getBoundaryExchangeItemID: DLL/so type not known for model");
    }
    if (retVal < 0) {
        throw new RuntimeException("Error in D3dFlowDll.getBoundaryExchangeItemID, retVal " + retVal);
    }
    return retVal;
}
项目:OpenDA    文件:SimpleModelDLL.java   
public double[] getValues(int exchangeItemId, int startIndex, int endIndex) {
    int valuesCount = getValuesCount(exchangeItemId);
    double[] values = new double[valuesCount];
    startModelInstanceAccess();
    int retVal = nativeDLL.m_simple_model_mp_get_values_(
            new IntByReference(myModelInstanceId),
            new IntByReference(exchangeItemId),
            new IntByReference(startIndex + 1), new IntByReference(endIndex + 1),
            values);
    endModelInstanceAccess();
    if (retVal != 0) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_VALUES call, retVal= " + retVal);
    }
    return values;
}
项目:OpenDA    文件:SimpleModelDLL.java   
public void setValues(int exchangeItemId, double[] values, int locationIndex, ITime startTime, ITime endTime) {
    int valuesCount = getValuesCount(exchangeItemId, locationIndex, startTime, endTime);
    if (valuesCount != values.length) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid #values in setValues(exchangeItemId=" +
                exchangeItemId + "). #Values=" + values.length + ", #expected=" + valuesCount);
    }
    startModelInstanceAccess();
    int retVal = nativeDLL.m_simple_model_mp_set_values_for_time_span_(
            new IntByReference(myModelInstanceId),
            new IntByReference(exchangeItemId), new IntByReference(locationIndex),
            new DoubleByReference(startTime.getMJD()), new DoubleByReference(endTime.getMJD()),
            new IntByReference(valuesCount), values);
    endModelInstanceAccess();
    if (retVal != 0) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.SET_VALUES call, retVal= " + retVal);
    }
}
项目:monarch    文件:NativeCallsJNAImpl.java   
/**
 * @see NativeCalls#isProcessActive(int)
 */
@Override
public boolean isProcessActive(final int processId) {
  try {
    final Pointer procHandle =
        Kernel32.OpenProcess(Kernel32.PROCESS_QUERY_INFORMATION, false, processId);
    final long hval;
    if (procHandle == null
        || (hval = Pointer.nativeValue(procHandle)) == Kernel32.INVALID_HANDLE || hval == 0) {
      return false;
    } else {
      final IntByReference status = new IntByReference();
      final boolean result = Kernel32.GetExitCodeProcess(procHandle, status) && status != null
          && status.getValue() == Kernel32.STILL_ACTIVE;
      Kernel32.CloseHandle(procHandle);
      return result;
    }
  } catch (LastErrorException le) {
    // some problem in getting process status
    return false;
  }
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * Returns selected values for a scalar time series parameter.
 *
 * @param parameterNumber
 * @param locationNumber
 * @param layerNumber
 * @param startTime
 * @param endTime
 * @return values
 */
public double[] getValues(int parameterNumber, int locationNumber, int layerNumber, ITime startTime, ITime endTime) {
    int valuesCount = getValuesCount(parameterNumber, locationNumber, startTime, endTime);
    double[] values = new double[valuesCount];
    int retVal = nativeDLL.m_openda_wrapper_get_values_for_time_span_(
            new IntByReference(myModelInstanceId),
            new IntByReference(parameterNumber), new IntByReference(locationNumber), new IntByReference(layerNumber),
            new DoubleByReference(startTime.getMJD() - referenceDateInMjd ),
            new DoubleByReference(endTime.getMJD() - referenceDateInMjd),
            new IntByReference(valuesCount), values);
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_VALUES_FOR_TIME_SPAN call, retVal= " + retVal);
    }
    return values;
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * Returns timeseriesCount for a scalar time series parameter.
 *
 * @param parameterNumber
 * @return timeseriesCount
 */
public int getTimeSeriesCount(int parameterNumber) {
    int timeSeriesCount = nativeDLL.m_openda_wrapper_get_time_series_count_(new IntByReference(myModelInstanceId), new IntByReference(parameterNumber));
    if (timeSeriesCount < 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_TIME_SERIES_COUNT call, timeSeriesCount= " + timeSeriesCount);
    }
    return timeSeriesCount;
}
项目:BIMplatform    文件:IfcEngine.java   
/**
 * Returns a data field in the actual aggregate element.
 * 
 * @param aggregate
 *            Existing aggregation
 * @param elementIndex
 *            Position in the existing aggregation, first position is 0
 * @param valueType
 *            Type of output value
 * @return Value of the specific element in the aggregation
 */
public Object engiGetAggrElement(Pointer aggregate, int elementIndex, SdaiTypes valueType) {
    Object returnValue = null;
    switch (valueType) {
    case INTEGER:
        IntByReference intRef = new IntByReference();
        engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), intRef);
        returnValue = new Integer(intRef.getValue());
        break;
    case REAL:
        DoubleByReference dblRef = new DoubleByReference();
        engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), dblRef);
        returnValue = new Double(dblRef.getValue());
        break;
    case STRING:
        PointerByReference strRef = new PointerByReference();
        engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), strRef);
        Pointer strPtr = strRef.getValue();
        if (strPtr != null)
            returnValue = strPtr.getString(0);
        break;
    default:
        PointerByReference ptrRef = new PointerByReference();
        engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), ptrRef);
        returnValue = ptrRef.getValue();
        break;
    }
    return returnValue;
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * Returns timeCount for a scalar time series parameter.
 *
 * @param parameterNumber
 * @param locationNumber
 * @return timeCount
 */
private int getTimesCount(int parameterNumber, int locationNumber) {
    int cellCount = nativeDLL.m_openda_wrapper_get_times_count_for_location_(
            new IntByReference(myModelInstanceId),
            new IntByReference(parameterNumber),
            new IntByReference(locationNumber));
    if (cellCount < 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(myModelInstanceId));
        throw new RuntimeException("Invalid result from dll.GET_TIMES_COUNT_FOR_LOCATION call, cellCount= " + cellCount);
    }
    return cellCount;
}
项目:BIMplatform    文件:IfcEngine.java   
/**
 * Implementation postponed till version 1.10
 * 
 * @param iterator
 *            Existing iterator
 * @param valueType
 *            Type of output value
 * @return
 */
public Object sdaiGetAggrByIterator(Pointer iterator, SdaiTypes valueType) {
    Object returnValue = null;

    switch (valueType) {
    case REAL:
        DoubleByReference dVal = new DoubleByReference();
        engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), dVal);
        returnValue = new Double(dVal.getValue());
        break;
    case INTEGER:
    case BOOLEAN:
    case LOGICAL:
        IntByReference iVal = new IntByReference();
        engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), iVal);
        returnValue = new Integer(iVal.getValue());
        break;
    case STRING:
        PointerByReference sVal = new PointerByReference();
        engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), sVal);
        returnValue = (String) sVal.getValue().getString(0);
        break;
    default:
        PointerByReference ptr = new PointerByReference();
        engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), ptr);
        returnValue = ptr.getValue();
        break;
    }
    return returnValue;
}
项目:BIMplatform    文件:IfcEngine.java   
/**
 * Returns the data value of the specified attribute in the actual instance.
 * The actual instance is specified by a numeric instanceID that uniquely
 * identifies an instance.
 * 
 * @param instance
 *            A numeric instanceID that uniquely identifies an instance.
 * @param attribute
 *            A numeric attributerID that uniquely identifies an attribute
 *            definition instance.
 * @param valueType
 *            Type of output value.
 * @return Output value of the specific element in the aggregation.
 */
public Object sdaiGetAttr(Pointer instance, int attribute, SdaiTypes valueType) {
    Object returnValue = null;

    switch (valueType) {
    case REAL:
        DoubleByReference dVal = new DoubleByReference();
        engine.sdaiGetAggrByIterator(instance, valueType.ordinal(), dVal);
        returnValue = new Double(dVal.getValue());
        break;
    case INTEGER:
    case BOOLEAN:
    case LOGICAL:
        IntByReference iVal = new IntByReference();
        engine.sdaiGetAggrByIterator(instance, valueType.ordinal(), iVal);
        returnValue = new Integer(iVal.getValue());
        break;
    case STRING:
        PointerByReference sVal = new PointerByReference();
        engine.sdaiGetAggrByIterator(instance, valueType.ordinal(), sVal);
        returnValue = (String) sVal.getValue().getString(0);
        break;
    default:
        PointerByReference ptr = new PointerByReference();
        engine.sdaiGetAggrByIterator(instance, valueType.ordinal(), ptr);
        returnValue = ptr.getValue();
        break;
    }
    return returnValue;
}
项目:BIMplatform    文件:IfcEngine.java   
public SurfaceProperties initializeModelling(Pointer model, double scale) {
    IntByReference pV = new IntByReference();
    IntByReference pI = new IntByReference();
    engine.initializeModelling(model, pV, pI, scale);
    int noVertices = pV.getValue();
    int noIndices = pI.getValue();
    return new SurfaceProperties(model, noVertices, noIndices, scale);
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * Returns layer count used by model.
 *
 * @return layerCount
 */
public int getLayerCount() {
    int layerCount = nativeDLL.m_openda_wrapper_get_layer_count_for_model_(
            new IntByReference(myModelInstanceId));
    if (layerCount < 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_LAYER_COUNT_FOR_MODEL call, layerCount= " + layerCount);
    }
    return layerCount;
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * Checks if exchangeItem is supported by current EFDC configuration.
 *
 * @param parameterNumber
 */
public boolean supportsExchangeItem(int parameterNumber) {
    int retVal = nativeDLL.m_openda_wrapper_supports_exchange_item_(
            new IntByReference(myModelInstanceId),
            new IntByReference(parameterNumber));
    if (retVal < 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.SUPPORTS_EXCHANGE_ITEM call, retVal= " + retVal);
    }
    boolean supported = false;
    if (retVal == 1) supported = true;
    return supported;
}
项目:OpenDA    文件:SimpleModelDLL.java   
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();
}
项目:OpenDA    文件:SimpleModelDLL.java   
public double[] applyObservationAdjoint(int[] arrayIdentifiersForObsPoints, int[] ObsPointIndicesInArray,
                                        double[] lambdaY) {
    // allocate space for result (state size)
    double[] lambdaX = new double[nativeDLL.m_simple_model_mp_get_state_size_()];
    // let computational core apply observation tangent.
    int retVal = nativeDLL.m_simple_model_mp_apply_obs_adjoint(arrayIdentifiersForObsPoints.length,
            arrayIdentifiersForObsPoints, ObsPointIndicesInArray, lambdaY,
            nativeDLL.m_simple_model_mp_get_state_size_(), lambdaX);
    if (retVal != 0) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.APPLYOBSERVATIONTANGENT call, retVal= " + retVal);
    }
    return lambdaX;
}
项目:Laplacian    文件:AVBitStreamFilter.java   
/**
 * @param name C type : const char*<br>
 * @param codec_ids C type : AVCodecID*<br>
 * @param priv_class C type : const AVClass*<br>
 * @param init C type : init_callback*<br>
 * @param filter C type : filter_callback*<br>
 * @param close C type : close_callback*
 */
public AVBitStreamFilter(Pointer name, IntByReference codec_ids, Pointer priv_class, int priv_data_size, org.ffmpeg.avfilter6.AVFilter.init_callback init, filter_callback filter, close_callback close) {
    super();
    this.name = name;
    this.codec_ids = codec_ids;
    this.priv_class = priv_class;
    this.priv_data_size = priv_data_size;
    this.init = init;
    this.filter = filter;
    this.close = close;
}
项目:OpenDA    文件:WdmDll.java   
/**
 * Opens the given wdm file at the given fortran unit number.
 *
 * @param wdmFileNumber
 * @param wdmFilePath
 * @param readOnlyFlag
 */
public void openWdmFile(int wdmFileNumber, String wdmFilePath, int readOnlyFlag) {
    IntByReference returnCode = new IntByReference(-1);
    nativeDLL.wdbopn_(new IntByReference(wdmFileNumber), wdmFilePath,
            new IntByReference(readOnlyFlag), returnCode, wdmFilePath.length());
    if (returnCode.getValue() != 0) {
        throw new RuntimeException("WdmDll: Invalid result from call to subroutine dll.wdbopn_ , returnCode = " + returnCode.getValue());
    }
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * Returns layer depths, i.e. the thickness of each layer.
 * In EFDC the layers start counting at the bottom, so the first layer is the lowest layer.
 *
 * @return layerDepths
 */
public double[] getLayerDepths() {
    int layerCount = this.getLayerCount();
    double[] layerDepths = new double[layerCount];
    int status = nativeDLL.m_openda_wrapper_get_layer_depths_(
            new IntByReference(myModelInstanceId),
            layerDepths);
    if (status < 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_LAYER_DEPTHS call, status= " + status);
    }
    return layerDepths;
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * In the EFDC model the model run period is divided in a number of referenceTimePeriods.
 * Each referenceTimePeriod is in turn divided in a number of timeSteps.
 * This method can only be called for a time period that is equal to an integer number of referenceTimePeriods.
 *
 * @param fromTime
 * @param toTime
 */
public void compute(ITime fromTime, ITime toTime) {
    startModelInstanceAccess();
    int retVal = nativeDLL.m_openda_wrapper_compute_(
            new IntByReference(myModelInstanceId),
            new DoubleByReference(fromTime.getMJD() - referenceDateInMjd ),
            new DoubleByReference(toTime.getMJD() - referenceDateInMjd ));
    endModelInstanceAccess();
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.COMPUTE call, retVal= " + retVal);
    }
}
项目:OpenDA    文件:WdmDll.java   
/**
 * Note: this method throws an exception if there is no data available for the given dataSetNumber. So it is needed to check if there is data before calling this method.
 */
public int getTimeUnit(int wdmFileNumber, int dataSetNumber) {
    IntByReference timeUnit = new IntByReference();
    IntByReference returnCode = new IntByReference(-1);
    nativeDLL.wdatim_(new IntByReference(wdmFileNumber), new IntByReference(dataSetNumber),
            new int[6], new int[6], new IntByReference(), timeUnit, returnCode);
    if (returnCode.getValue() != 0) {
        throw new RuntimeException("WdmDll: Invalid result from call to subroutine dll.wdatim_ , returnCode = " + returnCode.getValue());
    }
    return timeUnit.getValue();
}
项目:OpenDA    文件:SimpleModelDLL.java   
public void finish() {
    startModelInstanceAccess();
    int retVal = nativeDLL.m_simple_model_mp_finish_(new IntByReference(myModelInstanceId));
    endModelInstanceAccess();
    if (retVal != 0) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.FINALIZE call, retVal= " + retVal);
    }
}
项目:OpenDA    文件:WdmDll.java   
public void deleteValues(int wdmFileNumber, int dataSetNumber, int[] deleteFromDate, int deleteAll) {
    IntByReference returnCode = new IntByReference(-1);
    nativeDLL.wtddel_(new IntByReference(wdmFileNumber), new IntByReference(dataSetNumber),
            deleteFromDate, new IntByReference(deleteAll), returnCode);
    if (returnCode.getValue() != 0) {
        throw new RuntimeException("WdmDll: Invalid result from call to subroutine dll.wtddel_ , returnCode = " + returnCode.getValue());
    }
}
项目:OpenDA    文件:WdmDll.java   
public int[] getNextValidDate(int[] startDate, int timeUnit, int timeStep, int numberOftimeSteps) {
    int[] nextDate = new int[6];
    Arrays.fill(nextDate, 0);
    nativeDLL.timadd_(startDate, new IntByReference(timeUnit), new IntByReference(timeStep),
            new IntByReference(numberOftimeSteps), nextDate);
    return nextDate;
}
项目:OpenDA    文件:EfdcDLL.java   
private void endModelInstanceAccess() {
    // store currently active model instance
    if (currentModelInstance >= 0) {
        int retVal = nativeDLL.m_openda_wrapper_save_instance_(new IntByReference(currentModelInstance));
        if (retVal != 0) {
            nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
            throw new RuntimeException("Error saving model instance " + retVal);
        }
    }
}
项目:OpenDA    文件:D3dFlowDll.java   
public static void selectInstance(File modelDir, int instanceId) {
    setModelDirAsCWD(modelDir);
    if (platform == D3dFlowModelConfig.DllType.win32_ifort) {
        winIfortDll.SE_SELECT_INSTANCE(new IntByReference(instanceId));
    }else if (platform == D3dFlowModelConfig.DllType.linux64_gnu) {
        linuxGnuDll.se_select_instance_(new IntByReference(instanceId));
    } else {
        resetCWD();
        throw new RuntimeException("createInstance: DLL/so type not known for model");
    }
    resetCWD();
    if (instanceId < 0) {
        throw new RuntimeException("Error in D3dFlowDll.selectInstance(), returned ID " + instanceId);
    }
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * 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();
}
项目:OpenDA    文件:D3dFlowDll.java   
public static int setBoundaryGridNoise(int boundaryNoiseId, double alpha, double[] values, int operation) {
    // a crude way for the model to give the metadata (location) is to provide
    // all these locations as well. For the moment, we will implement it this way:
    // the double array can be subdivided into triples of (xloc, yloc, value).
    int retVal ;
    double startTime = 0.0;
    double endTime = 0.0;
    int nvals = values.length/3;
    for (int i = 0; i < nvals; i++) {
        values[3*i+2] = alpha * values[3*i+2]; //only adjust  the values, not the locations
    }
    if (platform == D3dFlowModelConfig.DllType.win32_ifort) {
        retVal = winIfortDll.SE_SET_NOISE_FOR_TIME_SPAN(new IntByReference(boundaryNoiseId),
                new DoubleByReference(startTime), new DoubleByReference(endTime),
                new IntByReference(operation),
                new IntByReference(values.length), values);
    } else if (platform == D3dFlowModelConfig.DllType.linux64_gnu) {
        retVal = linuxGnuDll.se_set_noise_for_time_span_(new IntByReference(boundaryNoiseId),
                new DoubleByReference(startTime), new DoubleByReference(endTime),
                new IntByReference(operation),
                new IntByReference(values.length), values);
    } else {
        throw new RuntimeException("setBoundaryNoise: DLL/so type not known for model");
    }
    if (retVal < 0) {
        throw new RuntimeException("Error in D3dFlowDll.setBoundaryNoise, retVal " + retVal);
    }
    return retVal;
}
项目:Motunautr    文件:Dwmapi.java   
public static void setExcludedFromPeek(final Window w, final boolean excluded) {
        final HWND hwnd = new HWND();
        hwnd.setPointer(Native.getComponentPointer(w));
//      final int error =
        INSTANCE.DwmSetWindowAttribute(hwnd, DWMWA_EXCLUDED_FROM_PEEK, new IntByReference(excluded ? 1 : 0), 4);
//      System.out.println(error);
    }
项目:OpenDA    文件:EfdcDLL.java   
/**
 * 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();
}
项目:OpenDA    文件:EfdcDLL.java   
/**
 * 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();
}
项目:Fatigue-Detection    文件:STMobileApiBridge.java   
int st_mobile_face_detection_detect(
    Pointer handle,
    byte[] image,
    int pixel_format,
    int image_width,
    int image_height,
    int image_stride,
    int orientation,
    PointerByReference p_faces_array,
    IntByReference p_faces_count
);
项目:OpenDA    文件:EfdcDLL.java   
/**
 * 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();
}
项目:OpenDA    文件:ISangomaEWPFNativeDLL.java   
void oda_proposal_step(IntByReference Ne, IntByReference Nx,IntByReference Ny,
double[] weight, double[] y, IntByReference timestep, IntByReference obsstep, IntByReference steps_btw_obs);
项目:BIMplatform    文件:IfcEngineInterface.java   
int getConceptualFaceEx(Pointer instance, int index, IntByReference startIndexTriangles,
IntByReference noIndicesTriangles, IntByReference startIndexLines, IntByReference noIndicesLines,
IntByReference startIndexPoints, IntByReference noIndicesPoints, IntByReference startIndexFacesPolygons,
IntByReference noIndicesFacesPolygons, IntByReference startIndexConceptualFacePolygons, 
IntByReference noIndicesConceptualFacePolygons);
项目:BIMplatform    文件:IfcEngineInterface.java   
void engiGetAggrElement(Pointer aggregate, int elementIndex, int valueType,
IntByReference ptr);