Commit 243583c3 authored by Jerry Clarke's avatar Jerry Clarke
Browse files

Improved DSM Support

parent a9f889ef
......@@ -375,10 +375,6 @@ public:
XdmfString GetDataPointerAsCharPointer( void ) {
return( (XdmfString)this->GetDataPointer() );
};
//! Set the name of the Heavy Data Set when written (if applicable)
XdmfSetStringMacro(HeavyDataSetName);
//! Get the name of the Heavy Data Set when written (if applicable)
XdmfGetStringMacro(HeavyDataSetName);
//! Copy Data From One Array to Another
// XdmfPointer MemCopy( XdmfLength StartOffset,
......@@ -413,7 +409,6 @@ public:
// };
protected:
XdmfString HeavyDataSetName;
XdmfPointer DataPointer;
XdmfBoolean DataIsMine;
char TagName[XDMF_ARRAY_TAG_LENGTH];
......
......@@ -254,6 +254,7 @@ if( this->AttributeType == XDMF_ATTRIBUTE_TYPE_NONE ){
ValuesNode = this->DOM->FindDataElement( 0, Element );
if( ValuesNode ){
ValueReader.SetDOM( this->DOM );
ValueReader.SetDsmBuffer(this->DsmBuffer);
if( this->ValuesAreMine && this->Values ){
delete this->Values;
this->Values = NULL;
......
......@@ -32,6 +32,7 @@ XdmfDataDesc::XdmfDataDesc() {
this->NextOffset = 0;
this->Rank = 1;
this->ShapeString = 0;
this->DsmBuffer = NULL;
}
XdmfDataDesc::~XdmfDataDesc() {
......
......@@ -32,6 +32,11 @@
#define XDMF_HYPERSLAB 1
#define XDMF_COORDINATES 2
#ifndef XDMF_NO_MPI
class XdmfDsmBuffer;
#endif
//! Number Type and Shape
/*!
XdmfDataDesc is a class to operate of the \b TYPE and \b SHAPE of data.
......@@ -189,6 +194,18 @@ public :
XdmfConstString GetMemberTypeAsString( XdmfInt64 Index );
//! Get the member offset
XdmfInt64 GetMemberOffset( XdmfInt64 Index );
//! Set the name of the Heavy Data Set when written (if applicable)
XdmfSetStringMacro(HeavyDataSetName);
//! Get the name of the Heavy Data Set when written (if applicable)
XdmfGetStringMacro(HeavyDataSetName);
#ifndef XDMF_NO_MPI
//! Get DSM Buffer
XdmfGetValueMacro(DsmBuffer, XdmfDsmBuffer *);
//! Set DSM Buffer
XdmfSetValueMacro(DsmBuffer, XdmfDsmBuffer *);
#endif
//! Internal Method to Copy From Exiting Type and Space
......@@ -218,6 +235,10 @@ protected:
void SetShapeString(XdmfConstString shape);
XdmfString ShapeString;
XdmfString HeavyDataSetName;
#ifndef XDMF_NO_MPI
XdmfDsmBuffer *DsmBuffer;
#endif
};
#endif // __XdmfDataDesc_h
......@@ -115,6 +115,7 @@ XdmfDataItem::Copy(XdmfElement *Source){
// this->SetDOM(ds->GetDOM());
this->SetFormat(ds->GetFormat());
this->SetHeavyDataSetName(ds->GetHeavyDataSetName());
this->SetDsmBuffer(ds->GetDsmBuffer());
this->DataDesc->CopyType(ds->GetDataDesc());
this->DataDesc->CopyShape(ds->GetDataDesc());
this->DataDesc->CopySelection(ds->GetDataDesc());
......@@ -463,11 +464,14 @@ XdmfInt32 XdmfDataItem::Update(){
switch (this->Format) {
case XDMF_FORMAT_HDF :
this->Values->SetDebug(this->GetDebug());
// this->SetDsmBuffer(this->Values->GetDsmBuffer());
// cout << "Setting Values Dsm to " << this->DsmBuffer << endl;
this->Values->SetDsmBuffer(this->DsmBuffer);
if(!((XdmfValuesHDF *)this->Values)->Read(this->Array)){
XdmfErrorMessage("Reading Values Failed");
return(XDMF_FAIL);
}
this->SetHeavyDataSetName(Values->GetHeavyDataSetName());
this->SetHeavyDataSetName(this->Values->GetHeavyDataSetName());
break;
case XDMF_FORMAT_XML :
this->Values->SetDebug(this->GetDebug());
......@@ -564,6 +568,7 @@ XdmfInt32 XdmfDataItem::Build(){
case XDMF_FORMAT_HDF :
XdmfDebug("Writing Values in HDF Format");
Values->SetHeavyDataSetName(this->GetHeavyDataSetName());
Values->SetDsmBuffer(this->GetDsmBuffer());
if(((XdmfValuesHDF *)Values)->Write(this->Array) != XDMF_SUCCESS){
XdmfErrorMessage("Writing Values Failed");
return(XDMF_FAIL);
......
......@@ -54,11 +54,12 @@ XdmfDsmCommMpi::Init(){
XdmfInt32
XdmfDsmCommMpi::Check(XdmfDsmMsg *Msg){
int nid, flag;
int nid, flag=0;
MPI_Status Status;
if(XdmfDsmComm::Check(Msg) != XDMF_SUCCESS) return(XDMF_FAIL);
MPI_Iprobe(MPI_ANY_SOURCE, Msg->Tag, this->Comm, &flag, &Status);
MPI_Iprobe(MPI_ANY_SOURCE, Msg->Tag, this->Comm, &flag, &Status);
// cout << "MPI_Iprobe " << Msg->Tag << ", " << this->Comm << endl;
if(flag){
nid = Status.MPI_SOURCE;
Msg->SetSource(nid);
......
......@@ -61,6 +61,7 @@ XdmfElement::XdmfElement() {
this->ReferenceElement = NULL;
this->State = XDMF_ELEMENT_STATE_UNINITIALIZED;
this->CopyReferenceData = 1;
this->DsmBuffer = NULL;
}
XdmfElement::~XdmfElement() {
......
......@@ -32,6 +32,9 @@
#define XDMF_ELEMENT_STATE_HEAVY_READ 2
class XdmfDOM;
#ifndef XDMF_NO_MPI
class XdmfDsmBuffer;
#endif
//! Basic XML Based Element
/*!
......@@ -163,7 +166,12 @@ public:
//! Follow a Refernce Chain one step, if it exists
XdmfXmlNode FollowReference(XdmfXmlNode Element);
#ifndef XDMF_NO_MPI
//! Get DSM Buffer
XdmfGetValueMacro(DsmBuffer, XdmfDsmBuffer *);
//! Set DSM Buffer
XdmfSetValueMacro(DsmBuffer, XdmfDsmBuffer *);
#endif
protected:
void SetReferenceObject(XdmfXmlNode Element, void *p);
......@@ -182,5 +190,8 @@ protected:
XdmfInt32 IsReference;
// Copy, don't copy data out of reference element. Default is to copy.
XdmfInt32 CopyReferenceData;
#ifndef XDMF_NO_MPI
XdmfDsmBuffer *DsmBuffer;
#endif
};
#endif // __XdmfElement_h
......@@ -321,6 +321,7 @@ if( ( this->GeometryType == XDMF_GEOMETRY_X_Y_Z ) ||
if(PointsItem.SetDOM( this->DOM ) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.SetElement(PointsElement, 0) == XDMF_FAIL) return(XDMF_FAIL);
if(PointsItem.UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
PointsItem.SetDsmBuffer(this->DsmBuffer);
if(PointsItem.Update() == XDMF_FAIL) return(XDMF_FAIL);
TmpArray = PointsItem.GetArray();
if( TmpArray ){
......@@ -389,6 +390,7 @@ if( ( this->GeometryType == XDMF_GEOMETRY_X_Y_Z ) ||
if( this->GeometryType == XDMF_GEOMETRY_ORIGIN_DXDYDZ ) {
XdmfDataItem PointsItem;
PointsItem.SetDOM(this->DOM);
PointsItem.SetDsmBuffer(this->DsmBuffer);
XdmfDebug("Reading Origin and Dx, Dy, Dz" );
PointsElement = this->DOM->FindDataElement(0, this->Element );
if( PointsElement ){
......
......@@ -214,6 +214,7 @@ XdmfGrid::AssignAttribute( XdmfAttribute *attribute ){
XdmfInt32 Status = 0;
if( attribute ){
if(!attribute->GetDsmBuffer()) attribute->SetDsmBuffer(this->DsmBuffer);
attribute->Update();
// Status = attribute->SetBaseAttribute( this, this->BaseGrid );
this->AssignedAttribute = attribute;
......@@ -480,6 +481,7 @@ if((this->GridType & XDMF_GRID_MASK) != XDMF_GRID_UNIFORM){
XdmfInt32 i;
// SubSet, Tree or Collection
for(i=0; i < this->NumberOfChildren ; i++){
if(!this->Children[i]->GetDsmBuffer()) this->Children[i]->SetDsmBuffer(this->DsmBuffer);
if(this->Children[i]->Update() == XDMF_FAIL){
XdmfErrorMessage("Error in Update() of Child Grid " << i);
return(XDMF_FAIL);
......@@ -550,10 +552,12 @@ if((this->GridType & XDMF_GRID_MASK) != XDMF_GRID_UNIFORM){
}
return(XDMF_SUCCESS);
}
if(!this->Topology->GetDsmBuffer()) this->Topology->SetDsmBuffer(this->DsmBuffer);
if(this->Topology->Update() == XDMF_FAIL){
XdmfErrorMessage("Error in Update() of Topology");
return(XDMF_FAIL);
}
if(!this->Geometry->GetDsmBuffer()) this->Geometry->SetDsmBuffer(this->DsmBuffer);
if(this->Geometry->Update() == XDMF_FAIL){
XdmfErrorMessage("Error in Update() of Geometry");
return(XDMF_FAIL);
......
......@@ -33,9 +33,6 @@
#define XDMF_H5_OTHER 0xFF
class XdmfArray;
#ifndef XDMF_NO_MPI
class XdmfDsmBuffer;
#endif
//! Class for Accessing HDF5 Data
/*!
......@@ -107,11 +104,6 @@ public:
XdmfSetValueMacro(UseSerialFile, XdmfInt32);
//! Get Value of Use Serial
XdmfGetValueMacro(UseSerialFile, XdmfInt32);
#ifndef XDMF_NO_MPI
//! DSM Buffer
XdmfGetValueMacro(DsmBuffer, XdmfDsmBuffer *);
XdmfSetValueMacro(DsmBuffer, XdmfDsmBuffer *);
#endif
//! Set the current internal HDF "Group" for creation
XdmfInt32 SetCwdName( XdmfConstString Directory );
//! Get the current internal HDF "Group"
......@@ -208,9 +200,6 @@ protected:
XdmfInt32 UseSerialFile;
XdmfInt64 NumberOfChildren;
XdmfString Child[1024];
#ifndef XDMF_NO_MPI
XdmfDsmBuffer *DsmBuffer;
#endif
};
/*
......
......@@ -585,6 +585,7 @@ if( this->GetClass() == XDMF_UNSTRUCTURED ){
// cout << "Connection DataItem = " << &Connections << endl;
XdmfDebug("Reading Connections from DataItem");
if(Connections.SetDOM(this->DOM) == XDMF_FAIL) return(XDMF_FAIL);
Connections.SetDsmBuffer(this->DsmBuffer);
if( this->ConnectivityIsMine && this->Connectivity ) delete this->Connectivity;
if(Connections.SetElement(ConnectionElement, 0) == XDMF_FAIL) return(XDMF_FAIL);
if(Connections.UpdateInformation() == XDMF_FAIL) return(XDMF_FAIL);
......
......@@ -53,6 +53,8 @@ XdmfValuesHDF::Read(XdmfArray *anArray){
return(NULL);
}
XDMF_WORD_TRIM(DataSetName);
//! Possible Read from DSM. Make sure we're connected.
if(!this->DsmBuffer) this->SetDsmBuffer(anArray->GetDsmBuffer());
XdmfDebug("Opening HDF5 Data for Reading : " << DataSetName);
// Allocate Array if Necessary
if(!RetArray){
......@@ -66,6 +68,7 @@ XdmfValuesHDF::Read(XdmfArray *anArray){
RetArray->CopySelection(this->DataDesc);
RetArray->Allocate();
}
H5.SetDsmBuffer(this->DsmBuffer);
if( H5.Open( DataSetName, "r" ) == XDMF_FAIL ) {
XdmfErrorMessage("Can't Open Dataset " << DataSetName);
if(!anArray) delete RetArray;
......@@ -124,6 +127,8 @@ XdmfValuesHDF::Write(XdmfArray *anArray, XdmfConstString aHeavyDataSetName){
aHeavyDataSetName = this->GetUniqueName("Xdmf.h5:/Data");
}
}
// Possible Write to DSM. Make sure we're connected
if(!this->DsmBuffer) this->SetDsmBuffer(anArray->GetDsmBuffer());
XdmfDebug("Writing Values to " << aHeavyDataSetName);
if(!this->DataDesc ){
XdmfErrorMessage("DataDesc has not been set");
......@@ -139,6 +144,7 @@ XdmfValuesHDF::Write(XdmfArray *anArray, XdmfConstString aHeavyDataSetName){
H5.CopyType(this->DataDesc);
H5.CopyShape(this->DataDesc);
H5.CopySelection(this->DataDesc);
H5.SetDsmBuffer(this->DsmBuffer);
if(H5.Open(hds, "rw") == XDMF_FAIL){
XdmfErrorMessage("Error Opening " << hds << " for Writing");
delete [] hds ;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment