Skip to content

Commit 912c0a9

Browse files
committed
further improvement
1 parent 935cef0 commit 912c0a9

30 files changed

Lines changed: 739 additions & 993 deletions

src/converter/boundarysphere.C

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,12 @@ BoundarySphere :: ~BoundarySphere()
1919
}
2020

2121

22-
IRResultType
23-
BoundarySphere :: initializeFrom(InputRecord *ir)
24-
// Gets from the source line from the data file all the data of the receiver.
22+
void
23+
BoundarySphere :: initializeFrom(ConverterInputRecord &ir)
2524
{
26-
const char *__proc = "initializeFrom"; // Required by IR_GIVE_FIELD macro
27-
IRResultType result; // Required by IR_GIVE_FIELD macro
28-
29-
// int j, size;
30-
// oofem::FloatArray vertices;
31-
// IntArray *dofIDArry;
32-
IR_GIVE_FIELD(ir, centre, IFT_BoundarySphere_centre, "centre");
33-
IR_GIVE_FIELD(ir, radius, IFT_BoundarySphere_radius, "radius"); // Macro
34-
return IRRT_OK;
35-
36-
//Print command for double
37-
// printf("diameter = %e\n", diameter);
38-
//Print command for integer
39-
// printf("number = %d\n", number);
40-
//Print command for array
41-
// centre.printYourself();
25+
IR_GIVE_FIELD(ir, centre, _IFT_BoundarySphere_centre);
26+
IR_GIVE_FIELD(ir, radius, _IFT_BoundarySphere_radius);
27+
return;
4228
}
4329

4430

src/converter/boundarysphere.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#include <stdio.h>
1919
#endif
2020

21+
#define _IFT_BoundarySphere_centre "centre"
22+
#define _IFT_BoundarySphere_radius "radius"
23+
2124
class BoundarySphere : public Region
2225
{
2326

@@ -53,7 +56,7 @@ class BoundarySphere : public Region
5356
/// Returns class name of the receiver.
5457
const char *giveClassName() const { return "BoundarySphere"; }
5558

56-
IRResultType initializeFrom(InputRecord *ir);
59+
void initializeFrom(ConverterInputRecord &ir);
5760
//virtual IntArray* ResolveDofIDArray (char* initString);
5861
/// prints receiver state on stdout. Usefull for debuging.
5962
void printYourself();
@@ -68,7 +71,7 @@ class BoundarySphere : public Region
6871
};
6972

7073

71-
#endif // node_h
74+
#endif // boundaryspeher_h
7275

7376

7477

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-
GIR_domainRec, GIR_controlRec, GIR_domainCompRec, GIR_vertexRec, GIR_controlVertexRec, GIR_curveRec, GIR_surfaceRec, GIR_regionRec, GIR_inclusionRec, GIR_aggregateRec, GIR_refinementRec
60+
CIR_domainRec, CIR_controlRec, CIR_domainCompRec, CIR_vertexRec, CIR_controlVertexRec, CIR_curveRec, CIR_surfaceRec, CIR_regionRec, CIR_inclusionRec, CIR_aggregateRec, CIR_refinementRec
6161
};
6262

6363
ConverterDataReader() { }

src/converter/curve.C

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,12 @@ Curve :: giveLocalVertex(int i)
2727
return vertices.at(i);
2828
}
2929

