Пример #1
0
	// =======================================================
	// * Display the crystal cell parameters in human-readable
	//   form
	void
	CrystalCell::print(
		ostream&		os
	)
	{
    ios_base::fmtflags    savedFlags = os.flags();
    
    os << "CrystalCell { basisSize=" << basisSize << " basisCount=" << basisCount << endl;
    os.setf(ios::fixed);
    for ( unsigned i = 0 ; i < basisCount ; i++ ) {
      os.setf(ios::left);
      os << setw(3) << basis[i].atomicNumber << ' ';
      os.unsetf(ios::left);
      os << setprecision(6) << setw(10) << basis[i].atomPosition.x << ' ';
      os << setprecision(6) << setw(10) << basis[i].atomPosition.y << ' ';
      os << setprecision(6) << setw(10) << basis[i].atomPosition.z << endl;
    }
    os.unsetf(ios::fixed);
    //  Ask our superclass to print its info, too:
    Cell::print(os);
    os << "}\n";
    os.setf(savedFlags);
	}
Пример #2
0
inline void print_literal(ostream & stream, double v)
{
    using namespace std;
    //cout << "printing double literal" << endl;
#if 1
    char buf[128];
    snprintf(buf, 128, "%a", v);
    stream << buf;
#endif
#if 0
    stream.unsetf(std::ios_base::floatfield);
    stream << std::showpoint << std::setprecision(12);
    stream << v;
#endif
}
//save the order information to a file or display on screen
void outputSalesInfo(ostream& target, SalesInfo& salesInfoObj)
{
//declare local variables
    int    salesPersonId;
    string lastName, firstName;
    double rate;
    int    qty;

//set the precision for rate
    target.setf(ios::fixed);
    target.setf(ios::showpoint);
    target.precision(2);

//Have the class return the private values to the local variables.
//Then store them in the file.
    salesPersonId = salesInfoObj.getSalesPersonId();
    firstName     = salesInfoObj.getFirstName();
    lastName      = salesInfoObj.getLastName();
    rate          = salesInfoObj.getRate();
    qty           = salesInfoObj.getQty();

    if(target == cout)
        target << "\n\nSalesPerson's Information Saved! \n";

    target.setf(ios::left);
    target << setw(6)  << salesPersonId
           << setw(18) << firstName
           << setw(18) << lastName;
    target.unsetf(ios::left);

    target << setw(6) << rate;
    target << setw(4) << qty;
    target << endl;

    return;
}
Пример #4
0
 /*-------------------*/
 inline void reset_options() {
   if (o == NULL) return; 
   o->unsetf(ios_base::scientific); 
   o->unsetf(ios_base::fixed); 
   o->precision(3); 
 }
