com.sun.jna.ptr.DoubleByReference Java Examples
The following examples show how to use
com.sun.jna.ptr.DoubleByReference.
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: UnixSensorsManager.java From jSensors with Apache License 2.0 | 6 votes |
private void addSubFeatures(CSensors cSensors, CChip chip, List<CSubFeature> subFeatures) { for (final CSubFeature subFeature : subFeatures) { addDebugData(String.format("SubFeature type: %d", subFeature.type)); addDebugData(String.format("SubFeature name: %s", subFeature.name)); double value = 0.0; DoubleByReference pValue = new DoubleByReference(value); if (cSensors.sensors_get_value(chip, subFeature.number, pValue) == 0) { addDebugData(String.format("SubFeature value: %s", pValue.getValue())); if (subFeature.name.endsWith("_input")) { addData(String.format("%s", pValue.getValue())); break; } } else { addData("Could not retrieve value"); } } }
Example #2
Source File: SimpleModelDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 6 votes |
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); } }
Example #3
Source File: SimpleModelDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 6 votes |
public double[] getValues(int exchangeItemId, int locationIndex, ITime startTime, ITime endTime) { int valuesCount = getValuesCount(exchangeItemId, locationIndex, startTime, endTime); double[] values = new double[valuesCount]; startModelInstanceAccess(); int retVal = nativeDLL.m_simple_model_mp_get_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.GET_VALUES call, retVal= " + retVal); } return values; }
Example #4
Source File: EfdcDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 6 votes |
/** * Sets selected values for a scalar time series parameter. * * @param parameterNumber identifier for parameter * @param values new values * @param locationNumber array index of location * @param layerNumber array index of layer * @param startTime start time (inclusive) * @param endTime end time (inclusive) */ 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); } }
Example #5
Source File: EfdcDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 6 votes |
/** * Returns selected values for a scalar time series parameter. * * @param parameterNumber identifier for parameter * @param locationNumber array index of location * @param layerNumber array index of layer * @param startTime start time (inclusive) * @param endTime end time (inclusive) * @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; }
Example #6
Source File: EfdcDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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 #7
Source File: SimpleModelDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
private int getValuesCount(int exchangeItemId, int locationIndex, ITime startTime, ITime endTime) { int valuesCount = nativeDLL.m_simple_model_mp_get_values_count_for_time_span_( new IntByReference(exchangeItemId), new IntByReference(locationIndex), new DoubleByReference(startTime.getMJD()), new DoubleByReference(endTime.getMJD())); if (valuesCount < 0) { nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance)); throw new RuntimeException("Invalid result from dll.GET_VALUES_COUNT_FOR_TIMESPAN call, valuesCount= " + valuesCount); } return valuesCount; }
Example #8
Source File: SimpleModelDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
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(); }
Example #9
Source File: SimpleModelDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
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 #10
Source File: SimpleModelDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
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 #11
Source File: SimpleModelDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
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 #12
Source File: EfdcDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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 start time for compute action * @param toTime end time for compute action */ 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); } }
Example #13
Source File: EfdcDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
/** * Returns the number of time series (number of locations) * for the given subPeriod of a scalar time series parameter. * * @param parameterNumber identifier for parameter * @param locationNumber array index of location * @param startTime start time (inclusive) * @param endTime end time (inclusive) * @return timesCount */ private int getTimesCount(int parameterNumber, int locationNumber, ITime startTime, ITime endTime) { // The dll can handle different length time series, but we do not in this function int timesCount = nativeDLL.m_openda_wrapper_get_times_count_for_time_span_( new IntByReference(myModelInstanceId), new IntByReference(parameterNumber), new IntByReference(locationNumber), new DoubleByReference(startTime.getMJD() - referenceDateInMjd), new DoubleByReference(endTime.getMJD() - referenceDateInMjd)); if (timesCount < 0) { nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance)); throw new RuntimeException("Invalid result from dll.GET_TIMES_COUNT_FOR_TIME_SPAN call, timesCount= " + timesCount); } return timesCount; }
Example #14
Source File: EfdcDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
/** * Returns valuesCount for the given subPeriod of a scalar time series parameter. * This should return te product of timesCount and layerCount * * * @param parameterNumber identifier for parameter * @param locationNumber array index of location * @param startTime start time (inclusive) * @param endTime end time (inclusive) * @return valuesCount */ private int getValuesCount(int parameterNumber, int locationNumber, ITime startTime, ITime endTime) { // The dll can handle different length time series, but we do not in this function int valuesCount = nativeDLL.m_openda_wrapper_get_values_count_for_time_span_( new IntByReference(myModelInstanceId), new IntByReference(parameterNumber), new IntByReference(locationNumber), new DoubleByReference(startTime.getMJD() - referenceDateInMjd), new DoubleByReference(endTime.getMJD() - referenceDateInMjd)); if (valuesCount < 0) { nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance)); throw new RuntimeException("Invalid result from dll.GET_VALUES_COUNT_FOR_TIME_SPAN call, valuesCount= " + valuesCount); } return valuesCount; }
Example #15
Source File: EfdcDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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 #16
Source File: EfdcDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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 #17
Source File: EfdcDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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 #18
Source File: EfdcDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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 #19
Source File: SimpleModelDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
public void compute(ITime fromTime, ITime toTime) { startModelInstanceAccess(); int retVal = nativeDLL.m_simple_model_mp_compute_( new DoubleByReference(fromTime.getMJD()), new DoubleByReference(toTime.getMJD())); endModelInstanceAccess(); if (retVal != 0) { nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance)); throw new RuntimeException("Invalid result from dll.COMPUTE call, retVal= " + retVal); } }
Example #20
Source File: L_DnaHash.java From lept4j with Apache License 2.0 | 5 votes |
/** * @param nbuckets C type : l_int32<br> * @param initsize initial size of each dna that is made<br> * C type : l_int32<br> * @param dna array of L_Dna<br> * C type : L_Dna** */ public L_DnaHash(int nbuckets, int initsize, DoubleByReference dna) { super(); this.nbuckets = nbuckets; this.initsize = initsize; // if ((dna.length != this.dna.length)) // throw new IllegalArgumentException("Wrong array size !"); this.dna = dna; }
Example #21
Source File: TestSensorsLinux.java From jSensors with Apache License 2.0 | 5 votes |
public static void main(String[] args) { CSensors INSTANCE = Native.loadLibrary("sensors", CSensors.class); System.err.println("Return method: " + INSTANCE.sensors_init(null)); CChip result; int numSensor = 0; while ((result = INSTANCE.sensors_get_detected_chips(null, new IntByReference(numSensor))) != null) { // System.out.println("Found " + result); numSensor++; System.out.println("Adapter " + INSTANCE.sensors_get_adapter_name(result.bus)); CFeature feature; int numFeature = 0; while ((feature = INSTANCE.sensors_get_features(result, new IntByReference(numFeature))) != null) { // System.out.println("Found " + feature); numFeature++; String label = INSTANCE.sensors_get_label(result, feature); CSubFeature subFeature; int numSubFeature = 0; while ((subFeature = INSTANCE.sensors_get_all_subfeatures(result, feature, new IntByReference(numSubFeature))) != null) { double value = 0.0; DoubleByReference pValue = new DoubleByReference(value); int returnValue = INSTANCE.sensors_get_value(result, subFeature.number, pValue); System.out.println(label + " feature " + subFeature.name + ": " + pValue.getValue()); System.out.println(label + "returnValue: " + returnValue); System.out.println(); numSubFeature++; } } } }
Example #22
Source File: INotesNativeAPI64.java From domino-jna with Apache License 2.0 | 4 votes |
public boolean NSFItemGetNumber( long hNote, Memory ItemName, DoubleByReference retNumber);
Example #23
Source File: NotesNativeAPI64.java From domino-jna with Apache License 2.0 | 4 votes |
public native boolean NSFItemGetNumber( long hNote, Memory ItemName, DoubleByReference retNumber);
Example #24
Source File: INotesNativeAPI32.java From domino-jna with Apache License 2.0 | 4 votes |
public boolean NSFItemGetNumber( int hNote, Memory ItemName, DoubleByReference retNumber);
Example #25
Source File: NotesNativeAPI32.java From domino-jna with Apache License 2.0 | 4 votes |
public native boolean NSFItemGetNumber( int hNote, Memory ItemName, DoubleByReference retNumber);
Example #26
Source File: DPix.java From lept4j with Apache License 2.0 | 3 votes |
/** * @param w width in pixels<br> * C type : l_int32<br> * @param h height in pixels<br> * C type : l_int32<br> * @param wpl 32-bit words/line<br> * C type : l_int32<br> * @param refcount reference count (1 if no clones)<br> * C type : l_uint32<br> * @param xres image res (ppi) in x direction<br> * C type : l_int32<br> * @param yres image res (ppi) in y direction<br> * C type : l_int32<br> * @param data the double image data<br> * C type : l_float64* */ public DPix(int w, int h, int wpl, int refcount, int xres, int yres, DoubleByReference data) { super(); this.w = w; this.h = h; this.wpl = wpl; this.refcount = refcount; this.xres = xres; this.yres = yres; this.data = data; }
Example #27
Source File: IEfdcFortranNativeDLL.java From OpenDA with GNU Lesser General Public License v3.0 | 3 votes |
/** * Get the values for time dependent exchange item (e.g. a boundary condition), * for a certain time span. * * @param modelInstanceId (In:) The model instance identifier * @param exchangeItemId (In:) Integer identifying the exchange item * @param locationIndex (In:) Location index. Value == n means: the n-th lateral * @param layerIndex (In:) Layer index. * @param beginTime (In:) Begin of the time span * @param endTime (In:) End of the time span * @param valueCountRef (In:) Expected number of values * @param values (Out:) The retrieved values * @return 0: success, /=0: error */ int m_openda_wrapper_get_values_for_time_span_(IntByReference modelInstanceId, IntByReference exchangeItemId, IntByReference locationIndex, IntByReference layerIndex, DoubleByReference beginTime, DoubleByReference endTime, IntByReference valueCountRef, double[] values);
Example #28
Source File: L_Dna.java From lept4j with Apache License 2.0 | 3 votes |
/** * @param nalloc size of allocated number array<br> * C type : l_int32<br> * @param n number of numbers saved<br> * C type : l_int32<br> * @param refcount reference count (1 if no clones)<br> * C type : l_int32<br> * @param startx x value assigned to array[0]<br> * C type : l_float64<br> * @param delx change in x value as i --> i + 1<br> * C type : l_float64<br> * @param array number array<br> * C type : l_float64* */ public L_Dna(int nalloc, int n, int refcount, double startx, double delx, DoubleByReference array) { super(); this.nalloc = nalloc; this.n = n; this.refcount = refcount; this.startx = startx; this.delx = delx; this.array = array; }
Example #29
Source File: OsvrRenderManagerLibrary.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * @return True on success, false on failure (null pointer).<br> * Original signature : <code>OSVR_ReturnCode OSVR_Projection_to_OpenGL(double*, OSVR_ProjectionMatrix)</code><br> * @deprecated use the safer methods {@link #OSVR_Projection_to_OpenGL(java.nio.DoubleBuffer, com.jme3.system.osvr.osvrrendermanager.OSVR_ProjectionMatrix.ByValue)} and {@link #OSVR_Projection_to_OpenGL(com.sun.jna.ptr.DoubleByReference, com.jme3.system.osvr.osvrrendermanager.OSVR_ProjectionMatrix.ByValue)} instead */ @Deprecated public static native byte OSVR_Projection_to_OpenGL(DoubleByReference OpenGL_out, com.jme3.system.osvr.osvrrendermanager.OSVR_ProjectionMatrix.ByValue projection_in);
Example #30
Source File: OsvrRenderManagerOpenGLLibrary.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * @return True on success, false on failure (null pointer).<br> * Original signature : <code>OSVR_ReturnCode OSVR_Projection_to_OpenGL(double*, OSVR_ProjectionMatrix)</code><br> * @deprecated use the safer methods {@link #OSVR_Projection_to_OpenGL(java.nio.DoubleBuffer, com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ProjectionMatrix.ByValue)} and {@link #OSVR_Projection_to_OpenGL(com.sun.jna.ptr.DoubleByReference, com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ProjectionMatrix.ByValue)} instead */ @Deprecated public static native byte OSVR_Projection_to_OpenGL(DoubleByReference OpenGL_out, com.jme3.system.osvr.osvrrendermanageropengl.OSVR_ProjectionMatrix.ByValue projection_in);