schiff_optical_properties.h (1886B)
1 /* Copyright (C) 2015-2016 CNRS 2 * 3 * This program is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, either version 3 of the License, or 6 * (at your option) any later version. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 15 16 #ifndef SCHIFF_OPTICAL_PROPERTIES_H 17 #define SCHIFF_OPTICAL_PROPERTIES_H 18 19 #include <rsys/dynamic_array.h> 20 #include <rsys/rsys.h> 21 22 struct sschiff_material_properties; 23 24 struct schiff_optical_properties { 25 double W; /* Wavelength */ 26 double Nr; /* Real part of the relative refractive index */ 27 double Kr; /* Imaginary part of the relative refractive index */ 28 double Ne; /* Refractive index of the medium */ 29 }; 30 31 static INLINE char 32 schiff_optical_properties_check 33 (const struct schiff_optical_properties* props) 34 { 35 ASSERT(props); 36 return props->W >= 0.0 37 && props->Nr >= 0.0 38 && props->Kr >= 0.0 39 && props->Ne >= 0.0; 40 } 41 42 extern LOCAL_SYM res_T 43 schiff_optical_properties_load 44 (struct schiff_optical_properties** props, /* Stretchy array */ 45 const char* filename); 46 47 extern LOCAL_SYM res_T 48 schiff_optical_properties_load_stream 49 (struct schiff_optical_properties** props, /* Stretchy array */ 50 FILE* stream, 51 const char* stream_name); 52 53 extern LOCAL_SYM void 54 schiff_optical_properties_fetch 55 (struct schiff_optical_properties* properties, /* Stetchy array */ 56 const double wavelength, 57 struct sschiff_material_properties* props); 58 59 #endif /* SCHIFF_OPTICAL_PROPERTIES_H */ 60