CONFIG LIB 1.5
Configuration Files Library (by TGG 2020)
Loading...
Searching...
No Matches
MASS_FILE Class Reference

Public Member Functions

void Clean ()
 cleans local variables

 
int Read (const char *FileName)
 reads masses file
 
int Write (const char *Filename)
 writes masses file
 

Public Attributes

unsigned int n_Masses
 number of mass objects
 
unsigned int RefInertia
 type of origin for inertia moment computation: CG/CS/Arbitrary
 
double Ref_x
 arbitrary reference point x coordinate
 
double Ref_y
 arbitrary reference point y coordinate
 
double Ref_z
 arbitrary reference point z coordinate
 
std::vector< MASS_OBJECT_DATAmObjs
 vector of mass objects
 
double m_glob
 global mass value [kg]
 
double CGx_glob
 global CG position X [m]
 
double CGy_glob
 global CG position Y [m]
 
double CGz_glob
 global CG position Z [m]
 
double Ixx_glob
 global inertia moment wrt CG [kg m^2]
 
double Iyy_glob
 global inertia moment wrt CG [kg m^2]
 
double Izz_glob
 global inertia moment wrt CG [kg m^2]
 
double Ixy_glob
 global inertia moment wrt CG [kg m^2]
 
double Iyz_glob
 global inertia moment wrt CG [kg m^2]
 
double Izx_glob
 global inertia moment wrt CG [kg m^2]
 

Detailed Description

Definition at line 31 of file mass_file.h.

Constructor & Destructor Documentation

◆ MASS_FILE()

MASS_FILE::MASS_FILE ( void )

Definition at line 24 of file mass_file.cpp.

24{ Clean (); }
void Clean()
cleans local variables
Definition mass_file.cpp:28

◆ ~MASS_FILE()

MASS_FILE::~MASS_FILE ( void )

Definition at line 26 of file mass_file.cpp.

26{}

Member Function Documentation

◆ Clean()

void MASS_FILE::Clean ( void )

cleans local variables

Definition at line 28 of file mass_file.cpp.

29{
30 n_Masses = 0;
31
32 mObjs.resize(0);
33
34 m_glob = 0;
35 CGx_glob = 0;
36 CGy_glob = 0;
37 CGz_glob = 0;
38 Ixx_glob = 0;
39 Iyy_glob = 0;
40 Izz_glob = 0;
41 Ixy_glob = 0;
42 Iyz_glob = 0;
43 Izx_glob = 0;
44}
double Iyy_glob
global inertia moment wrt CG [kg m^2]
Definition mass_file.h:48
double Ixx_glob
global inertia moment wrt CG [kg m^2]
Definition mass_file.h:47
std::vector< MASS_OBJECT_DATA > mObjs
vector of mass objects
Definition mass_file.h:41
unsigned int n_Masses
number of mass objects
Definition mass_file.h:35
double Izx_glob
global inertia moment wrt CG [kg m^2]
Definition mass_file.h:52
double CGx_glob
global CG position X [m]
Definition mass_file.h:44
double Izz_glob
global inertia moment wrt CG [kg m^2]
Definition mass_file.h:49
double Iyz_glob
global inertia moment wrt CG [kg m^2]
Definition mass_file.h:51
double CGy_glob
global CG position Y [m]
Definition mass_file.h:45
double CGz_glob
global CG position Z [m]
Definition mass_file.h:46
double Ixy_glob
global inertia moment wrt CG [kg m^2]
Definition mass_file.h:50
double m_glob
global mass value [kg]
Definition mass_file.h:43

◆ Read()

int MASS_FILE::Read ( const char * FileName)

reads masses file

Definition at line 46 of file mass_file.cpp.

47{
48 std::string sVal;
49
51
52 ifstream in(FileName);
53
54 if(!in)
55 return 1;
56
57 in >> sVal >> n_Masses;
58 in >> sVal >> RefInertia >> Ref_x >> Ref_y >> Ref_z;
59
60 for(int j=0; j<33; j++) //Read & remove header
61 in >> sVal;
62
63 for(unsigned int i=0; i<n_Masses; i++) //Read data rows
64 {
65 mObj.Read(in);
66 mObjs.push_back(mObj);
67 }
68
69 in.close();
70
71 return (0);
72}
unsigned int RefInertia
type of origin for inertia moment computation: CG/CS/Arbitrary
Definition mass_file.h:36
double Ref_y
arbitrary reference point y coordinate
Definition mass_file.h:38
double Ref_z
arbitrary reference point z coordinate
Definition mass_file.h:39
double Ref_x
arbitrary reference point x coordinate
Definition mass_file.h:37
MASS_OBJECT_DATA class and functions.
Definition mass_data.h:54
void Read(std::ifstream &in)
reads single mass object

◆ Write()

int MASS_FILE::Write ( const char * Filename)

writes masses file

Definition at line 74 of file mass_file.cpp.

75{
77
78 ofstream out(FileName);
79
80 if(!out)
81 return 1;
82
83 out << fixed << setprecision(6);
84 out << setw(12) << std::left << "DataRows: " << n_Masses << endl;
85 out << setw(12) << std::left << "RefInertia: " << setw(12) << RefInertia;
86 out << setw(12) << std::left << Ref_x;
87 out << setw(12) << std::left << Ref_y;
88 out << setw(12) << std::left << Ref_z;
89 out << endl << endl;
90
91 WriteHeader(out);
92
93 for(unsigned int i=0; i<n_Masses; i++)
94 mObjs[i].Write(out, i);
95
96 out << setw(44) << std::right << "Global: ";
97
98 out << setw(36) << std::left << m_glob;
99 out << setw(12) << std::left << CGx_glob;
100 out << setw(12) << std::left << CGy_glob;
101 out << setw(12) << std::left << CGz_glob;
102 out << setw(12) << std::left << Ixx_glob;
103 out << setw(12) << std::left << Iyy_glob;
104 out << setw(12) << std::left << Izz_glob;
105 out << setw(12) << std::left << Ixy_glob;
106 out << setw(12) << std::left << Iyz_glob;
107 out << setw(12) << std::left << Izx_glob;
108
109 out.close();
110
111 return (0);
112}
int Write(const char *Filename)
writes masses file
Definition mass_file.cpp:74

Referenced by Write().

Member Data Documentation

◆ CGx_glob

double MASS_FILE::CGx_glob

global CG position X [m]

Definition at line 44 of file mass_file.h.

Referenced by Clean(), and Write().

◆ CGy_glob

double MASS_FILE::CGy_glob

global CG position Y [m]

Definition at line 45 of file mass_file.h.

Referenced by Clean(), and Write().

◆ CGz_glob

double MASS_FILE::CGz_glob

global CG position Z [m]

Definition at line 46 of file mass_file.h.

Referenced by Clean(), and Write().

◆ Ixx_glob

double MASS_FILE::Ixx_glob

global inertia moment wrt CG [kg m^2]

Definition at line 47 of file mass_file.h.

Referenced by Clean(), and Write().

◆ Ixy_glob

double MASS_FILE::Ixy_glob

global inertia moment wrt CG [kg m^2]

Definition at line 50 of file mass_file.h.

Referenced by Clean(), and Write().

◆ Iyy_glob

double MASS_FILE::Iyy_glob

global inertia moment wrt CG [kg m^2]

Definition at line 48 of file mass_file.h.

Referenced by Clean(), and Write().

◆ Iyz_glob

double MASS_FILE::Iyz_glob

global inertia moment wrt CG [kg m^2]

Definition at line 51 of file mass_file.h.

Referenced by Clean(), and Write().

◆ Izx_glob

double MASS_FILE::Izx_glob

global inertia moment wrt CG [kg m^2]

Definition at line 52 of file mass_file.h.

Referenced by Clean(), and Write().

◆ Izz_glob

double MASS_FILE::Izz_glob

global inertia moment wrt CG [kg m^2]

Definition at line 49 of file mass_file.h.

Referenced by Clean(), and Write().

◆ m_glob

double MASS_FILE::m_glob

global mass value [kg]

Definition at line 43 of file mass_file.h.

Referenced by Clean(), and Write().

◆ mObjs

std::vector<MASS_OBJECT_DATA> MASS_FILE::mObjs

vector of mass objects

Definition at line 41 of file mass_file.h.

Referenced by Clean(), Read(), and Write().

◆ n_Masses

unsigned int MASS_FILE::n_Masses

number of mass objects

Definition at line 35 of file mass_file.h.

Referenced by Clean(), Read(), and Write().

◆ Ref_x

double MASS_FILE::Ref_x

arbitrary reference point x coordinate

Definition at line 37 of file mass_file.h.

Referenced by Read(), and Write().

◆ Ref_y

double MASS_FILE::Ref_y

arbitrary reference point y coordinate

Definition at line 38 of file mass_file.h.

Referenced by Read(), and Write().

◆ Ref_z

double MASS_FILE::Ref_z

arbitrary reference point z coordinate

Definition at line 39 of file mass_file.h.

Referenced by Read(), and Write().

◆ RefInertia

unsigned int MASS_FILE::RefInertia

type of origin for inertia moment computation: CG/CS/Arbitrary

Definition at line 36 of file mass_file.h.

Referenced by Read(), and Write().


The documentation for this class was generated from the following files: