COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
piecestruc Struct Reference

Part structure: physical information for each piece of Node. More...

#include <jsondef.h>

Collaboration diagram for piecestruc:

Public Member Functions

json11::Json to_json () const
 Convert class contents to JSON object. More...
 
void from_json (const string &s)
 Set class contents from JSON string. More...
 

Public Attributes

char name [40+1] = ""
 Name of piece. More...
 
bool enabled = true
 Enabled? More...
 
uint16_t cidx = 0
 Component index: -1 if not a Component. More...
 
float density = 0.f
 Density in kg/cu m. More...
 
float mass = 0.f
 Mass in kg. More...
 
float emi = 0.f
 Emissivity: 0-1. More...
 
float abs = 0.f
 Absorptivity: 0-1. More...
 
float hcap = 0.f
 Heat capacity in joules per kelvin. More...
 
float hcon = 0.f
 Heat conductivity in Watts per meter per kelvin. More...
 
float dim = 0.f
 Dimension in meters: effect is dependent on Part type. More...
 
float area = 0.f
 Area in square meters. More...
 
float volume = 0.f
 Volume in cubic meters. More...
 
uint16_t face_cnt = 0
 Number of faces. More...
 
vector< uint16_t > face_idx
 Array of vertices/vertexs. More...
 
Vector com
 Centroid of piece. More...
 
Vector shove
 Contribution of piece to linear forces. More...
 
Vector twist
 Contribution of piece to angular forces. More...
 
float heat = 0.f
 Stored thermal energy. More...
 
float temp = 0.f
 Temperature in Kelvins. More...
 
float insol = 0.f
 Insolation in Watts/sq m. More...
 
float material_density = 0.f
 Material density (1. - transparency) More...
 
Vector material_ambient
 Material ambient reflective qualities. More...
 
Vector material_diffuse
 Material diffuse reflective qualities. More...
 
Vector material_specular
 Material specular reflective qualities. More...
 

Detailed Description

Part structure: physical information for each piece of Node.

Member Function Documentation

json11::Json piecestruc::to_json ( ) const
inline

Convert class contents to JSON object.

Returns a json11 JSON object of the class

Returns
A json11 JSON object containing every member variable within the class
1501  {
1502  return json11::Json::object {
1503  { "name" , name },
1504  { "enabled" , enabled },
1505  { "cidx" , cidx },
1506  { "density" , density },
1507  { "mass" , mass },
1508  { "emi" , emi },
1509  { "abs" , abs },
1510  { "hcap" , hcap },
1511  { "hcon" , hcon },
1512  { "dim" , dim },
1513  { "area" , area },
1514  { "volume" , volume },
1515  { "face_cnt", face_cnt },
1516  { "face_idx", face_idx },
1517  { "com" , com },
1518  { "shove" , shove },
1519  { "twist" , twist },
1520  { "heat" , heat },
1521  { "temp" , temp },
1522  { "insol" , insol },
1523  { "material_density" , material_density },
1524  { "material_ambient" , material_ambient },
1525  { "material_diffuse" , material_diffuse },
1526  { "material_specular", material_specular }
1527  };
1528  }
float hcap
Heat capacity in joules per kelvin.
Definition: jsondef.h:1463
std::map< std::string, Json > object
Definition: json11.hpp:88
float material_density
Material density (1. - transparency)
Definition: jsondef.h:1489
float insol
Insolation in Watts/sq m.
Definition: jsondef.h:1487
float dim
Dimension in meters: effect is dependent on Part type.
Definition: jsondef.h:1467
Vector material_diffuse
Material diffuse reflective qualities.
Definition: jsondef.h:1493
float temp
Temperature in Kelvins.
Definition: jsondef.h:1485
Vector material_specular
Material specular reflective qualities.
Definition: jsondef.h:1495
float heat
Stored thermal energy.
Definition: jsondef.h:1483
uint16_t face_cnt
Number of faces.
Definition: jsondef.h:1473
float volume
Volume in cubic meters.
Definition: jsondef.h:1471
float abs
Absorptivity: 0-1.
Definition: jsondef.h:1461
Vector com
Centroid of piece.
Definition: jsondef.h:1477
float area
Area in square meters.
Definition: jsondef.h:1469
char name[40+1]
Name of piece.
Definition: jsondef.h:1449
Vector shove
Contribution of piece to linear forces.
Definition: jsondef.h:1479
bool enabled
Enabled?
Definition: jsondef.h:1451
float emi
Emissivity: 0-1.
Definition: jsondef.h:1459
float mass
Mass in kg.
Definition: jsondef.h:1457
vector< uint16_t > face_idx
Array of vertices/vertexs.
Definition: jsondef.h:1475
float hcon
Heat conductivity in Watts per meter per kelvin.
Definition: jsondef.h:1465
uint16_t cidx
Component index: -1 if not a Component.
Definition: jsondef.h:1453
float density
Density in kg/cu m.
Definition: jsondef.h:1455
Vector twist
Contribution of piece to angular forces.
Definition: jsondef.h:1481
Vector material_ambient
Material ambient reflective qualities.
Definition: jsondef.h:1491
void piecestruc::from_json ( const string &  s)
inline

