VR-Vantage 3.1 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ssMaterialSet.h
Go to the documentation of this file.
1 
2 // Copyright JRM Enterprises, Inc. 2004 - 2012
3 // All rights reserved.
4 //
5 // This code is the intellectual property of JRM Enterprises, Inc.
6 // It may not be used or released as source or compiled binary form
7 // without the prior written consent of JRM Enterprises, Inc.
8 //
9 // Original Author: Eric Olson Date: May 2004
11 
12 #ifndef _ssMaterialSet_
13 #define _ssMaterialSet_
14 
15 #ifdef WIN32
16 #include <windows.h>
17 #endif
18 
19 #include "ssEnvironment.h"
20 #include "ssdllexport.h"
21 #include "ssMaterialTable.h"
22 #include "ssMaterialProperties.h"
23 
24 #include <atomic>
25 
26 #define NUM_DC_LABELS 10
27 
28 namespace makSigSim
29 {
30  class DtTask;
31  class DtTaskScheduler;
32  class DtDynamicThermalSpinupTask;
33 }
34 
36 // ssMaterialSet
47 {
48 
49 public:
50 
52  typedef struct {
53  double BaseSurface;
54  double CosSurface;
55  double Surface;
56  } ssEmission;
57 
59  typedef struct {
60  double BaseSurfaceTemp;
61  double CosSurfaceTemp;
62  double QdiffH;
63  double SurfaceTemp;
64  } ssTemperature;
65 
67  typedef struct {
68  char materialName[256];
69  double visualAvg;
70  double visualDev;
71  double IMType;
72  double NVGGain;
73  double FLIRGain;
74  double RFGain;
76 
77 
78 
80  // ssMaterialSet
84  ssMaterialSet();
85 
87  //ssMaterialSet
91  ~ssMaterialSet();
92 
94  //*getResponseData
152  float *getResponseData(ssSensor *sensor, unsigned int &numMaterials, unsigned int &numBins, unsigned int &numParameters); // BRDF or radar
153 #if(0)
154 
155  //*getBRDFResponseData
164  float *getBRDFResponseData(ssSensor *sensor, unsigned int &numMaterials, unsigned int &numBins, unsigned int &numParameters);
165 #else
166 
167  //*getPhongResponseData
176  float *getPhongResponseData(ssSensor *sensor, unsigned int &numMaterials, unsigned int &numBins, unsigned int &numParameters);
177 
179  //*getSandfordRobertsonResponseData
188  float *getSandfordRobertsonResponseData(ssSensor *sensor, unsigned int &numMaterials, unsigned int &numBins, unsigned int &numParameters);
189 #endif
190 
192  //*getRadarResponseData
201  float *getRadarResponseData(ssSensor *sensor, unsigned int &numMaterials, unsigned int &numBins, unsigned int &numParameters);
202 
204  //*getSonarResponseData
213  float *getSonarResponseData(ssSensor *sensor, unsigned int &numMaterials, unsigned int &numBins, unsigned int &numParameters);
214 
215 
217  // getVisualdata
226  float *getVisualData(unsigned int &numMaterials, ssSensor *sensor);
227 
228 
230  //*getMSBandDHR
241  float getMSBandDHR(ssMaterialTable *table, ssSensor *sensor, int msindex, double ax, double bx, double thetarad);
242 
243 #if(0)
244 
246  //getBRDFMaterialResponse
257  void getBRDFMaterialResponse(ssSensor *sensor, unsigned int matCode, float &ambient, float &emission, float &cosEmission);
258 
259 
260 
261 #else
262 
264  //getPhongMaterialResponse
275  void getPhongMaterialResponse(ssSensor *sensor, unsigned int matCode,
276  float &ambient, float &emission, float &cosEmission);
277 
278 
280  //getSandfordRobertson
293  void getSanfordRobertson(ssSensor *sensor, unsigned int matCode, float &reflectance, float &lobeWidth, float &emissivity, float &grazingB) ;
294 
295 #endif
296 
298  //getNumberMaterials
303  unsigned int getNumberMaterials();
304 
306  //getNumberResponses
314  unsigned int getNumberResponses();
315 
317  //getNumberResponseValues
322  unsigned int getNumberResponseValues();
323 
325  //initializeEmats
330  bool initializeEmats (ssEnvironment *env);
331 
333  // getEmatBulkProps
334  //
335  // description: gets the Eigenmaterial bulk properties (not sensor or environment - dependent)
336  //
337  // \param {density*specificheat*thickness}
338  // \param {lateralconductivity*thickness}
339  // \param Emat index
340  //
341  void getEmatBulkProps(double &inertia, double &latconduct, unsigned int index);
342 
344  // getEmatEmission
345  //
357  void getEmatEmission(double &baseEmission, double &cosEmission, double &twoSideFlag, double &absorbRatio, double &conductionFactor, double &shadowFlag, ssSensor *sensor, unsigned int index);
358 
360  // getEmatIndex
365  int getEmatIndex(unsigned int ematIndex);
366 
368  //setThermalSpinUpTime
379  bool setThermalSpinUpTime(double spinUp);
380 
382  //getThermalSpinUp
387  double getThermalSpinUpTime();
388 
390  //*setFullResponseEnable
399  void setFullResponseEnable(bool flag);
400 
402  //*getFullResponseEnable
407  bool getFullResponseEnable();
408 
410  //*setIncludeEmissivity
417  void setIncludeEmissivity(bool flag);
418 
420  //*getIncludeEmissivity
425  bool getIncludeEmissivity();
426 
428  //*getMaximumTemperature
433  double getMaximumTemperature();
434 
436  //*getMinimumTemperature
441  double getMinimumTemperature();
442 
444  //getNumberTemperatures
449  unsigned int getNumberTemperatures();
450 
452  //setNumberTemperatures
457  void setNumberTemperatures(unsigned int n);
458 
460  //setAutoRadianceScale
465  void setAutoRadianceScale(bool flag);
466 
468  //isAutoRadianceScale
475  bool isAutoRadianceScale();
476 
478  //getAverageAbsorbRatio
484  double getAverageAbsorbRatio();
485 
487  //getAverageTwoSidedFlag
493  double getAverageTwoSidedFlag();
494 
496  //getConductionFactor
502  double getConductionFactor(int mtlIndex);
503 
505  //getAverageConductionFactor
511  double getAverageConductionFactor();
512 
514  //setAbsorbRatio
522  void setAbsorbRatio(double absorbRatio);
523 
525  //getAbsorbRatio
531  double getAbsorbRatio();
532 
534  //setTwoSidedFlag
542  void setTwoSidedFlag(double twoSidedFlag);
543 
545  //getTwoSidedFlag
551  double getTwoSidedFlag();
552 
554  //setAppendLightData
561  void setAppendLightData(bool flag);
562 
564  //isAppendLightData
571  bool isAppendLightData();
572 
574  //isEmatType
579  bool isEmatType();
580 
582  //setEmatTextureType
588  void setEmatType(bool flag);
589 
591  //setNumberEMats
596  void setNumberEMats(unsigned int numEmats);
597 
599  //getNumberEMats
604  unsigned int getNumberEMats();
605 
607  //*getMaterialPropertyTablePtr
612  ssMaterialProperties::MaterialSystemTablePtrType getMaterialPropertyTablePtr();
613 
615  //*getEmatFractionsPtr
620  MATERIAL_EIGENFRACTIONS *getEmatFractionsPtr();
621 
623  //isIrradianceCacheDirty
629  bool isIrradianceCacheDirty(ssEnvironment *env) ;
630 
631 
633  //isTemperatureCacheDirty
639  bool isTemperatureCacheDirty(ssEnvironment *env) ;
640 
642  //forceCacheUpdate
646  void forceCacheUpdate();
647 
649  //getUseInstance
654  bool getUseInstance();
655 
657  //setUseInstance
661  void setUseInstance(bool flag);
662 
664  //initActiveRegions
668  void initActiveRegions();
669 
671  //getActiveMaterials
675  ssMaterialProperties *getActiveMaterials();
676 
678  //getInactiveMaterials
682  ssMaterialProperties *getInactiveMaterials();
683 
685  //setActiveRegion
692  bool setActiveRegion(unsigned int index, bool activeFlag);
693 
695  //sendActiveRegionImpulse
701  bool sendActiveRegionImpulse(unsigned int index);
702 
704  //getActiveRegionImpulseCount
709  int getActiveRegionImpulseCount(unsigned int index);
710 
712  //getActiveRegionImpulseDeltaTime
717  double getActiveRegionImpulseDeltaTime(unsigned int index);
718 
720  //getActiveRegion
726  bool getActiveRegion(unsigned int index);
727 
729  //getNumberActiveRegions
735  int getNumberActiveRegions();
736 
738  //getActiveRegionName
744  char *getActiveRegionName(int index);
745 
747  //hasActiveRegionsFile
754  bool hasActiveRegionsFile(char *msName = NULL);
755 
757  // ssMaterialSet::getAcousticImpedanceData
758  //
759  // description: gets the acoustic impedance data for this material set
760  //
761  // parameter: nmats - dimension of x (num materials)
762  // ncomps - dimension of y (num components)
763  //
764  // return: float pointer to material set's acoustic impedance data
765  //
766  float *getAcousticImpedanceData(unsigned int &nmats, unsigned int &ncomps);
767 
769  // getRCSData
780 #if 0
781  float *getRCSData(ssSensor *sensor, unsigned int &numBins, unsigned int &x, unsigned int &y);
782 #else
783 
784 
785  float *getRCSData(ssSensor *sensor, unsigned int &numBins, unsigned int &x, unsigned int &y, unsigned int &z);
786 #endif
787 
789  //setNumberRCSangle
795  void setNumberRCSangle(unsigned int angles);
796 
798  //getNumberRCSangle
804  unsigned int getNumberRCSangle();
805 
807  //hasIntensityModulationFile
813  bool hasIntensityModulationFile();
814 
816  //loadIntensityModulationFile
821  bool loadIntensityModulationFile();
822 
824  //writeIntensityModulationFile
829  void writeIntensityModulationFile();
830 
832  //setIntensityModulationParameters
836  void setIntensityModulationParameters(ssIntensityModulationParameters imodGain, int index);
837 
839  //setIntensityModulationParameters
843  void setIntensityModulationParameters(double visAvg, double visDev, double IMType, double NVGGain, double IRGain, double RFGain, int index);
844 
846  //getIntensityModulationParameters
851  void getIntensityModulationParameters(ssIntensityModulationParameters &imodGain, int index);
852 
854  //getIntensityModulationParameters
859  void getIntensityModulationParameters(double &visAvg, double &visDev, double &IMType, double &NVGGain, double &FLIRGain, double &RFGain, int index);
860 
862  //getMSFilename
867  const char *getMSfilename();
868 
870  //setFixedTempBCs
877  void setFixedTempBCs();
878 
879 private:
881  //setWeakSelfPointer
884  void setWeakSelfPointer(std::shared_ptr<ssMaterialSet>& set);
885 
887  //initialize
894  bool initialize(ssEnvironment *env, char *dataDir, char* cacheDir);
895 
897  //update
903  void update(ssSensor *sensor, ssEnvironment *env);
904 
905 
907  //insertMaterialTable
913  bool insertMaterialTable(ssSensor *sensor);
914  // helpers
915 #if(0)
916  bool insertBRDFMaterialTable(ssSensor *sensor);
917 #else
918  bool insertPhongMaterialTable(ssSensor *sensor);
919  bool insertSRMaterialTable(ssSensor *sensor);
920 #endif
921  bool insertRadarMaterialTable(ssSensor *sensor);
922  bool insertSonarMaterialTable(ssSensor *sensor);
923 
924  // Helpers, do not call directly..
925 #if(0)
926  void updateBRDF(ssSensor *sensor, ssEnvironment *env, bool dirty);
927 #else
928  void updatePhong(ssSensor *sensor, ssEnvironment *env, bool dirty);
929  void updateSR(ssSensor *sensor, ssEnvironment *env, bool dirty);
930 #endif
931  void updateRadar(ssSensor *sensor, ssEnvironment *env, bool dirty);
932  void updateSonar(bool dirty);
933 
935  //getTemperatureData
941  void getTemperatureData(ssEnvironment *env);
942 
943 
945  //thermalSpinUp
952  bool thermalSpinUp(ssEnvironment *env);
953 
955  // dynamicThermalSpinUp
956  //
963  bool dynamicThermalSpinUp(ssEnvironment *env, float deltaTime, std::atomic<bool>* cancelled);
964 
966  //computeSpectralReflectanceParameters
972  bool computeSpectralReflectanceParameters(ssSensor *sensor, ssMaterialTable *table);
973 
975  //computeBaseAndLoadedRadiances
984  void computeBaseAndLoadedRadiances(ssTemperature inTemp, double ax,
985  double bx, double emissivity, ssEmission &emission);
986 
988  //updateFullTemperatureCache
992  void updateFullTemperatureCache(ssEnvironment *env);
993 
995  //queryTemperatureCache
1002  bool queryTemperatureCache(ssEnvironment *env);
1003 
1005  //getTemperatureCache
1010  ssTemperature *getTemperatureCache();
1011 
1012 
1014  //saveTemperatureCache
1019  void saveTemperatureCache(ssEnvironment *env);
1020 
1022  //getEmatTemperatureCache
1027  ssTemperature *getEmatTemperatureCache();
1028 
1030  //compareFloat
1037  bool compareFloat(float float1, float float2);
1038 
1040  //loadActiveRegionsFile
1047  bool loadActiveRegionsFile();
1048 
1050  // dynamicThermalSpinUpAsync
1051  //
1058  void dynamicThermalSpinUpAsync(ssEnvironment* env, float deltaTime, makSigSim::DtTaskScheduler* ts);
1059 
1061  // needResponseBufferUpdate
1062  //
1066  bool needResponseBufferUpdate() const;
1067 
1074 
1086 
1093 
1102 
1118  unsigned int m_numEMats;
1119 
1124 
1127 
1128  unsigned int m_numRCSangles;
1129 
1132 
1133  struct Implementation;
1134  Implementation *m_impl;
1136 
1137  friend class ssObject;
1138  friend class SigSimRT;
1139  friend class makSigSim::DtDynamicThermalSpinupTask;
1140 };
1141 
1142 #endif // _ssMaterialSet_
1143 


Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)