Commit 67e911ce authored by David E. DeMarle's avatar David E. DeMarle

address merge problems

thanks Andrew for finding these
parent 45aad5aa
......@@ -390,44 +390,47 @@ extern "C" {
// C wrappers go here
#ifndef XDMF_C_TOPOLOGY_TYPES
#define XDMF_C_TOPOLOGY_TYPES
#define XDMF_TOPOLOGY_TYPE_POLYVERTEX 500
#define XDMF_TOPOLOGY_TYPE_POLYLINE 501
#define XDMF_TOPOLOGY_TYPE_POLYGON 502
#define XDMF_TOPOLOGY_TYPE_TRIANGLE 503
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL 504
#define XDMF_TOPOLOGY_TYPE_TETRAHEDRON 505
#define XDMF_TOPOLOGY_TYPE_PYRAMID 506
#define XDMF_TOPOLOGY_TYPE_WEDGE 507
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON 508
#define XDMF_TOPOLOGY_TYPE_EDGE_3 509
#define XDMF_TOPOLOGY_TYPE_TRIANGLE_6 510
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL_8 511
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL_9 512
#define XDMF_TOPOLOGY_TYPE_TETRAHEDRON_10 513
#define XDMF_TOPOLOGY_TYPE_PYRAMID_13 514
#define XDMF_TOPOLOGY_TYPE_WEDGE_15 515
#define XDMF_TOPOLOGY_TYPE_WEDGE_18 516
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_20 517
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_24 518
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_27 519
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_64 520
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_125 521
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_216 522
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_343 523
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_512 524
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_729 525
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1000 526
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1331 527
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_64 528
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_125 529
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_216 530
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_343 531
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_512 532
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_729 533
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_1000 534
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_1331 535
#define XDMF_TOPOLOGY_TYPE_MIXED 536
#define XDMF_TOPOLOGY_TYPE_POLYHEDRON 537
#define XDMF_TOPOLOGY_TYPE_POLYHEDRON 503
#define XDMF_TOPOLOGY_TYPE_TRIANGLE 504
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL 505
#define XDMF_TOPOLOGY_TYPE_TETRAHEDRON 506
#define XDMF_TOPOLOGY_TYPE_PYRAMID 507
#define XDMF_TOPOLOGY_TYPE_WEDGE 508
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON 509
#define XDMF_TOPOLOGY_TYPE_EDGE_3 510
#define XDMF_TOPOLOGY_TYPE_TRIANGLE_6 511
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL_8 512
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL_9 513
#define XDMF_TOPOLOGY_TYPE_TETRAHEDRON_10 514
#define XDMF_TOPOLOGY_TYPE_PYRAMID_13 515
#define XDMF_TOPOLOGY_TYPE_WEDGE_15 516
#define XDMF_TOPOLOGY_TYPE_WEDGE_18 517
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_20 518
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_24 519
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_27 520
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_64 521
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_125 522
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_216 523
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_343 524
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_512 525
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_729 526
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1000 527
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1331 528
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_64 529
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_125 530
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_216 531
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_343 532
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_512 533
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_729 534
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_1000 535
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_1331 536
#define XDMF_TOPOLOGY_TYPE_MIXED 537
#endif
#define XDMF_TOPOLOGY_CELL_TYPE_NO_CELL_TYPE 0
#define XDMF_TOPOLOGY_CELL_TYPE_LINEAR 1
......
......@@ -51,6 +51,12 @@ XdmfSystemUtils::getRealPath(const std::string & path)
xmlURIPtr ref = NULL;
ref = xmlCreateURI();
xmlParseURIReference(ref, path.c_str());
#ifdef WIN32
char realPath[_MAX_PATH];
_fullpath(realPath, path.c_str(), _MAX_PATH);
xmlFreeURI(ref);
return realPath;
#else
char realPath[PATH_MAX];
char *rp = realpath(ref->path, realPath);
if (rp == 0)
......@@ -62,6 +68,7 @@ XdmfSystemUtils::getRealPath(const std::string & path)
}
xmlFreeURI(ref);
return std::string(rp);
#endif
}
#endif
......
/*****************************************************************************/
/* XDMF */
/* eXtensible Data Model and Format */
/* */
/* Id : XdmfDSMManager.cpp */
/* */
/* Author: */
/* Andrew Burns */
/* andrew.j.burns2@us.army.mil */
/* US Army Research Laboratory */
/* Aberdeen Proving Ground, MD */
/* */
/* Copyright @ 2013 US Army Research Laboratory */
/* All Rights Reserved */
/* See Copyright.txt for details */
/* */
/* This software is distributed WITHOUT ANY WARRANTY; without */
/* even the implied warranty of MERCHANTABILITY or FITNESS */
/* FOR A PARTICULAR PURPOSE. See the above copyright notice */
/* for more information. */
/* */
/*****************************************************************************/
/*=========================================================================
This code is derived from an earlier work and is distributed
with permission from, and thanks to ...
=========================================================================*/
/*============================================================================
Project : H5FDdsm
Module : H5FDdsmManger.cxx
Authors:
John Biddiscombe Jerome Soumagne
biddisco@cscs.ch soumagne@cscs.ch
Copyright (C) CSCS - Swiss National Supercomputing Centre.
You may use modify and and distribute this code freely providing
1) This copyright notice appears on all copies of source code
2) An acknowledgment appears with any substantial usage of the code
3) If this code is contributed to any other open source project, it
must not be reformatted such that the indentation, bracketing or
overall style is modified significantly.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This work has received funding from the European Community's Seventh
Framework Programme (FP7/2007-2013) under grant agreement 225967 âxtMuSEâOC
============================================================================*/
#include <XdmfDSMManager.hpp>
#include <XdmfDSMBuffer.hpp>
#include <XdmfDSMCommMPI.hpp>
#include <XdmfError.hpp>
#include <mpi.h>
#ifndef _WIN32
#include <unistd.h>
#endif
XdmfDSMManager::XdmfDSMManager()
{
this->MpiComm = MPI_COMM_NULL;
this->UpdatePiece = 0;
this->UpdateNumPieces = 0;
this->LocalBufferSizeMBytes = 128;
this->DsmBuffer = NULL;
this->DsmComm = NULL;
this->IsServer = true;
this->DsmType = XDMF_DSM_TYPE_UNIFORM;
this->BlockLength = XDMF_DSM_DEFAULT_BLOCK_LENGTH;
this->InterCommType = XDMF_DSM_COMM_MPI;
}
XdmfDSMManager::~XdmfDSMManager()
{
this->Destroy();
}
void
XdmfDSMManager::Connect(bool persist)
{
int status;
do {
try {
status = this->DsmBuffer->GetComm()->Connect();
}
catch (XdmfError & e) {
throw e;
}
if (status == MPI_SUCCESS) {
dynamic_cast<XdmfDSMBuffer*> (this->DsmBuffer)->SetIsConnected(true);
try {
this->DsmBuffer->ReceiveInfo();
}
catch (XdmfError & e) {
throw e;
}
}
else {
#ifdef _WIN32
Sleep(1000);
// Since windows has a different sleep command
#else
sleep(1);
#endif
}
} while (persist && (status != MPI_SUCCESS));
}
void
XdmfDSMManager::Create(int startId, int endId)
{
if (!this->DsmBuffer) {
MPI_Comm_size(this->MpiComm, &this->UpdateNumPieces);
MPI_Comm_rank(this->MpiComm, &this->UpdatePiece);
//
// Create DSM communicator
//
switch (this->GetInterCommType()) {
case XDMF_DSM_COMM_MPI:
this->DsmComm = new XdmfDSMCommMPI();
break;
default:
try {
XdmfError::message(XdmfError::FATAL, "DSM communication type not supported");
}
catch (XdmfError & e) {
throw e;
}
}
this->DsmComm->DupComm(this->MpiComm);
this->DsmComm->Init();
//
// Create the DSM buffer
//
this->DsmBuffer = new XdmfDSMBuffer();
//
this->DsmBuffer->SetIsServer(this->IsServer);
// Uniform Dsm : every node has a buffer the same size. (Addresses are sequential)
long length = (long) (this->GetLocalBufferSizeMBytes())*1024LU*1024LU;
switch (this->DsmType) {
case XDMF_DSM_TYPE_UNIFORM:
case XDMF_DSM_TYPE_UNIFORM_RANGE:
this->DsmBuffer->ConfigureUniform(this->DsmComm, length, startId, endId);
break;
case XDMF_DSM_TYPE_BLOCK_CYCLIC:
this->DsmBuffer->ConfigureUniform(this->DsmComm, length, startId, endId, this->BlockLength, false);
break;
case XDMF_DSM_TYPE_BLOCK_RANDOM:
this->DsmBuffer->ConfigureUniform(this->DsmComm, length, startId, endId, this->BlockLength, true);
break;
default:
try {
XdmfError(XdmfError::FATAL, "DSM configuration type not supported");
}
catch (XdmfError & e) {
throw e;
}
}
}
}
void
XdmfDSMManager::Destroy()
{
// Watch out that all processes have empty message queues
// Should be already done during the disconnection
if (this->DsmBuffer) {
delete this->DsmBuffer;
this->DsmBuffer = NULL;
// Will be replaced by an Xdmf version
// H5FD_dsm_set_manager(NULL);
}
if (this->DsmComm) {
delete this->DsmComm;
this->DsmComm = NULL;
}
}
void
XdmfDSMManager::Disconnect()
{
// Disconnecting is done manually
try {
this->DsmBuffer->GetComm()->Disconnect();
}
catch (XdmfError & e) {
throw e;
}
dynamic_cast<XdmfDSMBuffer*> (this->DsmBuffer)->SetIsConnected(false);
}
long
XdmfDSMManager::GetBlockLength()
{
return this->BlockLength;
}
XdmfDSMBuffer *
XdmfDSMManager::GetDsmBuffer()
{
return this->DsmBuffer;
}
int
XdmfDSMManager::GetDsmType()
{
return this->DsmType;
}
int
XdmfDSMManager::GetInterCommType()
{
return this->InterCommType;
}
bool
XdmfDSMManager::GetIsConnected()
{
if (this->DsmBuffer) {
return this->DsmBuffer->GetIsConnected();
}
else {
return false;
}
}
bool
XdmfDSMManager::GetIsServer()
{
return this->IsServer;
}
unsigned int
XdmfDSMManager::GetLocalBufferSizeMBytes()
{
return this->LocalBufferSizeMBytes;
}
MPI_Comm
XdmfDSMManager::GetMpiComm()
{
return this->MpiComm;
}
int
XdmfDSMManager::GetUpdatePiece()
{
return this->UpdatePiece;
}
int
XdmfDSMManager::GetUpdateNumPieces()
{
return this->UpdateNumPieces;
}
void
XdmfDSMManager::SetBlockLength(long newSize)
{
this->BlockLength = newSize;
}
void
XdmfDSMManager::SetDsmBuffer(XdmfDSMBuffer * newBuffer)
{
this->DsmBuffer = newBuffer;
}
void
XdmfDSMManager::SetDsmType(int newType)
{
this->DsmType = newType;
}
void
XdmfDSMManager::SetIsServer(bool newStatus)
{
this->IsServer = newStatus;
}
void
XdmfDSMManager::SetInterCommType(int newType)
{
this->InterCommType = newType;
}
void
XdmfDSMManager::SetLocalBufferSizeMBytes(unsigned int newSize)
{
this->LocalBufferSizeMBytes = newSize;
}
void
XdmfDSMManager::SetMpiComm(MPI_Comm comm)
{
if (comm != this->MpiComm) {
this->MpiComm = comm;
if (this->MpiComm != MPI_COMM_NULL) {
MPI_Comm_size(this->MpiComm, &this->UpdateNumPieces);
MPI_Comm_rank(this->MpiComm, &this->UpdatePiece);
}
}
}
This diff is collapsed.
......@@ -68,6 +68,7 @@
integer XDMF_TOPOLOGY_TYPE_PYRAMID
integer XDMF_TOPOLOGY_TYPE_WEDGE
integer XDMF_TOPOLOGY_TYPE_HEXAHEDRON
integer XDMF_TOPOLOGY_TYPE_POLYHEDRON
integer XDMF_TOPOLOGY_TYPE_EDGE_3
integer XDMF_TOPOLOGY_TYPE_TRIANGLE_6
integer XDMF_TOPOLOGY_TYPE_QUADRILATERAL_8
......
......@@ -115,43 +115,47 @@ class XdmfHDF5WriterDSM;
/**
* Topology Type
*/
#ifndef XDMF_C_TOPOLOGY_TYPES
#define XDMF_C_TOPOLOGY_TYPES
#define XDMF_TOPOLOGY_TYPE_POLYVERTEX 500
#define XDMF_TOPOLOGY_TYPE_POLYLINE 501
#define XDMF_TOPOLOGY_TYPE_POLYGON 502
#define XDMF_TOPOLOGY_TYPE_TRIANGLE 503
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL 504
#define XDMF_TOPOLOGY_TYPE_TETRAHEDRON 505
#define XDMF_TOPOLOGY_TYPE_PYRAMID 506
#define XDMF_TOPOLOGY_TYPE_WEDGE 507
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON 508
#define XDMF_TOPOLOGY_TYPE_EDGE_3 509
#define XDMF_TOPOLOGY_TYPE_TRIANGLE_6 510
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL_8 511
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL_9 512
#define XDMF_TOPOLOGY_TYPE_TETRAHEDRON_10 513
#define XDMF_TOPOLOGY_TYPE_PYRAMID_13 514
#define XDMF_TOPOLOGY_TYPE_WEDGE_15 515
#define XDMF_TOPOLOGY_TYPE_WEDGE_18 516
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_20 517
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_24 518
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_27 519
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_64 520
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_125 521
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_216 522
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_343 523
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_512 524
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_729 525
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1000 526
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1331 527
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_64 528
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_125 529
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_216 530
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_343 531
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_512 532
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_729 533
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_1000 534
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_1331 535
#define XDMF_TOPOLOGY_TYPE_MIXED 536
#define XDMF_TOPOLOGY_TYPE_POLYHEDRON 503
#define XDMF_TOPOLOGY_TYPE_TRIANGLE 504
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL 505
#define XDMF_TOPOLOGY_TYPE_TETRAHEDRON 506
#define XDMF_TOPOLOGY_TYPE_PYRAMID 507
#define XDMF_TOPOLOGY_TYPE_WEDGE 508
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON 509
#define XDMF_TOPOLOGY_TYPE_EDGE_3 510
#define XDMF_TOPOLOGY_TYPE_TRIANGLE_6 511
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL_8 512
#define XDMF_TOPOLOGY_TYPE_QUADRILATERAL_9 513
#define XDMF_TOPOLOGY_TYPE_TETRAHEDRON_10 514
#define XDMF_TOPOLOGY_TYPE_PYRAMID_13 515
#define XDMF_TOPOLOGY_TYPE_WEDGE_15 516
#define XDMF_TOPOLOGY_TYPE_WEDGE_18 517
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_20 518
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_24 519
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_27 520
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_64 521
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_125 522
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_216 523
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_343 524
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_512 525
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_729 526
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1000 527
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_1331 528
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_64 529
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_125 530
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_216 531
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_343 532
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_512 533
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_729 534
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_1000 535
#define XDMF_TOPOLOGY_TYPE_HEXAHEDRON_SPECTRAL_1331 536
#define XDMF_TOPOLOGY_TYPE_MIXED 537
#endif
/**
* Set Type
......
Markdown is supported
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