Skip to content

Commit 03b8517

Browse files
committed
big update to make it compile
1 parent 912c0a9 commit 03b8517

21 files changed

Lines changed: 1893 additions & 1050 deletions

src/converter/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ line.C
1212
lognormalGenerator.C
1313
main.C
1414
octreegridlocalizer.C
15-
outputmanager.C
16-
overlap.C
1715
prism.C
1816
region.C
1917
surface.C
@@ -22,6 +20,7 @@ vertex.C
2220
converterinputrecord.C
2321
convertertxtinputrecord.C
2422
convertertxtdatareader.C
23+
boundarysphere.C
2524
)
2625

2726
add_library(converter STATIC ${CONVERTER_SOURCES})

src/converter/boundarysphere.C

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ void BoundarySphere :: findOutsiders(oofem::FloatArray &boundaries)
3939
//For nodes: 0 = inside, 1 = outside, 2 = on boundary
4040
//For elements: 0 = inside, 1 = completetly outside (one node could be on boundary), 2 = one node inside and one outside, 3 = on boundary
4141

42-
IntArray nodes;
42+
oofem::IntArray nodes;
4343
oofem::FloatArray coords, coordsOne, coordsTwo;
4444
int outsideFlag;
45-
IntArray locationArray(2);
45+
oofem::IntArray locationArray(2);
4646

4747
double newTol = 1.e3*this->grid->giveTol();
4848

@@ -143,10 +143,10 @@ void BoundarySphere :: findOutsiders(oofem::FloatArray &boundaries)
143143
int
144144
BoundarySphere :: modifyVoronoiCrossSection(int elementNumber)
145145
{
146-
IntArray crossSectionElements;
147-
IntArray crossSectionVertices;
146+
oofem::IntArray crossSectionElements;
147+
oofem::IntArray crossSectionVertices;
148148

149-
IntArray nodes(2);
149+
oofem::IntArray nodes(2);
150150

151151
oofem::FloatArray coords(3);
152152

@@ -183,7 +183,7 @@ BoundarySphere :: modifyVoronoiCrossSection(int elementNumber)
183183

184184
//Resize cross-section elements
185185
int newSize = elementSize - elementCounter;
186-
IntArray modifiedCrossSectionElements(newSize);
186+
oofem::IntArray modifiedCrossSectionElements(newSize);
187187
int help = 0;
188188
for ( int i = 0; i < elementSize; i++ ) {
189189
if ( crossSectionElements.at(i + 1) == 0 ) {
@@ -204,7 +204,7 @@ BoundarySphere :: modifyVoronoiCrossSection(int elementNumber)
204204
}
205205

206206
//Write modified vertex vector
207-
IntArray modifiedCrossSectionVertices(vertexSize - nodeCounter);
207+
oofem::IntArray modifiedCrossSectionVertices(vertexSize - nodeCounter);
208208
help = 0;
209209
for ( int i = 0; i < vertexSize; i++ ) {
210210
if ( crossSectionVertices.at(i + 1) == 0 ) {

src/converter/converterdatareader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class ConverterDataReader
5757
public:
5858
/// Determines the type of input record.
5959
enum ConverterInputRecordType {
60-
CIR_domainRec, CIR_controlRec, CIR_domainCompRec, CIR_vertexRec, CIR_controlVertexRec, CIR_curveRec, CIR_surfaceRec, CIR_regionRec, CIR_inclusionRec, CIR_aggregateRec, CIR_refinementRec
60+
CIR_domainRec, CIR_controlRec, CIR_domainCompRec, CIR_vertexRec, CIR_controlVertexRec, CIR_curveRec, CIR_surfaceRec, CIR_regionRec, CIR_inclusionRec, CIR_fibreRec
6161
};
6262

6363
ConverterDataReader() { }

src/converter/convertererror.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
#include <string>
66

77
namespace converter {
8-
// Simple message (no formatting)
8+
9+
10+
// Simple message (no formatting)
911
[[noreturn]] inline void error(const std::string &msg) {
1012
std::fputs(msg.c_str(), stderr);
1113
std::fputc('\n', stderr);
@@ -26,4 +28,12 @@ namespace converter {
2628
[[noreturn]] inline void error4(const char *fmt, int a, int b, int c) {
2729
errorf(fmt, a, b, c);
2830
}
31+
32+
inline FILE* fopen_or_die(const std::string& name, const char* mode) {
33+
if (FILE* f = std::fopen(name.c_str(), mode)) return f;
34+
errorf("Cannot open output file %s", name.c_str());
35+
return nullptr; // unreachable
36+
}
37+
38+
2939
} // namespace converter

src/converter/converterinputrecord.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include <string>
3636
#include <algorithm>
3737
#include <cctype>
38-
#include "generatorinputrecord.h"
38+
#include "converterinputrecord.h"
3939

4040
void
4141
ConverterInputRecord::giveOptionalField(int &answer, InputFieldType id)

src/converter/converterlistutils.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
#include <vector>
33
#include <iostream>
44
#include <cstdlib>
5+
#include "convertererror.h"
56

67
namespace converter {
7-
template< class T >
8+
9+
10+
11+
template< class T >
812
inline bool includes1(const std::vector< T * > &v, int i) {
913
return i >= 1 && static_cast< size_t >( i ) <= v.size() && v [ i - 1 ] != nullptr;
1014
}
@@ -50,4 +54,13 @@ template< class T >
5054
inline int size1(const std::vector< T * > &v) {
5155
return static_cast< int >( v.size() );
5256
}
57+
58+
template <class T>
59+
inline T* require_at1(std::vector<T*>& v, int i, const char* what) {
60+
if (includes1(v, i)) return at1(v, i);
61+
errorf("%s: undefined id (%d)", what, i);
62+
return nullptr;
63+
}
64+
65+
5366
} // namespace converter

src/converter/convertertxtdatareader.C

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3333
*/
3434

35-
#include "generatorerror.h"
36-
#include "generatortxtdatareader.h"
35+
#include "convertererror.h"
36+
#include "convertertxtdatareader.h"
3737
#include "error.h"
3838
#include <iostream>
3939
#include <string>
@@ -46,7 +46,7 @@ ConverterTXTDataReader::ConverterTXTDataReader(std::string inputfilename) : Conv
4646
{
4747
std::ifstream inputStream(dataSourceName);
4848
if ( !inputStream.is_open() ) {
49-
generator::errorf("Can't open input stream (%s)", dataSourceName.c_str() );
49+
converter::errorf("Can't open input stream (%s)", dataSourceName.c_str() );
5050
}
5151

5252
int lineNumber = 0;
@@ -72,7 +72,7 @@ ConverterTXTDataReader::ConverterTXTDataReader(std::string inputfilename) : Conv
7272
std::string line;
7373
std::ifstream includedStream(fname);
7474
if ( !includedStream.is_open() ) {
75-
generator::errorf("Can't open input stream (%s)", fname.c_str() );
75+
converter::errorf("Can't open input stream (%s)", fname.c_str() );
7676
}
7777
while ( this->giveLineFromInput(includedStream, includedLine, line) ) {
7878
lines.emplace(it, make_pair(includedLine, line) );
@@ -97,7 +97,7 @@ ConverterInputRecord &
9797
ConverterTXTDataReader::giveInputRecord(ConverterInputRecordType typeId, int recordId)
9898
{
9999
if ( this->it == this->recordList.end() ) {
100-
generator::error("Out of input records, file contents must be missing");
100+
converter::error("Out of input records, file contents must be missing");
101101
}
102102
return * this->it++;
103103
}

src/converter/convertertxtinputrecord.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3333
*/
3434

35-
#include "generatortxtinputrecord.h"
35+
#include "convertertxtinputrecord.h"
3636
#include "intarray.h"
3737
#include "floatarray.h"
3838
#include "floatmatrix.h"
3939
#include "dictionary.h"
4040
#include "range.h"
4141
#include "scalarfunction.h"
42-
#include "generatorerror.h"
42+
#include "convertererror.h"
4343

4444

4545
#include <cstdlib>

src/converter/ellipsoid.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ class Ellipsoid : public Inclusion
6969
/// Returns class name of the receiver.
7070
const char *giveClassName() const { return "Ellipsoid"; }
7171

72-
void initializeFrom(ConverterInputRecord &ir);
72+
73+
void initializeFrom(ConverterInputRecord &ir) override;
7374

7475
// to know whether a point is inside the ellipsoid
7576
// 1 means inside , 0 outisde , 2 in the ITZ (if specified)

0 commit comments

Comments
 (0)