Skip to content

Commit ecb3ca5

Browse files
Merge pull request #209 from PauloCarvalhoRJ/GeoGrid
GeoGrid
2 parents 14d08fa + ea0b4d3 commit ecb3ca5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2724
-484
lines changed

GammaRay.pro

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,16 @@ SOURCES += main.cpp\
220220
geostats/searchellipsoid.cpp \
221221
geostats/pointsetcell.cpp \
222222
geostats/indexedspatiallocation.cpp \
223+
domain/geogrid.cpp \
224+
domain/gridfile.cpp \
225+
domain/auxiliary/meshloader.cpp \
226+
geometry/vector3d.cpp \
227+
geometry/face3d.cpp \
223228
dialogs/sisimdialog.cpp \
224-
dialogs/variograminputdialog.cpp
229+
dialogs/variograminputdialog.cpp \
230+
geometry/hexahedron.cpp \
231+
geometry/pyramid.cpp \
232+
geometry/tetrahedron.cpp
225233

226234
HEADERS += mainwindow.h \
227235
domain/project.h \
@@ -420,8 +428,16 @@ HEADERS += mainwindow.h \
420428
geostats/searchellipsoid.h \
421429
geostats/pointsetcell.h \
422430
geostats/indexedspatiallocation.h \
431+
domain/geogrid.h \
432+
domain/gridfile.h \
433+
domain/auxiliary/meshloader.h \
434+
geometry/vector3d.h \
435+
geometry/face3d.h \
423436
dialogs/sisimdialog.h \
424-
dialogs/variograminputdialog.h
437+
dialogs/variograminputdialog.h \
438+
geometry/hexahedron.h \
439+
geometry/pyramid.h \
440+
geometry/tetrahedron.h
425441

426442

427443
FORMS += mainwindow.ui \
@@ -603,7 +619,7 @@ win32 {
603619
# The application version
604620
# Don't forget to update the Util::importSettingsFromPreviousVersion() method to
605621
# enable the import of registry/user settings of previous versions.
606-
VERSION = 4.9
622+
VERSION = 5.0
607623

608624
# Define a preprocessor macro so we can get the application version in application code.
609625
DEFINES += APP_VERSION=\\\"$$VERSION\\\"

art/iconsHD/geogrid32.png

1.31 KB
Loading

art/iconsHD/geogrid32n.png

1.35 KB
Loading

art/logo.odp

100644100755
92 Bytes
Binary file not shown.

calculator/icalcproperty.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ QString ICalcProperty::getScriptCompatibleName()
1616
compatibleName = compatibleName.replace( '+', '_' );
1717
compatibleName = compatibleName.replace( '>', '_' );
1818
compatibleName = compatibleName.replace( '<', '_' );
19+
compatibleName = compatibleName.replace( ':', '_' );
20+
compatibleName = compatibleName.replace( '=', '_' );
1921
return compatibleName;
2022
}

docs/GammaRayManual.docx

366 KB
Binary file not shown.

docs/figures.pptx

-185 KB
Binary file not shown.