Пример #5
0
void generate_inp(const IO_Header& io, ostream& out)
{                 
    out.setf(ios_base::scientific);
    out.precision(14);
    
    out << io.spectrum_identifier << endl;
    out << io.sample_identifier << endl;
    out << io.project << endl;
    out << io.sample_location << endl;    
    out << io.latitude << endl;
    out << io.latitude_unit << endl;
    out << io.longitude << endl;
    out << io.longitude_unit << endl;
    out << io.sample_height << endl;
    out << io.sample_weight << endl;
    out << io.sample_density << endl;
    out << io.sample_volume << endl;
    out << io.sample_quantity << endl;
	out << io.sample_uncertainty << endl;
    out << io.sample_unit << endl;
    out << io.detector_identifier << endl;
    out << io.year << endl;
    out << io.beaker_identifier << endl;
    out << io.sampling_start << endl;
    out << io.sampling_stop << endl;
    out << io.reference_time << endl;
    out << io.measurement_start << endl;
    out << io.measurement_stop << endl;
    out << io.real_time << endl;
    out << io.live_time << endl;
    out << io.measurement_time << endl;        
    out << io.dead_time << endl;        
    out << io.nuclide_library << endl;	
    out << io.lim_file << endl;
    out << io.channel_count << endl;
    out << io.format << endl;
    out << io.record_length << endl;                
    out << io.FWHMPS << endl;
    out << io.FWHMAN << endl;
    out << io.THRESH << endl;
    out << io.BSTF << endl;
    out << io.ETOL << endl;
    out << io.LOCH << endl;
    out << io.ICA << endl;
    out << io.energy_file << endl;
    out << io.pef_file << endl;
    out << io.tef_file << endl;
    out << io.background_file << endl;
    out << io.PA1 << endl;
    out << io.PA2 << endl;
    out << io.PA3 << endl;
    out << io.PA4 << endl;
    out << io.PA5 << endl;
    out << io.PA6 << endl;
    out << io.print_out << endl;
    out << io.plot_out << endl;
    out << io.disk_out << endl;
    out << io.ex_print_out << endl;
    out << io.ex_disk_out << endl;
    out << io.PO1 << endl;
    out << io.PO2 << endl;
    out << io.PO3 << endl;
    out << io.PO4 << endl;
    out << io.PO5 << endl;
    out << io.PO6 << endl;
    out << io.complete << endl;
    out << io.analysed << endl;
    out << io.ST1 << endl;
    out << io.ST2 << endl;
    out << io.ST3 << endl;
    out << io.ST4 << endl;
    out << io.ST5 << endl;
    out << io.ST6 << endl;
    
    out.unsetf(ios_base::scientific);
}
Пример #6
0
void ImagerDoc::NavigationFiles(ostream & out1, ostream & out2){



  out1.setf(std::ios::left | std::ios::showpoint | std::ios::fixed);

  out1 << std::setw(19) <<                         NW_lat_of_frame             << "DLAT       INPUT LATITUDE\n\n";
  out1 << std::setw(19) <<                         NW_lon_of_frame             << "DLON       INPUT LONGITUDE\n\n";
  out1 << std::setw(19) << std::setprecision(2) << float(N_line_of_frame)      << "L(1)       INPUT LINE FOR IMAGER\n\n";
  out1 << std::setw(19) << std::setprecision(2) << float(477)        << "L(2)       INPUT LINE FOR SOUNDER\n\n";
  out1 << std::setw(19) << std::setprecision(4) << float(W_pix_of_frame)      << "IP(1)      INPUT PIXEL FOR IMAGER\n\n";
  out1 << std::setw(19) << std::setprecision(4) << float(910)        << "IP(2)      INPUT PIXEL FOR SOUNDER\n\n";
  out1 << std::setw(19) <<                         2                 << "KEY        1-LAT/LONG-->LINE/PIX  2-LINE/PIX-->LAT/LONG\n\n";
  out1 << std::setw(19) <<                         Iscan.imcStatus() << "IMC        0-ON, 1-OFF(COMPUTE CHANGES IN ORBIT)\n\n";
  out1 << std::setw(19) <<                         1                 << "INSTR      1-IMAGER, 2-SOUNDER\n\n";

  out1.unsetf(std::ios::left);
  out1 << std::setfill('0');

  out1 << std::setw(4)  <<                          EpochDate.year()                                << "               NYE        EPOCH YEAR\n\n";
  out1 << std::setw(3)  <<                          EpochDate.day()                                 << "                NDE        EPOCH DAY\n\n";
  out1 << std::setw(2)  <<                          EpochDate.hrs()                                 << "                 NHE        EPOCH HOUR\n\n";
  out1 << std::setw(2)  <<                          EpochDate.min()                                 << "                 NME        EPOCH MINUTES\n\n";
  out1 << std::setw(6)  << std::setprecision(3) << (float)EpochDate.sec() + EpochDate.msec()/1000.0 << "             SE         EPOCH SECONDS\n\n";
  out1 << std::setw(4)  <<                          T_current_header.year()                                    << "               NY         CURRENT YEAR\n\n";
  out1 << std::setw(3)  <<                          T_current_header.day()                                     << "                ND         CURRENT DAY\n\n";
  out1 << std::setw(2)  <<                          T_current_header.hrs()                                     << "                 NH         CURRENT HOUR\n\n";
  out1 << std::setw(2)  <<                          T_current_header.min()                                     << "                 NM         CURRENT MINUTES\n\n";
  out1 << std::setw(6)  << std::setprecision(3) << (float)T_current_header.sec() + T_current_header.msec()/1000.0         << "             S          CURRENT SECONDS\n\n";

  out1.setf(std::ios::left | std::ios::showpoint | std::ios::fixed);
  out1 << std::setfill(' ');


  out1 << std::setw(19) << (uint)ew_cycles   << "IEW_NAD_CY  IMAGER  EW NADIR POSITION (CYCLES PORTION)\n\n";
  out1 << std::setw(19) << ew_incr         << "IEW_NAD_INC IMAGER  EW NADIR POSITION (INCREMENTS PORTION)\n\n";
  out1 << std::setw(19) << (uint)ns_cycles   << "INS_NAD_CY  IMAGER  NS NADIR POSITION (CYCLES PORTION)\n\n";
  out1 << std::setw(19) << ns_incr         << "INS_NAD_INC IMAGER  NS NADIR POSITION (INCREMENTS PORTION)\n\n";

  out1 << std::setw(19) << 2             << "SEW_NAD_CY  SOUNDER EW NADIR POSITION (CYCLES PORTION)\n\n";
  out1 << std::setw(19) << 1293          << "SEW_NAD_INC SOUNDER EW NADIR POSITION (INCREMENTS PORTION)\n\n";
  out1 << std::setw(19) << 4             << "SNS_NAD_CY  SOUNDER NS NADIR POSITION (CYCLES PORTION)\n\n";
  out1 << std::setw(19) << 868           << "SNS_NAD_INC SOUNDER NS NADIR POSITION (INCREMENTS PORTION)\n\n";                                  




  EpochDate.print(out2);
  out2 << "\tEpoch Time\n";
  T_current_header.print(out2);
  out2 << "\tMost Recent Header Time\n";
  T_sps_current.print(out2);
  out2 << "\tCurrent SPS Time\n";


  out2.setf(std::ios::left | std::ios::showpoint | std::ios::fixed);
  out2.precision(14);
  out2 << std::setfill(' ');

  out2 << std::setw(24) << (uint)instrument() << "Instrument\n";


  out2 << std::setw(24) << (double)ReferenceLongitude            << "Reference Longitude\n";
  out2 << std::setw(24) << (double)ReferenceRadialDistance       << "Reference Radial Distance\n";
  out2 << std::setw(24) << (double)ReferenceLatitude             << "Reference Radial Latitude\n";
  out2 << std::setw(24) << (double)ReferenceOrbitYaw             << "Reference Orbit Yaw\n";

  out2 << std::setw(24) << (double)ReferenceAttitudeRoll         << "ReferenceAttitudeRoll\n";
  out2 << std::setw(24) << (double)ReferenceAttitudePitch        << "Reference Attitude Pitch\n";
  out2 << std::setw(24) << (double)ReferenceAttitudeYaw          << "ReferenceAttitudeYaw\n";

  out2 << std::setw(24) << EpochDate.ieeea()                     << "Epoch Date\n";
  out2 << std::setw(24) << EpochDate.ieeeb()                     << "Epoch Date\n";

  out2 << std::setw(24) << (double)IMCenableFromEpoch            << "IMC enable from epoch\n";
  out2 << std::setw(24) << (double)CompensationRoll              << "CompensationRoll\n";
  out2 << std::setw(24) << (double)CompensationPitch             << "Compensation Pitch\n";
  out2 << std::setw(24) << (double)CompensationYaw               << "Compensation Yaw\n";

  for(int i = 0; i < 13; i++){
    out2 << std::setw(24) << (double)ChangeLongitude[i]          << "Change Longitude "<< i << "\n";
  }
  for (int j=0; j < 11 ; j++){
    out2 << std::setw(24) << (double)ChangeRadialDistance[j]     << "Change Radial Distance " << j << "\n";
  }
  for(int k=0; k < 9; k++){
    out2 << std::setw(24) << (double)SineGeocentricLatitude[k]   << "Change Geocentric Latitude " << k << "\n";
  }
  for(int k=0; k < 9; k++){
    out2 << std::setw(24) << (double)SineOrbitYaw[k]             << "Sine Orbit Yaw " << k << "\n";
  }
  out2 << std::setw(24) << (double)DailySolarRate                << "Daily Solar Rate\n";
  out2 << std::setw(24) << (double)ExponentialStartFromEpoch     << "Exponential Start From Epoch\n";
  
  //  out2 << "\nRoll Angle\n";
  out2 << RollAngle;

  //out2 <<"\nPitch Angle\n";
  out2 << PitchAngle;
  
  //out2 << "\nYaw Angle\n";
  out2 << YawAngle;
  
  //out2 << "\nRoll Misalignment\n";
  out2 << RollMisalignment;
  
  //out2 << "\nPitch Misalignment\n";
  out2 << PitchMisalignment;

  // these aren't actually needed for gimloc
  out2 << std::setw(24) << N_Line_In_Scan  << "Northern-most visible detector scan line in current scan\n";
  out2 << std::setw(24) << W_pix_of_frame  << "Western-most visible pixel in current frame\n";
  out2 << std::setw(24) << E_pix_of_frame  << "Eastern-most visible pixel in current frame\n";
  out2 << std::setw(24) << N_line_of_frame  <<"Northern-most visible pixel in current frame\n";
  out2 << std::setw(24) << S_line_of_frame  <<"Southern-most visible pixel in current frame\n";  
    
  for ( int l = 0; l < 4; l++)
    out2 << Imc_identifier[l];
  out2 << "                    IMC identifier \n";


  out2 << "\n\n";
}
Пример #7
0
	// =======================================================
	// * Generate a listing of cartesian coordinates for a
	//   cell propogated through (i,j,k) translations.  The
	//   coordinates are centered on the origin.
	void
	CrystalCell::Propogate(
		unsigned		i,
		unsigned		j,
		unsigned		k,
		ostream&		os,
		unsigned		opts
	)
	{
    TVector3D             xform = { 0.0 , 0.0 , 0.0 };
    TPoint3D              pt;
    unsigned              li,lj,lk,bb;
    ios_base::fmtflags    savedFlags = os.flags();
    ANSRDB*               periodicTable = ANSRDB::DefaultANSRDB();
    
    //  Vector-transform to be used on each point such
    //  that we center the generated lattice at the
    //  origin:
    if (opts ==  kCrystalCellPropogateCentered) {
      Vector3D_ScaledSum(&xform,(double)i,&av[0],&xform);
      Vector3D_ScaledSum(&xform,(double)j,&av[1],&xform);
      Vector3D_ScaledSum(&xform,(double)k,&av[2],&xform);
      Vector3D_Scalar(&xform,-0.5,&xform);
    }
    
    //  Simply loop and generate points:
    os.setf(ios::fixed);
    for ( li = 0 ; li < i ; li++ ) {
      for ( lj = 0 ; lj < j ; lj++ ) {
        for ( lk = 0 ; lk < k ; lk++ ) {
          for ( bb = 0 ; bb < basisCount ; bb++ ) {
            pt = basis[bb].atomPosition;
            if (li) pt.x += (double)li;
            if (lj) pt.y += (double)lj;
            if (lk) pt.z += (double)lk;
            pt = FractionalToCartesian(pt);
            Vector3D_Sum(&pt,&xform,&pt);
            
            TElementSymbol		symbol = periodicTable->LookupSymbolForNumber(basis[bb].atomicNumber);
            
            if (symbol == kANSRInvalidSymbol) {
              os.setf(ios::left);
              os << "  " << setw(3) << basis[bb].atomicNumber << "  ";
              os.unsetf(ios::left);
              os << setprecision(6) << setw(12) << pt.x << ' ';
              os << setprecision(6) << setw(12) << pt.y << ' ';
              os << setprecision(6) << setw(12) << pt.z << endl;
            } else {
              os.setf(ios::left);
              os << "  " << setw(3) << (char*)&symbol << "  ";
              os.unsetf(ios::left);
              os << setprecision(6) << setw(12) << pt.x << ' ';
              os << setprecision(6) << setw(12) << pt.y << ' ';
              os << setprecision(6) << setw(12) << pt.z << endl;
            }
          }
        }
      }
    }
    os.setf(savedFlags);
	}