Set class contents from JSON string.

Parses the provided JSON-formatted string and sets the class data. String should be formatted like the string returned from to_json()

Parameters
sJSON-formatted string to set class contents to
Returns
n/a
1536  {
1537  string error;
1538  json11::Json p = json11::Json::parse(s,error);
1539  if(error.empty()) {
1540  if(!p["name"].is_null()) { strcpy(name, p["name"].string_value().c_str()); }
1541  if(!p["enabled"].is_null()) { enabled = p["enabled"].bool_value(); }
1542  if(!p["cidx"].is_null()) { cidx = p["cidx"].int_value(); }
1543  if(!p["density"].is_null()) { density = p["density"].number_value(); }
1544  if(!p["mass"].is_null()) { mass = p["mass"].number_value(); }
1545  if(!p["emi"].is_null()) { emi = p["emi"].number_value(); }
1546  if(!p["abs"].is_null()) { abs = p["abs"].number_value(); }
1547  if(!p["hcap"].is_null()) { hcap = p["hcap"].number_value(); }
1548  if(!p["hcon"].is_null()) { hcon = p["hcon"].number_value(); }
1549  if(!p["dim"].is_null()) { dim = p["dim"].number_value(); }
1550  if(!p["area"].is_null()) { area = p["area"].number_value(); }
1551  if(!p["volume"].is_null()) { volume = p["volume"].number_value(); }
1552  if(!p["face_cnt"].is_null()) { face_cnt = p["face_cnt"].int_value(); }
1553  if(!p["face_idx"].is_null()) {
1554  auto p_face_idx = p["face_idx"].array_items();
1555  for(size_t i = 0; i != p_face_idx.size(); ++i) {
1556  if(!p_face_idx[i].is_null()) { face_idx[i] = p_face_idx[i].int_value(); }
1557  }
1558  }
1559  if(!p["com"].is_null()) { com.from_json(p["com"].dump()); }
1560  if(!p["shove"].is_null()) { shove.from_json(p["shove"].dump()); }
1561  if(!p["twist"].is_null()) { twist.from_json(p["twist"].dump()); }
1562  if(!p["heat"].is_null()) { heat = p["heat"].number_value(); }
1563  if(!p["temp"].is_null()) { temp = p["temp"].number_value(); }
1564  if(!p["insol"].is_null()) { insol = p["insol"].number_value(); }
1565  if(!p["material_density"].is_null()) { material_density = p["material_density"].number_value(); }
1566  if(!p["material_ambient"].is_null()) { material_ambient.from_json(p["material_ambient"].dump()); }
1567  if(!p["material_diffuse"].is_null()) { material_diffuse.from_json(p["material_diffuse"].dump()); }
1568  if(!p["material_specular"].is_null()) { material_specular.from_json(p["material_specular"].dump()); }
1569  }
1570  return;
1571  }
float hcap
Heat capacity in joules per kelvin.
Definition: jsondef.h:1463
Definition: json11.hpp:79
float material_density
Material density (1. - transparency)
Definition: jsondef.h:1489
int i
Definition: rw_test.cpp:37
float insol
Insolation in Watts/sq m.
Definition: jsondef.h:1487
float dim
Dimension in meters: effect is dependent on Part type.
Definition: jsondef.h:1467
Vector material_diffuse
Material diffuse reflective qualities.
Definition: jsondef.h:1493
float temp
Temperature in Kelvins.
Definition: jsondef.h:1485
static double * p
Definition: gauss_jackson_test.cpp:42
Vector material_specular
Material specular reflective qualities.
Definition: jsondef.h:1495
void from_json(const string &s)
Set class contents from JSON string.
Definition: vector.h:783
float heat
Stored thermal energy.
Definition: jsondef.h:1483
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
static void dump(NullStruct, string &out)
Definition: json11.cpp:53
uint16_t face_cnt
Number of faces.
Definition: jsondef.h:1473
bool bool_value() const
Definition: json11.cpp:282
const array & array_items() const
Definition: json11.cpp:284
float volume
Volume in cubic meters.
Definition: jsondef.h:1471
float abs
Absorptivity: 0-1.
Definition: jsondef.h:1461
Vector com
Centroid of piece.
Definition: jsondef.h:1477
float area
Area in square meters.
Definition: jsondef.h:1469
char name[40+1]
Name of piece.
Definition: jsondef.h:1449
Vector shove
Contribution of piece to linear forces.
Definition: jsondef.h:1479
bool enabled
Enabled?
Definition: jsondef.h:1451
float emi
Emissivity: 0-1.
Definition: jsondef.h:1459
float mass
Mass in kg.
Definition: jsondef.h:1457
vector< uint16_t > face_idx
Array of vertices/vertexs.
Definition: jsondef.h:1475
float hcon
Heat conductivity in Watts per meter per kelvin.
Definition: jsondef.h:1465
uint16_t cidx
Component index: -1 if not a Component.
Definition: jsondef.h:1453
float density
Density in kg/cu m.
Definition: jsondef.h:1455
Vector twist
Contribution of piece to angular forces.
Definition: jsondef.h:1481
int int_value() const
Definition: json11.cpp:281
Vector material_ambient
Material ambient reflective qualities.
Definition: jsondef.h:1491
double number_value() const
Definition: json11.cpp:280