30-
31-
IRResultType
32-
Curve :: initializeFrom(InputRecord *ir)
30+
void
31+
Curve :: initializeFrom(ConverterInputRecord &ir)
3332
// Gets from the source line from the data file all the data of the receiver.
3433
{
35-
const char *__proc = "initializeFrom"; // Required by IR_GIVE_FIELD macro
36-
IRResultType result; // Required by IR_GIVE_FIELD macro
37-
38-
IR_GIVE_FIELD(ir, vertices, IFT_Curve_vertices, "vertices"); // Macro
34+
IR_GIVE_FIELD(ir, vertices, _IFT_Curve_vertices); // Macro
3935
refinement = 1.;
40-
IR_GIVE_OPTIONAL_FIELD(ir, refinement, IFT_Curve_refine, "refine"); // Macro
41-
return IRRT_OK;
42-
}
43-
44-
45-
46-
Curve *Curve :: ofType()
47-
// Returns a new DofManager, which has the same number than the receiver,
48-
// but belongs to aClass (Node, LineSide,..).
49-
{
50-
Curve *curve;
51-
52-
curve = new Curve(number,grid);
53-
54-
return curve;
36+
IR_GIVE_OPTIONAL_FIELD(ir, refinement, _IFT_Curve_refine); // Macro
37+
return;
5538
}

src/converter/curve.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
#include <stdio.h>
1616
#endif
1717

18+
#define _IFT_Curve_vertices "vertices"
19+
#define _IFT_Curve_refine "refine"
20+
1821
//class oofem::FloatArray;
1922
//class oofem::IntArray;
2023

@@ -43,13 +46,11 @@ class Curve : public GridComponent
4346
/// Returns pointer to curve vertex array.
4447
oofem::IntArray *giveLocalVertices() { return & vertices; }
4548

46-
Vertex *giveGlobalVertex(int i, AList <Vertex> *vertexList);
47-
4849
Curve *ofType();
4950

5051
const char *giveClassName() const { return "Curve"; }
5152

52-
IRResultType initializeFrom(InputRecord *ir);
53+
void initializeFrom(ConverterInputRecord &ir);
5354

5455
void printYourself();
5556

src/converter/cylinder.C

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,15 @@ Cylinder :: ~Cylinder()
1919
}
2020

2121

22-
IRResultType
23-
Cylinder :: initializeFrom(InputRecord *ir)
22+
void
23+
Cylinder :: initializeFrom(ConverterInputRecord &ir)
2424
// Gets from the source line from the data file all the data of the receiver.
2525
{
26-
const char *__proc = "initializeFrom"; // Required by IR_GIVE_FIELD macro
27-
IRResultType result; // Required by IR_GIVE_FIELD macro
28-
29-
// int j, size;
30-
// oofem::FloatArray vertices;
31-
// IntArray *dofIDArry;
32-
IR_GIVE_FIELD(ir, line, IFT_Cylinder_line, "line");
33-
IR_GIVE_FIELD(ir, radius, IFT_Cylinder_radius, "radius"); // Macro
26+
IR_GIVE_FIELD(ir, line, _IFT_Cylinder_line);
27+
IR_GIVE_FIELD(ir, radius, _IFT_Cylinder_radius); // Macro
3428
refinement = 1.;
35-
IR_GIVE_OPTIONAL_FIELD(ir, refinement, IFT_Cylinder_refine, "refine"); // Macro
36-
return IRRT_OK;
37-
29+
IR_GIVE_OPTIONAL_FIELD(ir, refinement, _IFT_Cylinder_refine); // Macro
30+
return;
3831
}
3932

4033

@@ -60,10 +53,10 @@ void Cylinder :: findOutsiders(oofem::FloatArray &boundaries)
6053
//For nodes: 0 = inside, 1 = outside, 2 = on boundary
6154
//For elements: 0 = inside, 1 = completetly outside (one node could be on boundary), 2 = one node inside and one outside, 3 = on boundary
6255

63-
IntArray nodes;
56+
oofem::IntArray nodes;
6457
oofem::FloatArray coords, coordsOne, coordsTwo;
6558
int outsideFlag;
66-
IntArray locationArray(2);
59+
oofem::IntArray locationArray(2);
6760

6861
double newTol = 1.e3*this->grid->giveTol();
6962

