Skip to content

Commit ba25e37

Browse files
committedFeb 15, 2013
CORSAIR-109
Changed namespace VLSV to vlsv to be in line with coding style used elsewhere. Also changed couple classnames. Mesh types, datatypes, and coordinate systems are now inside nested namespaces. This prevented some name clashes. Abovementioned changes had to be made in plugin as well.
1 parent ec67e9e commit ba25e37

38 files changed

+1761
-1646
lines changed
 

‎CHANGELOG

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
*************************************
2+
***** CHANGES IN REVISION 00401 *****
3+
*************************************
4+
5+
MINOR
6+
7+
Changed namespace VLSV to vlsv to be in line with coding style used
8+
elsewhere. Also changed couple classnames.
9+
10+
Mesh types, datatypes, and coordinate systems are now inside nested
11+
namespaces. This prevented some name clashes.
12+
13+
Abovementioned changes had to be made in plugin as well.
14+
115
*************************************
216
***** CHANGES IN REVISION 00386 *****
317
*************************************

‎Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ DEPS_VLSVCOMMON = vlsv_common.h vlsv_common.cpp
3636
DEPS_VLSVCOMMON_MPI = ${DEPS_VLSVCOMMON} vlsv_common_mpi.h vlsv_common_mpi.cpp
3737
DEPS_READER = ${DEPS_VLSVCOMMON} vlsv_reader.h vlsv_reader.cpp
3838
DEPR_PARAREADER = ${DEPS_READER} vlsv_reader_parallel.h vlsv_reader_parallel.cpp
39-
DEPS_WRITER = ${DEPS_VLSVCOMMON} vlsvwriter.h vlsvwriter2.cpp
39+
DEPS_WRITER = ${DEPS_VLSVCOMMON} vlsv_writer.h vlsv_writer.cpp
4040
DEPS_VLSV2SILO = vlsv_reader.o muxml.o vlsv_common.o vlsv2silo.cpp
4141

42-
OBJS=multi_io_unit.o muxml.o vlsv_common.o vlsv_common_mpi.o vlsv_reader.o vlsv_reader_parallel.o vlsvwriter.o
42+
OBJS=multi_io_unit.o muxml.o vlsv_common.o vlsv_common_mpi.o vlsv_reader.o vlsv_reader_parallel.o vlsv_writer.o
4343

4444
# Build rules
4545

@@ -64,8 +64,8 @@ vlsv_reader.o: ${DEPS_READER}
6464
vlsv_reader_parallel.o: ${DEPS_PARAREADER}
6565
${CMP} ${CXXFLAGS} ${FLAGS} -o vlsv_reader_parallel.o -c vlsv_reader_parallel.cpp
6666

67-
vlsvwriter.o: ${DEPS_WRITER}
68-
${CMP} ${CXXFLAGS} ${FLAGS} -o vlsvwriter.o -c vlsvwriter2.cpp
67+
vlsv_writer.o: ${DEPS_WRITER}
68+
${CMP} ${CXXFLAGS} ${FLAGS} -o vlsv_writer.o -c vlsv_writer.cpp
6969

7070
vlsv2silo: ${DEPS_VLSV2SILO}
7171
${CMP} ${CXXFLAGS} ${FLAGS} -o vlsv2silo vlsv2silo.cpp ${INC_SILO} -L${CURDIR} -lvlsv ${LIB_SILO}

‎multi_io_unit.cpp

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** This file is part of VLSV file format.
22
*
3-
* Copyright 2011, 2012 Finnish Meteorological Institute
3+
* Copyright 2011-2013 Finnish Meteorological Institute
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU Lesser General Public License as published by
@@ -23,15 +23,17 @@
2323

2424
using namespace std;
2525

