10 #include <configure.hpp>
215 std::stringstream msg;
216 std::vector<std::string> dstr = Vectorize<std::string>(str.c_str(),
" ,");
217 for (
int i = 0; i < dstr.size(); ++i) {
218 if (dstr[i] ==
"static") {
220 }
else if (dstr[i] ==
"dynamic") {
222 }
else if (dstr[i] ==
"bin") {
224 }
else if (dstr[i] ==
"lbl") {
226 }
else if (dstr[i] ==
"ck") {
228 }
else if (dstr[i] ==
"planck") {
230 }
else if (dstr[i] ==
"star") {
232 }
else if (dstr[i] ==
"spher") {
234 }
else if (dstr[i] ==
"only") {
236 }
else if (dstr[i] ==
"normalize") {
238 }
else if (dstr[i] ==
"write_bin_radiance") {
241 msg <<
"### FATAL ERROR in function setRadiatino" << std::endl
242 <<
"flag:" << dstr[i] <<
"unrecognized" << std::endl;
249 msg <<
"### FATAL ERROR in function setRadiation" << std::endl
250 <<
"ck cannot be used with lbl." << std::endl;
257 for (
int k = 1; k < npmom; k++) pmom[k] = 0.;
261 if (gg <= -1. || gg >= 1.)
262 std::cout <<
"getmom--bad input variable gg" << std::endl;
263 for (
int k = 1; k <= npmom; k++) pmom[k] = pow(gg, (Real)k);
273 Real
const *pmom,
int nlayer,
int npmom) {
274 for (
int i = 0; i < nlayer; ++i) *(buf++) = tau[i];
275 for (
int i = 0; i < nlayer; ++i) *(buf++) = ssa[i];
276 for (
int i = 0; i < nlayer; ++i)
277 for (
int j = 0;
j < npmom; ++
j) *(buf++) = pmom[i * npmom +
j];
281 int slyr,
int npmom,
int nblocks,
int npmom_max) {
282 npmom_max =
std::max(npmom_max, npmom);
283 for (
int n = 0; n < nblocks; ++n) {
284 for (
int i = 0; i < slyr; ++i) tau[n * slyr + i] = *(buf++);
285 for (
int i = 0; i < slyr; ++i) ssa[n * slyr + i] = *(buf++);
286 for (
int i = 0; i < slyr; ++i) {
287 for (
int j = 0;
j < npmom; ++
j)
288 pmom[n * slyr * npmom_max + i * npmom_max +
j] = *(buf++);
289 for (
int j = npmom;
j < npmom_max; ++
j)
290 pmom[n * slyr * npmom_max + i * npmom_max +
j] = 0.;
296 std::vector<std::string> dstr = Vectorize<std::string>(str.c_str());
297 int nray = dstr.size();
300 auto jt = dstr.begin();
301 for (
auto it = ray->begin(); it != ray->end(); ++it, ++jt) {
303 sscanf(jt->c_str(),
"(%lf,%lf)", &it->mu, &it->phi);
double deg2rad(double phi)
double max(double x1, double x2, double x3)
const uint64_t WriteBinRadiance
const uint64_t LineByLine
const uint64_t CorrelatedK
void get_phase_momentum(Real *pmom, int iphas, Real gg, int npmom)
void set_radiation_flags(uint64_t *flags, std::string str)
void packSpectralProperties(Real *buf, Real const *tau, Real const *ssa, Real const *pmom, int nlayer, int npmom)
void unpackSpectralProperties(Real *tau, Real *ssa, Real *pmom, Real const *buf, int slyr, int npmom, int nblocks, int npmom_max)
void read_radiation_directions(std::vector< Direction > *ray, std::string str)