Data Structures | |
| struct | TRecord |
Typedefs | |
| typedef int | TNodeLab |
| typedef std::map< TNodeLab, TRecord > | TDataSet |
Functions | |
| void | Read (std::ifstream &in_stream, TDataSet &theDataSet) |
| void | Write (std::ofstream &out_stream, const TDataSet &theDataSet) |
| typedef std::map<TNodeLab,TRecord> UNV2411.TDataSet |
Definition at line 42 of file UNV2411_Structure.hxx.
| typedef int UNV2411.TNodeLab |
Definition at line 41 of file UNV2411_Structure.hxx.
| void UNV2411::Read | ( | std::ifstream & | in_stream, |
| TDataSet & | theDataSet | ||
| ) |
always 3 coordinates in the UNV file, no matter which dimensionality libMesh is in
Definition at line 41 of file UNV2411_Structure.cxx.
References _label_dataset, UNV.beginning_of_dataset(), UNV2411.TRecord.color, UNV2411.TRecord.coord, ex13_hole1partial.d, UNV.D_to_e(), UNV2411.TRecord.disp_coord_sys_num, EXCEPTION, and UNV2411.TRecord.exp_coord_sys_num.
Referenced by DriverUNV_R_SMDS_Mesh.Perform(), and ReadMed().
{
if(!in_stream.good())
EXCEPTION(runtime_error,"ERROR: Input file not good.");
/*
* adjust the \p istream to our
* position
*/
if(!beginning_of_dataset(in_stream,_label_dataset))
EXCEPTION(runtime_error,"ERROR: Could not find "<<_label_dataset<<" dataset!");
TNodeLab aLabel;
std::string num_buf;
for(; !in_stream.eof();){
in_stream >> aLabel ;
if(aLabel == -1){
// end of dataset is reached
break;
}
TRecord aRec;
in_stream>>aRec.exp_coord_sys_num;
in_stream>>aRec.disp_coord_sys_num;
in_stream>>aRec.color;
/*
* take care of the
* floating-point data
*/
for(int d = 0; d < 3; d++){
in_stream>>num_buf;
aRec.coord[d] = D_to_e(num_buf);
}
theDataSet.insert(TDataSet::value_type(aLabel,aRec));
}
}
| void UNV2411::Write | ( | std::ofstream & | out_stream, |
| const TDataSet & | theDataSet | ||
| ) |
Definition at line 85 of file UNV2411_Structure.cxx.
References _label_dataset, UNV2411.TRecord.color, UNV2411.TRecord.coord, UNV2411.TRecord.disp_coord_sys_num, EXCEPTION, and UNV2411.TRecord.exp_coord_sys_num.
Referenced by DriverUNV_W_SMDS_Mesh.Perform(), and ReadMed().
{
if(!out_stream.good())
EXCEPTION(runtime_error,"ERROR: Output file not good.");
/*
* Write beginning of dataset
*/
out_stream<<" -1\n";
out_stream<<" "<<_label_dataset<<"\n";
TDataSet::const_iterator anIter = theDataSet.begin();
for(; anIter != theDataSet.end(); anIter++){
const TNodeLab& aLabel = anIter->first;
const TRecord& aRec = anIter->second;
char buf[78];
sprintf(buf, "%10d%10d%10d%10d\n",
aLabel,
aRec.exp_coord_sys_num,
aRec.disp_coord_sys_num,
aRec.color);
out_stream<<buf;
// the coordinates
sprintf(buf, "%25.16E%25.16E%25.16E\n",
aRec.coord[0],
aRec.coord[1],
aRec.coord[2]);
out_stream<<buf;
}
/*
* Write end of dataset
*/
out_stream<<" -1\n";
}