26-
/** Constructor for struct Multi_IO_Unit.
27-
* NOTE: MPI datatypes passed to Multi_IO_Unit are not committed or freed,
28-
* thus one should only use native MPI datatypes, e.g. as returned by
29-
* getMPIDatatype function.
30-
* @param array In VLSVWriter this is a pointer to array whose contents are
31-
* written to file. In VLSVParReader this is a pointer to array where data
32-
* from file is to be read.
33-
* @param mpiType MPI datatype defining the I/O operation.
34-
* @param amount Amount of data to be written or read, in units of mpiType.*/
35-
VLSV::Multi_IO_Unit::Multi_IO_Unit(char* array,const MPI_Datatype& mpiType,const uint64_t& amount): array(array),mpiType(mpiType),amount(amount) { }
36-
26+
namespace vlsv {
3727

28+
/** Constructor for struct Multi_IO_Unit.
29+
* NOTE: MPI datatypes passed to Multi_IO_Unit are not committed or freed,
30+
* thus one should only use native MPI datatypes, e.g. as returned by
31+
* getMPIDatatype function.
32+
* @param array In vlsv::Writer this is a pointer to array whose contents are
33+
* written to file. In vlsv::ParallelReader this is a pointer to array where data
34+
* from file is to be read.
35+
* @param mpiType MPI datatype defining the I/O operation.
36+
* @param amount Amount of data to be written or read, in units of mpiType.*/
37+
Multi_IO_Unit::Multi_IO_Unit(char* array,const MPI_Datatype& mpiType,const uint64_t& amount): array(array),mpiType(mpiType),amount(amount) { }
38+
39+
} // namespace vlsv

‎multi_io_unit.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** This file is part of VLSV file format.
22
*
3-
* Copyright 2011, 2012 Finnish Meteorological Institute
3+
* Copyright 2011-2013 Finnish Meteorological Institute
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU Lesser General Public License as published by
@@ -22,7 +22,7 @@
2222
#include <stdint.h>
2323
#include <mpi.h>
2424