domain/auxiliary/meshloader.cpp

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#include "meshloader.h"
2+
3+
#include <QFileInfo>
4+
#include <QTextStream>
5+
6+
#include "util.h"
7+
#include "../application.h"
8+
9+
10+
MeshLoader::MeshLoader(QFile & file, std::vector<VertexRecordPtr> & vertexes,
11+
std::vector<CellDefRecordPtr> & cellDefs,
12+
uint & data_line_count, QObject * parent) :
13+
QObject(parent),
14+
_file(file),
15+
m_vertexes( vertexes ),
16+
m_cellDefs( cellDefs ),
17+
_data_line_count(data_line_count),
18+
_finished(false)
19+
{
20+
21+
}
22+
23+
void MeshLoader::doLoad()
24+
{
25+
QTextStream in(&_file);
26+
long bytesReadSofar = 0;
27+
QStringList valuesAsString;
28+
29+
bool isInVertexesSection = false;
30+
31+
bool isInCellDefsSection = false;
32+
33+
for (int i = 0; !in.atEnd(); ++i)
34+
{
35+
//read file line by line
36+
QString line = in.readLine();
37+
38+
//Clear the list with the tokenized data values as string
39+
valuesAsString.clear();
40+
41+
//updates the progress
42+
bytesReadSofar += line.size() + 1; //account for line break char (in Windows may have 2, though.)
43+
44+
if( ! ( i % 100 ) ){ //update progress for each 100 lines to not impact performance much
45+
// allows tracking progress of a file up to about 400GB
46+
emit progress( (int)(bytesReadSofar / 100) );
47+
}
48+
49+
if( i == 0 || i == 1 ){} //first and second lines are ignored
50+
else { //parse lines containing data (must be within the target interval)
51+
52+
if( !isInVertexesSection && !isInCellDefsSection &&
53+
line.startsWith( "VERTEX LOCATIONS", Qt::CaseInsensitive ) ){
54+
isInVertexesSection = true;
55+
continue; //move on to the next file line
56+
}
57+
58+
if( isInVertexesSection && !isInCellDefsSection &&
59+
line.startsWith( "CELL VERTEX INDEXES", Qt::CaseInsensitive ) ){
60+
isInVertexesSection = false;
61+
isInCellDefsSection = true;
62+
continue; //move on to the next file line
63+
}
64+
65+
//read line from the GSLib data file
66+
Util::fastSplit( line, valuesAsString );
67+
68+
if( isInVertexesSection ){
69+
if( valuesAsString.size() != 3 ){
70+
Application::instance()->logError( QString("MeshLoader::doLoad(): vertex coordinate count different from 3 in line ").append(QString::number(i)) );
71+
m_vertexes.push_back( VertexRecordPtr( new VertexRecord{ 0.0, 0.0, 0.0 } ) );
72+
} else {
73+
bool ok[] = {true, true, true};
74+
double x = valuesAsString[0].toDouble( &ok[0] );
75+
double y = valuesAsString[1].toDouble( &ok[1] );
76+
double z = valuesAsString[2].toDouble( &ok[2] );
77+
if( !ok[0] || !ok[1] || !ok[2] )
78+
Application::instance()->logError( QString("MeshLoader::doLoad(): error in vertex section of mesh file (line ").
79+
append(QString::number(i)).append("): could not convert a value to double.") );
80+
m_vertexes.push_back( VertexRecordPtr( new VertexRecord{ x, y, z } ) ) ;
81+
}
82+
} else if( isInCellDefsSection ) {
83+
if( valuesAsString.size() != 8 ){
84+
Application::instance()->logError( QString("MeshLoader::doLoad(): vertex id count in cell definition different from 8 in line ").append(QString::number(i)) );
85+
m_cellDefs.push_back( CellDefRecordPtr( new CellDefRecord{ {0, 0, 0, 0, 0, 0, 0, 0} } ) );
86+
} else {
87+
bool ok[] = {true, true, true, true, true, true, true, true};
88+
int vId[8];
89+
vId[0] = valuesAsString[0].toInt( &ok[0] );
90+
vId[1] = valuesAsString[1].toInt( &ok[1] );
91+
vId[2] = valuesAsString[2].toInt( &ok[2] );
92+
vId[3] = valuesAsString[3].toInt( &ok[3] );
93+
vId[4] = valuesAsString[4].toInt( &ok[4] );
94+
vId[5] = valuesAsString[5].toInt( &ok[5] );
95+
vId[6] = valuesAsString[6].toInt( &ok[6] );
96+
vId[7] = valuesAsString[7].toInt( &ok[7] );
97+
if( !ok[0] || !ok[1] || !ok[2] || !ok[3] || !ok[4] || !ok[5] || !ok[6] || !ok[7] )
98+
Application::instance()->logError( QString("MeshLoader::doLoad(): error in cell definition section of mesh file (line ").
99+
append(QString::number(i)).append("): could not convert a value to unsigned integer.") );
100+
m_cellDefs.push_back( CellDefRecordPtr( new CellDefRecord{ { vId[0], vId[1], vId[2], vId[3], vId[4], vId[5], vId[6], vId[7] } } ) );
101+
}
102+
}
103+
104+
++_data_line_count;
105+
}
106+
}
107+
108+
_finished = true;
109+
}

domain/auxiliary/meshloader.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#ifndef MESHLOADER_H
2+
#define MESHLOADER_H
3+
4+
#include <QObject>
5+
#include <QFile>
6+
#include "../geogrid.h"
7+
8+
/** This is an auxiliary class used in GeoGrid::loadMesh() to enable the progress dialog.
9+
* The file is read in a separate thread, so the progress bar updates.
10+
*/
11+
class MeshLoader : public QObject
12+
{
13+
14+
Q_OBJECT
15+
16+
public:
17+
explicit MeshLoader(QFile &file,
18+
std::vector< VertexRecordPtr > &vertexes,
19+
std::vector< CellDefRecordPtr > &cellDefs,
20+
uint &data_line_count,
21+
QObject *parent = 0);
22+
23+
bool isFinished(){ return _finished; }
24+
25+
public slots:
26+
void doLoad( );
27+
signals:
28+
void progress(int);
29+
30+
private:
31+
QFile &_file;
32+
std::vector< VertexRecordPtr > &m_vertexes;
33+
std::vector< CellDefRecordPtr > &m_cellDefs;
34+
uint &_data_line_count;
35+
bool _finished;
36+
};
37+
38+
#endif // MESHLOADER_H

0 commit comments

Comments
 (0)