@@ -186,10 +179,10 @@ void Cylinder :: findOutsiders(oofem::FloatArray &boundaries)
186179
int
187180
Cylinder :: modifyVoronoiCrossSection(int elementNumber)
188181
{
189-
IntArray crossSectionElements;
190-
IntArray crossSectionVertices;
182+
oofem::IntArray crossSectionElements;
183+
oofem::IntArray crossSectionVertices;
191184

192-
IntArray nodes(2);
185+
oofem::IntArray nodes(2);
193186

194187
oofem::FloatArray coords(3);
195188

@@ -235,7 +228,7 @@ Cylinder :: modifyVoronoiCrossSection(int elementNumber)
235228

236229
//Resize cross-section elements
237230
int newSize = elementSize - elementCounter;
238-
IntArray modifiedCrossSectionElements(newSize);
231+
oofem::IntArray modifiedCrossSectionElements(newSize);
239232
int help = 0;
240233
for ( int i = 0; i < elementSize; i++ ) {
241234
if ( crossSectionElements.at(i + 1) == 0 ) {
@@ -256,7 +249,7 @@ Cylinder :: modifyVoronoiCrossSection(int elementNumber)
256249
}
257250

258251
//Write modified vertex vector
259-
IntArray modifiedCrossSectionVertices(vertexSize - nodeCounter);
252+
oofem::IntArray modifiedCrossSectionVertices(vertexSize - nodeCounter);
260253
help = 0;
261254
for ( int i = 0; i < vertexSize; i++ ) {
262255
if ( crossSectionVertices.at(i + 1) == 0 ) {
@@ -282,10 +275,10 @@ int
282275
Cylinder :: areaCheck(int elementNumber)
283276
{
284277

285-
IntArray crossSectionElements;
286-
IntArray crossSectionVertices;
278+
oofem::IntArray crossSectionElements;
279+
oofem::IntArray crossSectionVertices;
287280

288-
IntArray nodes(2);
281+
oofem::IntArray nodes(2);
289282

290283
oofem::FloatArray coords(3);
291284

src/converter/cylinder.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "grid.h"
55
#include "region.h"
66

7-
#include "floatarry.h"
7+
#include "floatarray.h"
88
#include "intarray.h"
99

1010
#include "converterinputrecord.h"
@@ -17,8 +17,9 @@
1717
#include <stdio.h>
1818
#endif
1919

20-
//class oofem::FloatArray;
21-
//class IntArray;
20+
#define _IFT_Cylinder_line "line"
21+
#define _IFT_Cylinder_radius "radius"
22+
#define _IFT_Cylinder_refine "refine"
2223

2324
class Cylinder : public Region
2425
{
@@ -52,7 +53,7 @@ class Cylinder : public Region
5253
/// Returns class name of the receiver.
5354
const char *giveClassName() const { return "Cylinder"; }
5455

55-
IRResultType initializeFrom(InputRecord *ir);
56+
void initializeFrom(ConverterInputRecord &ir);
5657
//virtual IntArray* ResolveDofIDArray (char* initString);
5758
/// prints receiver state on stdout. Usefull for debuging.
5859
void printYourself();

src/converter/ellipsoid.C

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,21 @@ Ellipsoid :: ~Ellipsoid()
2323
}
2424

2525

26-
IRResultType
27-
Ellipsoid :: initializeFrom(InputRecord *ir)
26+
void
27+
Ellipsoid :: initializeFrom(ConverterInputRecord &ir)
2828
// Gets from the source line from the data file all the data of the receiver.
2929
{
3030

31-
const char *__proc = "initializeFrom"; // Required by IR_GIVE_FIELD macro
32-
IRResultType result; // Required by IR_GIVE_FIELD macro
33-
// int j, size;
34-
// FloatArray vertices;
35-
// IntArray *dofIDArry;
36-
IR_GIVE_FIELD(ir, centre, IFT_Ellipsoid_centre, "centre");
31+
IR_GIVE_FIELD(ir, centre, _IFT_Ellipsoid_centre);
3732

38-
39-
IR_GIVE_FIELD(ir, radii, IFT_Ellipsoid_radii, "radii"); // Macro
40-
IR_GIVE_FIELD(ir, angles, IFT_Ellipsoid_angles, "angles"); // Macro
33+
IR_GIVE_FIELD(ir, radii, _IFT_Ellipsoid_radii); // Macro
34+
IR_GIVE_FIELD(ir, angles, _IFT_Ellipsoid_angles); // Macro
4135
refinement = 1.;
4236

43-
IR_GIVE_OPTIONAL_FIELD(ir, refinement, IFT_Ellipsoid_refine, "refine"); // Macro
37+
IR_GIVE_OPTIONAL_FIELD(ir, refinement, _IFT_Ellipsoid_refine); // Macro
4438
itzThickness = 0.;
45-
IR_GIVE_OPTIONAL_FIELD(ir, itzThickness, IFT_Ellipsoid_itz, "itz"); // Macro
46-
47-
48-
39+
IR_GIVE_OPTIONAL_FIELD(ir, itzThickness, _IFT_Ellipsoid_itz); // Macro
40+
4941
// compute the matrix of the cartesian equation of the ellipsoid
5042

5143
oofem::FloatMatrix matrixAloc(4,4);
@@ -106,11 +98,6 @@ Ellipsoid :: initializeFrom(InputRecord *ir)
10698
oofem::FloatMatrix tempM2;
10799
tempM2.beProductOf(tempM1,tR);
108100
matrixA.beProductOf(tempM2,tT);
109-
110-
111-
112-
// for control
113-
//matrixA.printYourself();
114101

115102
if (itzThickness>0.)
116103

@@ -126,13 +113,10 @@ Ellipsoid :: initializeFrom(InputRecord *ir)
126113
oofem::FloatMatrix tempM2ItZ;
127114
tempM2ItZ.beProductOf(tempM1ItZ,tR);
128115
matrixA_wITZ.beProductOf(tempM2ItZ,tT);
129-
130-
// for control
131-
//matrixA_wITZ.printYourself();
132-
116+
133117
}
134118

135-
return IRRT_OK;
119+
return;
136120

137121
}
138122

src/converter/ellipsoid.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#ifndef ELLIPSOID_H_INCLUDED
22
#define ELLIPSOID_H_INCLUDED
33

4-
54
#include "grid.h"
65
#include "inclusion.h"
76

8-
#include "flotarry.h"
7+
#include "floatarray.h"
98
#include "intarray.h"
109
#include "floatmatrix.h"
1110

@@ -19,6 +18,14 @@
1918
#include <stdio.h>
2019
#endif
2120

21+
22+
#define _IFT_Ellipsoid_centre "centre"
23+
#define _IFT_Ellipsoid_radii "radii"
24+
#define _IFT_Ellipsoid_angles "angles"
25+
#define _IFT_Ellipsoid_refine "refine"
26+
#define _IFT_Ellipsoid_itz "itz"
27+
28+
2229

2330
class Ellipsoid : public Inclusion
2431
{
@@ -62,14 +69,11 @@ class Ellipsoid : public Inclusion
6269
/// Returns class name of the receiver.
6370
const char *giveClassName() const { return "Ellipsoid"; }
6471

65-
IRResultType initializeFrom(InputRecord *ir);
66-
//virtual IntArray* ResolveDofIDArray (char* initString);
67-
/// prints receiver state on stdout. Usefull for debuging.
68-
void printYourself();
69-
70-
// to know whether a point is inside the ellipsoid
71-
int isInside(double coord_x,double coord_y,double coord_z);
72-
// 1 means inside , 0 outisde , 2 in the ITZ (if specified)
72+
void initializeFrom(ConverterInputRecord &ir);
73+
74+
// to know whether a point is inside the ellipsoid
75+
// 1 means inside , 0 outisde , 2 in the ITZ (if specified)
76+
int isInside(double coord_x,double coord_y,double coord_z);
7377

7478
};
7579

0 commit comments

Comments
 (0)