25-
namespace VLSV {
25+
namespace vlsv {
2626
/** Definition of a parallel file I/O unit. Processes can
2727
* define zero or more file action units for a collective file I/O
2828
* operation in VLSVWriter and VLSVParReader. Those classes will then

‎visit-plugin/avtVlsvFileFormat.C

+28-28
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ avtVlsvFileFormat::avtVlsvFileFormat(const char *filename): avtSTMDFileFormat(&f
118118

119119
// INITIALIZE DATA MEMBERS
120120
inputFile = filename;
121-
vlsv = NULL;
121+
vlsvReader = NULL;
122122

123123
/*
124124
// TEST
@@ -167,7 +167,7 @@ void avtVlsvFileFormat::FreeUpResources(void) {
167167
debug3 << "VLSV\t object " << objectNumber << " / " << objectCounter << endl;
168168

169169
// Delete VLSVReader:
170-
delete vlsv; vlsv = NULL;
170+
delete vlsvReader; vlsvReader = NULL;
171171
dataTime = INVALID_TIME;
172172
dataTimeFound = false;
173173
dataTimestep = INVALID_CYCLE;
@@ -256,12 +256,12 @@ void avtVlsvFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData* md) {
256256

257257
// ActivateTimeStep should get called prior to this function.
258258
// Check that a VLSV file is open:
259-
if (vlsv == NULL) {
259+
if (vlsvReader == NULL) {
260260
debug2 << "VLSV\t VLSVReader in NULL, calling ActivateTimestep()." << endl;
261261
ActivateTimestep();
262262
}
263263
string dummy;
264-
if (vlsv->getFileName(dummy) == false) {
264+
if (vlsvReader->getFileName(dummy) == false) {
265265
debug2 << "VLSV\t ERROR: Input file has not been opened." << endl;
266266
return;
267267
}
@@ -428,7 +428,7 @@ void avtVlsvFileFormat::ActivateTimestep(void) {
428428
debug3 << "VLSV\t object " << objectNumber << " / " << objectCounter << endl;
429429

430430
// Delete old VLSVReader:
431-
delete vlsv; vlsv = NULL;
431+
delete vlsvReader; vlsvReader = NULL;
432432

433433
/*
434434
// TEST
@@ -440,11 +440,11 @@ void avtVlsvFileFormat::ActivateTimestep(void) {
440440
*/
441441

442442
// Create new VLSVReader and open given file:
443-
vlsv = new VLSVReader;
444-
if (vlsv->open(inputFile) == false) {
443+
vlsvReader = new vlsv::Reader;
444+
if (vlsvReader->open(inputFile) == false) {
445445
debug2 << "VLSV\t ERROR: VLSVReader failed to open input file '" << inputFile << "'" << endl;
446-
vlsv->close();
447-
delete vlsv; vlsv = NULL;
446+
vlsvReader->close();
447+
delete vlsvReader; vlsvReader = NULL;
448448
EXCEPTION1(InvalidDBTypeException,"VLSV Plugin could not open the file.");
449449
return;
450450
}
@@ -453,8 +453,8 @@ void avtVlsvFileFormat::ActivateTimestep(void) {
453453
if (metadataRead == false) {
454454
if (readMetadata() == false) {
455455
debug2 << "VLSV\t ERROR: Failed to read metadata" << endl;
456-
vlsv->close();
457-
delete vlsv; vlsv = NULL;
456+
vlsvReader->close();
457+
delete vlsvReader; vlsvReader = NULL;
458458
EXCEPTION1(InvalidDBTypeException,"VLSV Plugin could not open the file.");
459459
return;
460460
}
@@ -484,7 +484,7 @@ vtkDataSet* avtVlsvFileFormat::GetMesh(int domain,const char *meshname) {
484484
debug3 << "VLSV\t object " << objectNumber << " / " << objectCounter << endl;
485485

486486
// Check that VLSVReader exists:
487-
if (vlsv == NULL) {
487+
if (vlsvReader == NULL) {
488488
debug1 << "VLSV\t ERROR: VLSVReader is NULL" << endl;
489489
EXCEPTION1(InvalidVariableException, meshname);
490490
return NULL;
@@ -515,7 +515,7 @@ vtkDataSet* avtVlsvFileFormat::GetMesh(int domain,const char *meshname) {
515515

516516
// Read mesh coordinates:
517517
void* meshOut = NULL;
518-
if (reader->second->readMesh(vlsv,metadata->second,domain,meshOut) == false) {
518+
if (reader->second->readMesh(vlsvReader,metadata->second,domain,meshOut) == false) {
519519
debug2 << "VLSV\t ERROR: Mesh reader failed to generate mesh" << endl;
520520
}
521521

@@ -548,7 +548,7 @@ bool avtVlsvFileFormat::PrepareVariable(int domain,const char* varName,
548548
meshReader = meshReaders.end();
549549

550550
// Check that VLSVReader exists:
551-
if (vlsv == NULL) {
551+
if (vlsvReader == NULL) {
552552
debug1 << "VLSV\t ERROR: VLSVReader is NULL" << endl;
553553
return false;
554554
}
@@ -639,7 +639,7 @@ vtkDataArray* avtVlsvFileFormat::ReadVariable(int domain,const char* varName) {
639639
return NULL;
640640
}
641641

642-
if (meshReader->second->readVariable(vlsv,metadata->second,*variableMetadata,domain,variablePointer) == false) {
642+
if (meshReader->second->readVariable(vlsvReader,metadata->second,*variableMetadata,domain,variablePointer) == false) {
643643
debug1 << "VLSV\t ERROR: Failed to read variable data" << endl;
644644
rv->Delete();
645645
return NULL;
@@ -683,14 +683,14 @@ int avtVlsvFileFormat::GetCycle(void) {
683683
debug3 << "VLSV\t object " << objectNumber << " / " << objectCounter << endl;
684684

685685
// Check that VLSVReader is not NULL:
686-
if (vlsv == NULL) {
686+
if (vlsvReader == NULL) {
687687
debug1 << "VLSV\t ERROR: VLSVReader is NULL." << endl;
688688
return INVALID_CYCLE;
689689
}
690690

691691
// Read simulation timestep:
692692
dataTimestepFound = true;
693-
if (vlsv->readParameter("timestep",dataTimestep) == false) {
693+
if (vlsvReader->readParameter("timestep",dataTimestep) == false) {
694694
dataTimestep = INVALID_CYCLE;
695695
dataTimestepFound = false;
696696
}
@@ -705,14 +705,14 @@ double avtVlsvFileFormat::GetTime(void) {
705705
debug3 << "VLSV\t object " << objectNumber << " / " << objectCounter << endl;
706706

707707
// Check that VLSVReader is not NULL:
708-
if (vlsv == NULL) {
708+
if (vlsvReader == NULL) {
709709
debug1 << "VLSV\t ERROR: VLSVReader is NULL." << endl;
710710
return INVALID_TIME;
711711
}
712712

713713
// Read simulation time:
714714
dataTimeFound = true;
715-
if (vlsv->readParameter("time",dataTime) == false) {
715+
if (vlsvReader->readParameter("time",dataTime) == false) {
716716
dataTime = INVALID_TIME;
717717
dataTimeFound = false;
718718
}
@@ -736,13 +736,13 @@ bool avtVlsvFileFormat::readMetadata() {
736736
metadataRead = false;
737737

738738
// Check that VLSVReader exists:
739-
if (vlsv == NULL) {
739+
if (vlsvReader == NULL) {
740740
return false;
741741
}
742742

743743
// Read mesh names:
744744
set<string> meshNames;
745-
if (vlsv->getUniqueAttributeValues("MESH","name",meshNames) == false) {
745+
if (vlsvReader->getUniqueAttributeValues("MESH","name",meshNames) == false) {
746746
return false;
747747
}
748748

@@ -754,17 +754,17 @@ bool avtVlsvFileFormat::readMetadata() {
754754
map<string,string> attribsOut;
755755
list<pair<string,string> > attribsIn;
756756
attribsIn.push_back(make_pair("name",*it));
757-
vlsv->getArrayAttributes("MESH",attribsIn,attribsOut);
757+
vlsvReader->getArrayAttributes("MESH",attribsIn,attribsOut);
758758
if (attribsOut.find("type") == attribsOut.end()) {
759759
debug4 << "VLSV\t skipping it because its type is unspecified" << endl;
760760
continue;
761761
}
762762

763763
// Check if mesh type corresponds to one of types supported by VisIt:
764764
bool supportedType = true;
765-
if (attribsOut["type"] == VLSV::MESH_POINT) {
765+
if (attribsOut["type"] == vlsv::mesh::STRING_POINT) {
766766
vlsvplugin::VisitPointMeshMetadata* pointMesh = new vlsvplugin::VisitPointMeshMetadata();
767-
if (pointMesh->read(vlsv,attribsOut) == false) {
767+
if (pointMesh->read(vlsvReader,attribsOut) == false) {
768768
debug2 << "VLSV\t\t Failed to read point mesh metadata" << endl;
769769
delete pointMesh; pointMesh = NULL;
770770
} else {
@@ -782,9 +782,9 @@ bool avtVlsvFileFormat::readMetadata() {
782782
meshMetadata.erase(tmp);
783783
}
784784
}
785-
} else if (attribsOut["type"] == VLSV::MESH_QUAD_MULTI) {
785+
} else if (attribsOut["type"] == vlsv::mesh::STRING_QUAD_MULTI) {
786786
vlsvplugin::VisitQuadMultiMeshMetadata* multiMesh = new vlsvplugin::VisitQuadMultiMeshMetadata();
787-
if (multiMesh->read(vlsv,attribsOut) == false) {
787+
if (multiMesh->read(vlsvReader,attribsOut) == false) {
788788
debug2 << "VLSV\t\t Failed to read multimesh metadata" << endl;
789789
delete multiMesh; multiMesh = NULL;
790790
} else {
@@ -802,9 +802,9 @@ bool avtVlsvFileFormat::readMetadata() {
802802
meshMetadata.erase(tmp);
803803
}
804804
}
805-
} else if (attribsOut["type"] == VLSV::MESH_UCD_MULTI) {
805+
} else if (attribsOut["type"] == vlsv::mesh::STRING_UCD_MULTI) {
806806
vlsvplugin::VisitUCDMultiMeshMetadata* multiUCD = new vlsvplugin::VisitUCDMultiMeshMetadata();
807-
if (multiUCD->read(vlsv,attribsOut) == false) {
807+
if (multiUCD->read(vlsvReader,attribsOut) == false) {
808808
debug2 << "VLSV\t\t Failed to read multimesh metadata" << endl;
809809
delete multiUCD; multiUCD = NULL;
810810
} else {

‎visit-plugin/avtVlsvFileFormat.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class avtVlsvFileFormat: public avtSTMDFileFormat {
9898

9999
protected:
100100
// DATA MEMBERS
101-
VLSVReader* vlsv;
101+
vlsv::Reader* vlsvReader;
102102
std::string inputFile;
103103

104104
bool dataTimestepFound;
@@ -110,11 +110,6 @@ class avtVlsvFileFormat: public avtSTMDFileFormat {
110110
#ifdef PARALLEL
111111
int mpiRank; /**< MPI rank of process owning this instance of VLSV plugin.*/
112112
int mpiProcessCount; /**< Number of MPI processes in VisIt parallel engine.*/
113-
114-
// TEST
115-
// int N_domains;
116-
// uint64_t* domainOffsets;
117-
// END TEST
118113
#endif
119114

120115
bool metadataRead;

‎visit-plugin/mesh_metadata.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace vlsvplugin {
4949

5050
uint64_t MeshMetadata::getDataSize() const {return dataSize;}
5151

52-
VLSV::datatype MeshMetadata::getDatatype() const {return datatype;}
52+
vlsv::datatype::type MeshMetadata::getDatatype() const {return datatype;}
5353

5454
std::string MeshMetadata::getName() const {return name;}
5555

@@ -75,9 +75,9 @@ namespace vlsvplugin {
7575

7676
std::string MeshMetadata::getZUnits() const {return zUnits;}
7777

78-
bool MeshMetadata::read(VLSVReader* vlsv,const std::map<std::string,std::string>& attribs) {
78+
bool MeshMetadata::read(vlsv::Reader* vlsvReader,const std::map<std::string,std::string>& attribs) {
7979
// Check that reader exists:
80-
if (vlsv == NULL) return false;
80+
if (vlsvReader == NULL) return false;
8181

8282
bool success = true;
8383
map<string,string>::const_iterator it;
@@ -122,7 +122,7 @@ namespace vlsvplugin {
122122
debug3 << "VLSV\t\t ERROR: XML tag does have attribute 'datatype'" << endl;
123123
success = false;
124124
} else {
125-
datatype = VLSV::getVLSVDatatype(it->second);
125+
datatype = vlsv::getVLSVDatatype(it->second);
126126
}
127127

128128
// Get optional mesh parameters:

‎visit-plugin/mesh_metadata.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace vlsvplugin {
4848

4949
virtual uint64_t getArraySize() const;
5050
virtual uint64_t getDataSize() const;
51-
virtual VLSV::datatype getDatatype() const;
51+
virtual vlsv::datatype::type getDatatype() const;
5252
virtual std::string getName() const;
5353
virtual uint64_t getNumberOfGhostCells() const;
5454
virtual uint64_t getNumberOfGhostCells(int domain) const =0;
@@ -65,13 +65,13 @@ namespace vlsvplugin {
6565
virtual std::string getYUnits() const;
6666
virtual std::string getZUnits() const;
6767

68-
virtual bool read(VLSVReader* vlsv,const std::map<std::string,std::string>& attribs);
68+
virtual bool read(vlsv::Reader* vlsv,const std::map<std::string,std::string>& attribs);
6969

7070
protected:
7171
uint64_t arraySize;
7272
uint64_t vectorSize;
7373
uint64_t dataSize;
74-
VLSV::datatype datatype;
74+
vlsv::datatype::type datatype;
7575
std::vector<VariableMetadata> variableMetadata;
7676

7777
uint64_t N_ghostCells; /**< Total number of ghost cells in the mesh, summed over all domains.*/

‎visit-plugin/mesh_metadata_visit.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ namespace vlsvplugin {
4141

4242
int VisitMeshMetadata::getTopologicalDimension() const {return topologicalDimension;}
4343

44-
bool VisitMeshMetadata::read(VLSVReader* vlsv,const std::map<std::string,std::string>& attribs) {
45-
return MeshMetadata::read(vlsv,attribs);
44+
bool VisitMeshMetadata::read(vlsv::Reader* vlsvReader,const std::map<std::string,std::string>& attribs) {
45+
return MeshMetadata::read(vlsvReader,attribs);
4646
}
4747

4848
} // namespace vlsvplugin

‎visit-plugin/mesh_metadata_visit.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace vlsvplugin {
3737
virtual int getSpatialDimension() const;
3838
virtual int getTopologicalDimension() const;
3939

40-
virtual bool read(VLSVReader* vlsv,const std::map<std::string,std::string>& attribs);
40+
virtual bool read(vlsv::Reader* vlsv,const std::map<std::string,std::string>& attribs);
4141

4242
protected:
4343

0 commit comments

Comments
 (0)
Please sign in to comment.