void AtomicLines::thinLineEmission(ThermoData& thermo, double* const p_emis, CFreal& sumEmission, bool printDebug) { // Update the line data lineData(thermo); // Some constants const double ni = thermo.N(m_species_index); const double f1 = QE*QE*HP*ni/(2.0*ME*EPS0*mp_Q->Q(thermo)); // [W/sr] const double f2 = HP*C0*100.0/(KB*thermo.Tel()); // [cm] // Compute line dependent terms for (int i = 0; i < nLines(); ++i) { const LineData& line = m_line_data[i]; const double sigc = line.sigc; p_emis[i] = f1*sigc*sigc*sigc*std::exp(line.lnglflu-f2*line.Eu); if (printDebug) { CFLog(INFO, "AtomicLines::thinLineEmission => p_emis[" << i << "]=" << p_emis[i] << " \n"); CFLog(INFO, "AtomicLines::thinLineEmission => f1=" << f1 << ", sigc=" << sigc << " \n"); CFLog(INFO, "AtomicLines::thinLineEmission => ni=" << ni << ", mp_Q->Q(thermo)=" << mp_Q->Q(thermo) << " \n"); CFLog(INFO, "AtomicLines::thinLineEmission => " << m_atom<<", m_species_index=" << m_species_index << ", mp_Q->Q(thermo)=" << mp_Q->Q(thermo) << " \n"); } sumEmission+=p_emis[i]; } }
void SphereSet::readSpheresFromFile(const std::string& filename) { std::string line; std::ifstream myfile (filename); if (myfile.is_open()) { clear(); getline(myfile,line); std::stringstream lineData(line); int nb = 0; lineData >> nb; while (!myfile.eof()) { getline(myfile,line); if (line.empty()) continue; std::stringstream lineData(line); Sphere* newSphere = new Sphere(); lineData >> newSphere->m_center[0]; newSphere->m_center[0] = newSphere->m_center[0] * sphereScale; lineData >> newSphere->m_center[1]; newSphere->m_center[1] = newSphere->m_center[1] * sphereScale; lineData >> newSphere->m_center[2]; newSphere->m_center[2] = newSphere->m_center[2] * sphereScale; lineData >> newSphere->m_radius; newSphere->m_radius = newSphere->m_radius * sphereScale; lineData >> newSphere->m_cluster; m_spheres.push_back(newSphere); } myfile.close(); std::cout<<"read spheres from ["<<filename<<"] :" << nb <<" spheres!" <<m_spheres.size() <<std::endl; assert(nb == m_spheres.size()); }
extern "C" jlong Java_java_text_Bidi_ubidi_1setLine(JNIEnv* env, jclass, jlong ptr, jint start, jint limit) { UErrorCode status = U_ZERO_ERROR; UBiDi* sized = ubidi_openSized(limit - start, 0, &status); if (maybeThrowIcuException(env, "ubidi_openSized", status)) { return 0; } UniquePtr<BiDiData> lineData(new BiDiData(sized)); ubidi_setLine(uBiDi(ptr), start, limit, lineData->uBiDi(), &status); maybeThrowIcuException(env, "ubidi_setLine", status); return reinterpret_cast<uintptr_t>(lineData.release()); }
void AtomicLines::addStateParams(ThermoData &thermo,HSNBAtomicParameterSet &atomParams, CFreal cellDistance, CFuint localCellID, CFreal sig) { // m_f1 = 0.25e-4*QE*QE/(C0*C0*ME*EPS0*sig*sig); m_f1=F1TIMESSIGSQUARED/(sig*sig); // Assume thermoState has been set outside of this function lineData(thermo); m_f2 = HP*C0*100.0/(KB*thermo.Tel()); // [cm] double sum1 = 0, sum2 = 0, f; for (int j = 0; j < nLines(); ++j) { const LineData& line = m_line_data[j]; f = Voigt::humlicek(line.gaml, line.gamd, sig-line.sigc); f *= line.sigc*line.sigc*std::exp(line.lnglflu-m_f2*line.Eu); sum1 += f*line.nonbolt_l; sum2 += f*line.nonbolt_u; } // Split exponential to avoid overflow at high wavenumbers f = exp(0.5*sig*m_f2); m_Q = m_loc_params[localCellID].Q; m_ni = m_loc_params[localCellID].N; // CFLog(VERBOSE, "AtomicLines::addStateParams => Q= " << Q << ", ni="<< ni <<" \n"); atomParams.optThick+=m_f1*m_ni/m_Q*f*(f*sum1 - sum2/f)*cellDistance; if (std::isnan(atomParams.optThick)) { std::cout << "Computed singular optical thickness, printing telemetry: \n"; std::cout << "Enum: f1=" << m_f1 << ", sig=" << sig << ", ni=m_loc_params[" << localCellID << "].N=" << m_ni << "\n"; std::cout << "Denum: f2=" << m_f2 << ", thermo.Tel()=" << thermo.Tel() << ", f=" << f << ", sum1=" << sum1 << ", sum2=" << sum2 << " cellDistance=" << cellDistance << "\n"; } // CFLog(VERBOSE, "AtomicLines::addStateParams => f1=" << f1 << ", f="<< f << ", f2=" << f2 << ", sum1=" << sum1 << ", sum2=" <<sum2 << "\n"); // std::cout << "Enum: f1=" << f1 << ", sig=" << sig << ", ni=m_loc_params[" << localCellID << "].N=" << ni << "\n"; // std::cout << "Denum: f2=" << f2 << ", thermo.Tel()=" << thermo.Tel() << ", f=" << f << ", sum1=" << sum1 // << ", sum2=" << sum2 << " cellDistance=" << cellDistance << "\n"; // //DELETE LATER // CFLog(VERBOSE, "AtomicLines::addStateParams => optThick= " << f1*ni/Q*f*(f*sum1 - sum2/f)*cellDistance << " \n"); }
double AtomicLines::opticalThickness(ThermoData &thermo, const PhotonPath& path, int ic, double sig) { assert(ic <= path.nCells()); const double f1 = 0.25e-4*QE*QE/(C0*C0*ME*EPS0*sig*sig); // If the point in which we want the optical thickness is less than the last // point we computed, start from the beginning. In addition, if a -1 is // given for ic, then compute the whole path from the beginning. if (ic < m_last_loc || sig != m_last_sig) { if (ic == -1) ic = path.nCells(); m_opt_thick = 0.0; m_last_loc = 0; m_last_sig = sig; } double Q, ni, f2, f, sum1, sum2; // Loop over each cell in the los for (int i = m_last_loc; i < ic; ++i) { // Update line data for current point int id = path.cellID(i); thermo.setState(i); lineData(thermo); f2 = HP*C0*100.0/(KB*thermo.Tel()); // [cm] double sum1 = 0, sum2 = 0, f; for (int j = 0; j < nLines(); ++j) { const LineData& line = m_line_data[j]; f = Voigt::humlicek(line.gaml, line.gamd, sig-line.sigc); f *= line.sigc*line.sigc*std::exp(line.lnglflu-f2*line.Eu); sum1 += f*line.nonbolt_l; sum2 += f*line.nonbolt_u; } // Split exponential to avoid overflow at high wavenumbers f = exp(0.5*sig*f2); Q = m_loc_params[id].Q; ni = m_loc_params[id].N; m_opt_thick += f1*ni/Q*f*(f*sum1 - sum2/f)*path.cellDistance(i); } m_last_loc = ic; return m_opt_thick; }
int main() { DL_Dxf dxf; DL_WriterA* dw = dxf.out("dimension.dxf", DL_Codes::AC1015); // section header: dxf.writeHeader(*dw); dw->sectionEnd(); // section tables: dw->sectionTables(); // VPORT: dxf.writeVPort(*dw); // LTYPE: dw->tableLinetypes(1); dxf.writeLinetype(*dw, DL_LinetypeData("CONTINUOUS", "Continuous", 0, 0, 0.0)); dxf.writeLinetype(*dw, DL_LinetypeData("BYLAYER", "", 0, 0, 0.0)); dxf.writeLinetype(*dw, DL_LinetypeData("BYBLOCK", "", 0, 0, 0.0)); dw->tableEnd(); // LAYER: dw->tableLayers(1); dxf.writeLayer( *dw, DL_LayerData("0", 0), DL_Attributes("", 1, 0x00ff0000, 15, "CONTINUOUS") ); dw->tableEnd(); // STYLE: dw->tableStyle(1); DL_StyleData style("Standard", 0, 0.0, 1.0, 0.0, 0, 2.5, "txt", ""); style.bold = false; style.italic = false; dxf.writeStyle(*dw, style); dw->tableEnd(); // VIEW: dxf.writeView(*dw); // UCS: dxf.writeUcs(*dw); // APPID: dw->tableAppid(1); dxf.writeAppid(*dw, "ACAD"); dw->tableEnd(); // DIMSTYLE: dxf.writeDimStyle(*dw, 2.5, 0.625, 0.625, 0.625, 2.5); // BLOCK_RECORD: dxf.writeBlockRecord(*dw); dw->tableEnd(); dw->sectionEnd(); // BLOCK: dw->sectionBlocks(); dxf.writeBlock(*dw, DL_BlockData("*Model_Space", 0, 0.0, 0.0, 0.0)); dxf.writeEndBlock(*dw, "*Model_Space"); dxf.writeBlock(*dw, DL_BlockData("*Paper_Space", 0, 0.0, 0.0, 0.0)); dxf.writeEndBlock(*dw, "*Paper_Space"); dxf.writeBlock(*dw, DL_BlockData("*Paper_Space0", 0, 0.0, 0.0, 0.0)); dxf.writeEndBlock(*dw, "*Paper_Space0"); dw->sectionEnd(); // ENTITIES: dw->sectionEntities(); DL_Attributes attributes("0", 256, -1, -1, "BYLAYER"); // LINE: DL_LineData lineData(10, 5, 0, 30, 5, 0); dxf.writeLine(*dw, lineData, attributes); // DIMENSION: DL_DimensionData dimData(10.0, // def point (dimension line pos) 50.0, 0.0, 0, // text pos (irrelevant if flag 0x80 (128) set for type 0, 0.0, 0x1, // type: aligned with auto text pos (0x80 NOT set) 8, // attachment point: bottom center 2, // line spacing: exact 1.0, // line spacing factor "", // text "Standard", // style 0.0, // text angle 1.0, // linear factor 1.0); // dim scale DL_DimAlignedData dimAlignedData(10.0, // extension point 1 5.0, 0.0, 30.0, // extension point 2 5.0, 0.0); dxf.writeDimAligned(*dw, dimData, dimAlignedData, attributes); // end section ENTITIES: dw->sectionEnd(); dxf.writeObjects(*dw, "MY_OBJECTS"); dxf.writeObjectsEnd(*dw); dw->dxfEOF(); dw->close(); delete dw; return 0; }