HDF5OrthoInfo Class Reference

#include <hdf5orthoinfo.h>

Collaboration diagram for HDF5OrthoInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 HDF5OrthoInfo ()
 HDF5OrthoInfo (Point3D P0, Point3D P1, unsigned nEX, unsigned nEY, unsigned nEZ, VecWellInfo wells)
void writeOrthoMeshInfo (hid_t triaGroup)
void readOrthoMeshInfo (hid_t triaGroup)

Public Attributes

Point3D P0
Point3D P1
unsigned nElems [3]
VecWellInfo wells

Detailed Description

Definition at line 6 of file hdf5orthoinfo.h.


Constructor & Destructor Documentation

HDF5OrthoInfo::HDF5OrthoInfo (  )  [inline]

Definition at line 15 of file hdf5orthoinfo.h.

00015 {}

HDF5OrthoInfo::HDF5OrthoInfo ( Point3D  P0,
Point3D  P1,
unsigned  nEX,
unsigned  nEY,
unsigned  nEZ,
VecWellInfo  wells 
) [inline]

Definition at line 16 of file hdf5orthoinfo.h.

00017    :P0(P0),P1(P1),wells(wells)
00018   {
00019     nElems[0] = nEX;
00020     nElems[1] = nEY;
00021     nElems[2] = nEZ;
00022   }


Member Function Documentation

void HDF5OrthoInfo::readOrthoMeshInfo ( hid_t  triaGroup  )  [inline]

Definition at line 73 of file hdf5orthoinfo.h.

00074   {
00075     double data[9];
00076     hid_t dataset = H5Dopen1(triaGroup,"dims");
00077     if (dataset < 0)
00078       throw new Exception("DataSet \"dims\" not found\n"); 
00079 
00080 
00081     H5Dread(dataset,H5T_NATIVE_DOUBLE,H5S_ALL,H5S_ALL,H5P_DEFAULT,data);
00082     this->P0(0)=data[0];
00083     this->P0(1)=data[1];
00084     this->P0(2)=data[2];
00085     this->P1(0)=data[3];
00086     this->P1(1)=data[4];
00087     this->P1(2)=data[5];
00088     this->nElems[0]=data[6];
00089     this->nElems[1]=data[7];
00090     this->nElems[2]=data[8];
00091     H5Dclose(dataset);
00092 
00093     if (H5Lexists(triaGroup,"wells",H5P_DEFAULT)) //if data exists
00094     {
00095       hid_t datasetWells = H5Dopen1(triaGroup,"wells");
00096 
00097       hid_t dataspace = H5Dget_space(datasetWells);
00098       assert(H5Sget_simple_extent_ndims(dataspace) == 2);
00099       hsize_t dims[2];
00100       H5Sget_simple_extent_dims(dataspace,dims,NULL);
00101       assert(dims[1] == 6);
00102       double data[dims[0]][dims[1]];
00103       H5Dread(datasetWells,H5T_NATIVE_DOUBLE,H5S_ALL,H5S_ALL,H5P_DEFAULT,data);
00104       for (unsigned i=0;i<dims[0];i++)
00105       {
00106         Point3D p1(data[i][0],
00107                    data[i][1],
00108                    data[i][2]);
00109         Point3D p2(data[i][3],
00110                    data[i][4],
00111                    data[i][5]);
00112         WellInfo wl(p1,p2,0,WellInfo::PRESSURE);
00113         wells.push_back(wl);
00114       }
00115       H5Sclose(dataspace);
00116       H5Dclose(datasetWells);
00117 
00118     } 
00119 
00120   };

void HDF5OrthoInfo::writeOrthoMeshInfo ( hid_t  triaGroup  )  [inline]

Definition at line 23 of file hdf5orthoinfo.h.

00024   {
00025     double data[9];
00026     data[0]=this->P0(0);
00027     data[1]=this->P0(1);
00028     data[2]=this->P0(2);
00029     data[3]=this->P1(0);
00030     data[4]=this->P1(1);
00031     data[5]=this->P1(2);
00032     data[6]=this->nElems[0];
00033     data[7]=this->nElems[1];
00034     data[8]=this->nElems[2];
00035     //    std::cout << data[0] << data[1] << data[2] << data[3] << data[4] << data[5] << data[6] << std::endl;  
00036     hsize_t dim[] = {9};
00037     hid_t dataspace = H5Screate_simple(1,dim,NULL);
00038     hid_t datatype  = H5Tcopy(H5T_NATIVE_DOUBLE);
00039     H5Tset_order(datatype,H5T_ORDER_LE);
00040     hid_t dataset = H5Dcreate1(triaGroup, "dims", datatype, dataspace, H5P_DEFAULT);
00041     H5Dwrite(dataset,H5T_NATIVE_DOUBLE,H5S_ALL,H5S_ALL,H5P_DEFAULT,data);
00042     H5Sclose(dataspace);
00043     H5Tclose(datatype);
00044     H5Dclose(dataset);
00045     
00046     if (!wells.empty())
00047     {
00048       hsize_t dim[] = {wells.size(),6};
00049       hid_t dataspace = H5Screate_simple(2,dim,NULL);
00050       hid_t datatype  = H5Tcopy(H5T_NATIVE_DOUBLE);
00051       H5Tset_order(datatype,H5T_ORDER_LE);
00052       hid_t dataset = H5Dcreate1(triaGroup, "wells", datatype, dataspace, H5P_DEFAULT);
00053       
00054       double data[wells.size()][6];
00055       for (unsigned i=0;i<wells.size();i++)
00056       {
00057         data[i][0]=wells[i].P(0);
00058         data[i][1]=wells[i].P(1);
00059         data[i][2]=wells[i].P(2);
00060         data[i][3]=wells[i].Q(0);
00061         data[i][4]=wells[i].Q(1);
00062         data[i][5]=wells[i].Q(2);
00063       }
00064       H5Dwrite(dataset,H5T_NATIVE_DOUBLE,H5S_ALL,H5S_ALL,H5P_DEFAULT,data);
00065       H5Sclose(dataspace);
00066       H5Tclose(datatype);
00067       H5Dclose(dataset);
00068     }
00069     
00070 
00071     
00072   };


Member Data Documentation

unsigned HDF5OrthoInfo::nElems[3]

Definition at line 11 of file hdf5orthoinfo.h.

Definition at line 10 of file hdf5orthoinfo.h.

Definition at line 10 of file hdf5orthoinfo.h.

Definition at line 12 of file hdf5orthoinfo.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Sun Apr 8 23:13:12 2012 for CO2INJECTION by  doxygen 1.6.3