Member Data Documentation

char piecestruc::name[40+1] = ""

Name of piece.

bool piecestruc::enabled = true

Enabled?

uint16_t piecestruc::cidx = 0

Component index: -1 if not a Component.

float piecestruc::density = 0.f

Density in kg/cu m.

float piecestruc::mass = 0.f

Mass in kg.

float piecestruc::emi = 0.f

Emissivity: 0-1.

float piecestruc::abs = 0.f

Absorptivity: 0-1.

float piecestruc::hcap = 0.f

Heat capacity in joules per kelvin.

float piecestruc::hcon = 0.f

Heat conductivity in Watts per meter per kelvin.

float piecestruc::dim = 0.f

Dimension in meters: effect is dependent on Part type.

float piecestruc::area = 0.f

Area in square meters.

float piecestruc::volume = 0.f

Volume in cubic meters.

uint16_t piecestruc::face_cnt = 0

Number of faces.

vector<uint16_t> piecestruc::face_idx

Array of vertices/vertexs.

Vector piecestruc::com

Centroid of piece.

Vector piecestruc::shove

Contribution of piece to linear forces.

Vector piecestruc::twist

Contribution of piece to angular forces.

float piecestruc::heat = 0.f

Stored thermal energy.

float piecestruc::temp = 0.f

Temperature in Kelvins.

float piecestruc::insol = 0.f

Insolation in Watts/sq m.

float piecestruc::material_density = 0.f

Material density (1. - transparency)

Vector piecestruc::material_ambient

Material ambient reflective qualities.

Vector piecestruc::material_diffuse

Material diffuse reflective qualities.

Vector piecestruc::material_specular

Material specular reflective qualities.


The documentation for this struct was generated from the following file: