Skip to content

Commit 57e9679

Browse files
committed
Clean up
1 parent 29b1fe4 commit 57e9679

File tree

10 files changed

+62
-76
lines changed

10 files changed

+62
-76
lines changed

src/Core/Matlab/fieldtomatlab.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ option_forceoldnames_(false),
4444
{
4545
}
4646

47-
void FieldToMatlabAlgo::setreporter(SCIRun::ProgressReporter* pr)
47+
void FieldToMatlabAlgo::setreporter(LoggerHandle pr)
4848
{
4949
pr_ = pr;
5050
}

src/Core/Matlab/fieldtomatlab.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ DEALINGS IN THE SOFTWARE.
6060

6161
#include <Core/Matlab/matfilebase.h>
6262
#include <Core/Datatypes/DatatypeFwd.h>
63+
#include <Core/Datatypes/Legacy/Field/FieldFwd.h>
64+
#include <Core/Logging/LoggerFwd.h>
6365
#include <Core/Matlab/share.h>
6466

6567
namespace SCIRun
@@ -90,11 +92,11 @@ namespace SCIRun
9092

9193
virtual bool execute(SCIRun::FieldHandle fieldH, matlabarray& mlarray);
9294

93-
inline void setreporter(SCIRun::Logging::LoggerHandle pr);
95+
inline void setreporter(SCIRun::Core::Logging::LoggerHandle pr);
9496

9597
protected:
9698

97-
bool mladdmeshheader(SCIRun::FieldInformation fi, const matlabarray& mlarray);
99+
bool mladdmeshheader(const SCIRun::FieldInformation& fi, const matlabarray& mlarray);
98100
bool mladdnodes(SCIRun::VMesh* mesh,const matlabarray& mlarray);
99101
bool mladdedges(SCIRun::VMesh* mesh,const matlabarray& mlarray);
100102
bool mladdfaces(SCIRun::VMesh* mesh,const matlabarray& mlarray);
@@ -110,7 +112,7 @@ namespace SCIRun
110112
bool mladddimension2d(SCIRun::VMesh* mesh,const matlabarray& mlarray);
111113
bool mladddimension3d(SCIRun::VMesh* mesh,const matlabarray& mlarray);
112114

113-
bool mladdfieldheader(SCIRun::FieldInformation fi, const matlabarray& mlarray);
115+
bool mladdfieldheader(const SCIRun::FieldInformation& fi, const matlabarray& mlarray);
114116

115117
bool mladdfielddata(SCIRun::VField* field,SCIRun::VMesh* mesh,const matlabarray& mlarray);
116118

src/Core/Matlab/matfile.cc

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939

4040
/*
4141
* The matfile class is the basic interface for reading and
42-
* writing .mat files (matlab files). This class currently
43-
* only supports the so called matlab version 5 file format
42+
* writing .mat files (Matlab files). This class currently
43+
* only supports the so called Matlab version 5 file format
4444
* which is used from version 5.0 to version 6.5, currently
45-
* the lastest version of matlab available. Matlab V4 files
46-
* should be converted using matlab into the newer file format.
45+
* the lastest version of Matlab available. Matlab V4 files
46+
* should be converted using Matlab into the newer file format.
4747
*
4848
* This class handles the following aspects:
4949
* - opening and closing .mat files
@@ -53,14 +53,10 @@
5353
*
5454
*/
5555

56-
#include "matfile.h"
57-
#include "matfiledata.h"
58-
56+
#include <Core/Matlab/matfile.h>
5957
#include <zlib.h>
60-
#include <string.h>
6158

62-
63-
namespace MatlabIO {
59+
using namespace SCIRun::MatlabIO;
6460

6561
// Function for doing byteswapping when loading a file created on a different platform
6662

@@ -337,7 +333,7 @@ void matfile::open(const std::string& filename,const std::string& mode)
337333
if(!(m_->fptr_ = fopen(m_->fname_.c_str(),"wb"))) throw could_not_open_file();
338334

339335
// Setup the default parameters for the header
340-
// Version 0x0100 is the matlab default for an externaly created std::FILE
336+
// Version 0x0100 is the Matlab default for an externaly created std::FILE
341337
// All files are written in the native format, byteswapping is done
342338
// when reading files.
343339

src/Core/Matlab/matfile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
*
8383
*/
8484

85+
#include <cstdint>
8586
#include <stack>
8687
#include <Core/Matlab/matfiledata.h>
8788
#include <Core/Matlab/share.h>

src/Core/Matlab/matfiledata.cc

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838

3939
/*
4040
* The matfile class is the basic interface for reading and
41-
* writing .mat files (matlab files). This class currently
42-
* only supports the so called matlab version 5 file format
41+
* writing .mat files (Matlab files). This class currently
42+
* only supports the so called Matlab version 5 file format
4343
* which is used from version 5.0 to version 6.5, currently
44-
* the lastest version of matlab available. Matlab V4 files
45-
* should be converted using matlab into the newer file format.
44+
* the latest version of Matlab available. Matlab V4 files
45+
* should be converted using Matlab into the newer file format.
4646
*
4747
* This class handles the following aspects:
4848
* - opening and closing .mat files
@@ -51,16 +51,11 @@
5151
* - reading/writing the tags in the .mat file
5252
*
5353
*/
54-
55-
56-
#include "matfiledata.h"
57-
#include <string.h>
58-
59-
namespace MatlabIO {
6054

61-
// matfiledata functions
55+
#include <Core/Matlab/matfiledata.h>
56+
57+
using namespace SCIRun::MatlabIO;
6258

63-
// basic constructor
6459
matfiledata::matfiledata()
6560
: m_(0), ptr_(0)
6661
{

src/Core/Matlab/matlabarray.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
* DATE: 16 MAY 2005
3838
*/
3939

40-
#include "matlabarray.h"
40+
#include <Core/Matlab/fieldtomatlab.h>
4141

42-
namespace MatlabIO {
42+
using namespace SCIRun::MatlabIO;
4343

4444
// matlabarray management functions
4545
// constructor/destructor

src/Core/Matlab/matlabconverter.cc

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,13 @@
3232
* DATE: 17 OCT 2004
3333
*/
3434

35-
#include <math.h>
3635
#include <Core/Matlab/matlabconverter.h>
37-
#include <Core/Datatypes/MatrixTypeConverter.h>
38-
#include <Core/Datatypes/Matrix.h>
3936

40-
namespace MatlabIO {
37+
using namespace SCIRun::MatlabIO;
4138

42-
using namespace SCIRun;
4339

4440
// Currently the property converter only manages strings
45-
// all other data is ignored both on matlabside as well
41+
// all other data is ignored both on matlab side as well
4642
// as on the property manager side.
4743

4844
/* DESIGN NOTES : */
@@ -55,21 +51,21 @@ using namespace SCIRun;
5551
* which leads to a huge conversion problem. Hence only the useful
5652
* objects are translated the rest is just discarded. Until there
5753
* is a better data management structure within SCIRun, the conversion
58-
* process is basically a big switch statemet scanning for each possible
54+
* process is basically a big switch statement scanning for each possible
5955
* object structure
6056
*/
6157

6258
/*
6359
* With the hope in mind that a better data management system will be
6460
* in place in the future, all conversion algorithms are grouped in
65-
* this one object. All the other matlab classes function independent
61+
* this one object. All the other Matlab classes function independent
6662
* of the main SCIRun structure, it has its own memory and data management
67-
* making it easier to adapt to future changes. The separation of matlab
68-
* and SCIRun data management has the advantage that the matlab side can be
69-
* further enhanced to deal with different future matlab fileformats, without
70-
* having to comb through the conversion prs. Though there is a little
63+
* making it easier to adapt to future changes. The separation of Matlab
64+
* and SCIRun data management has the advantage that the Matlab side can be
65+
* further enhanced to deal with different future Matlab file formats, without
66+
* having to comb through the conversion code. Though there is a little
7167
* memory overhead. Especially with the V7 compressed files, more memory
72-
* is needed to maintain the integrity of the matlab reader. Some changes
68+
* is needed to maintain the integrity of the Matlab reader. Some changes
7369
* in this converter may be needed to enhance performance. Currently the
7470
* a compressed file will be decompressed and scanned for suitable objects.
7571
* Upon loading the matrix, the matrix will be decompressed again as after
@@ -91,7 +87,7 @@ matlabconverter::matlabconverter() :
9187
{
9288
}
9389

94-
matlabconverter::matlabconverter(SCIRun::ProgressReporter* pr) :
90+
matlabconverter::matlabconverter(LoggerHandle pr) :
9591
pr_(pr),
9692
numericarray_(false),
9793
indexbase_(1),
@@ -123,8 +119,8 @@ unsigned int matlabconverter::convertmitype(matlabarray::mitype type)
123119
}
124120

125121

126-
// This function converts nrrds into matlab matrices
127-
// only the datais being transformed into a matlab array
122+
// This function converts nrrds into Matlab matrices
123+
// only the datais being transformed into a Matlab array
128124

129125
matlabarray::mitype matlabconverter::convertnrrdtype(int type)
130126
{
@@ -145,7 +141,7 @@ matlabarray::mitype matlabconverter::convertnrrdtype(int type)
145141
}
146142

147143
// Support function to check whether the names supplied are within the
148-
// rules that matlab allows. Otherwise we could save the file, but matlab
144+
// rules that Matlab allows. Otherwise we could save the file, but Matlab
149145
// would complain it could not read the file.
150146

151147
bool matlabconverter::isvalidmatrixname(std::string name)
@@ -626,7 +622,7 @@ void matlabconverter::mlArrayTOsciMatrix(matlabarray &ma,MatrixHandle &handle)
626622
// There is no transpose function to operate on the same memory block
627623
// Hence, it is a little memory inefficient.
628624

629-
handle = dm.make_transpose(); // SCIRun has a C++-style matrix and matlab a FORTRAN-style matrix;
625+
handle = dm.make_transpose(); // SCIRun has a C++-style matrix and Matlab a FORTRAN-style matrix;
630626
}
631627
}
632628
break;
@@ -650,7 +646,7 @@ void matlabconverter::mlArrayTOsciMatrix(matlabarray &ma,MatrixHandle &handle)
650646
const SparseRowMatrix::Storage& values = data.data();
651647

652648
// NOTE: this was flipped around in the old code: the arrays rows/cols were passed as cols/rows into the SparseRowMatrix ctor. Hence the screwy order here, and the transpose call below.
653-
// REASON: SCIRun uses Row sparse matrices and matlab Column sparse matrices.
649+
// REASON: SCIRun uses Row sparse matrices and Matlab Column sparse matrices.
654650
ma.getnumericarray(values.get(), nnz);
655651
ma.getrowsarray(cols.get(), nnz);
656652
ma.getcolsarray(rows.get(), (n+1));
@@ -916,7 +912,7 @@ int matlabconverter::sciNrrdDataCompatible(matlabarray &mlarray, std::string &in
916912
void matlabconverter::mlArrayTOsciNrrdData(matlabarray &mlarray,NrrdDataHandle &scinrrd)
917913
{
918914
// Depending on the matlabclass there are several converters
919-
// for converting the data from matlab into a SCIRun Nrrd object
915+
// for converting the data from Matlab into a SCIRun Nrrd object
920916

921917
matlabarray::mlclass mclass;
922918
mclass = mlarray.getclass();
@@ -943,7 +939,7 @@ void matlabconverter::mlArrayTOsciNrrdData(matlabarray &mlarray,NrrdDataHandle &
943939

944940
// obtain the type of the new nrrd
945941
// we want to keep the nrrd type the same
946-
// as the original matlab type
942+
// as the original Matlab type
947943

948944
unsigned int nrrdtype = convertmitype(mlarray.gettype());
949945

@@ -1402,14 +1398,14 @@ void matlabconverter::sciNrrdDataTOmlMatrix(NrrdDataHandle &scinrrd, matlabarray
14021398
// if there is no data leave the object empty
14031399
if (totsize == 0) return;
14041400

1405-
// we now have to determine the type of the matlab array
1401+
// we now have to determine the type of the Matlab array
14061402
// It can be either the same as in the nrrd array or casted
14071403
// to a more appropriate type
1408-
// type will store the new matlab array type
1404+
// type will store the new Matlab array type
14091405

14101406
if(dataformat == matlabarray::miSAMEASDATA) dataformat = convertnrrdtype(nrrdptr->type);
14111407

1412-
// create the matlab array structure
1408+
// create the Matlab array structure
14131409
mlarray.createdensearray(dims,dataformat);
14141410

14151411
// having the correct pointer type will automatically invoke
@@ -1645,7 +1641,7 @@ void matlabconverter::sciFieldTOmlArray(FieldHandle &scifield,matlabarray &mlarr
16451641
// Since the matlabconverter holds all our converter settings, we don't want to lose it, hence it is added
16461642
// here. The only disadvantage is that some of the functions in the matlabconverter class nedd to be public
16471643

1648-
// create a new structured matlab array
1644+
// create a new structured Matlab array
16491645
mlarray.createstructarray();
16501646

16511647
if(!(algo.execute(scifield,mlarray)))
@@ -1660,7 +1656,7 @@ void matlabconverter::sciFieldTOmlArray(FieldHandle &scifield,matlabarray &mlarr
16601656

16611657
if (mlarray.isempty())
16621658
{
1663-
// Apparently my sanity check did not work, we did not get a matlab object
1659+
// Apparently my sanity check did not work, we did not get a Matlab object
16641660
error("Converter did not result in a useful translation, something went wrong, giving up.");
16651661
throw matlabconverter_error();
16661662
}
@@ -1874,7 +1870,7 @@ void matlabconverter::sciBundleTOmlArray(BundleHandle &scibundle, matlabarray &m
18741870

18751871
// This routine scans systematically whether certain
18761872
// SCIRun objects are contained in the bundle and then
1877-
// converts them into matlab objects
1873+
// converts them into Matlab objects
18781874

18791875
for (int p=0; p < numhandles; p++)
18801876
{

src/Core/Matlab/matlabfile.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
* DATE: 16 MAY 2005
3838
*/
3939

40-
#include "matlabfile.h"
40+
#include <Core/Matlab/fieldtomatlab.h>
4141

42-
namespace MatlabIO {
42+
using namespace SCIRun::MatlabIO;
4343

4444
// constructor
4545
matlabfile::matlabfile()

0 commit comments

Comments
 (0)