Bsoft  2.1.0
Bernard's software package
rwmodel_star.cpp
Go to the documentation of this file.
1 
9 #include "rwmodel.h"
10 #include "rwstar.h"
11 #include "model_links.h"
12 #include "model_util.h"
13 #include "model_tags.h"
14 #include "file_util.h"
15 #include "linked_list.h"
16 #include "utilities.h"
17 
18 // Declaration of global variables
19 extern int verbose; // Level of output to the screen
20 
27 {
28  int err = 0;
29  Bstar* star = init_star();
30  star->line_length = 200; // Set the output line length
31 
32  err = read_star(file_list, star);
33 
34  if ( err != 0 ) {
35  kill_star(star);
36  return NULL;
37  }
38 
40 
41  Bmodel* model = NULL;
42  Bmodel* mp = NULL;
43  Bcomptype* comptype = NULL;
44  Bcomponent* comp = NULL;
45  Blink* link = NULL;
46 
47  Bstar_block* block;
48  Bstar_item* item;
49  Bstring* data;
50  Bstring id, path;
51  long i, j;
52 
53  for ( i=1, block = star->block; block; block = block->next, i++ ) {
54  path = block->filename.pre_rev('/');
55  id = 0;
56  if ( ( item = item_find(block, MODEL_ID) ) ) id = *(item->data);
57  if ( id.length() < 1 ) id = Bstring(i, "%d");
58  mp = model_add(&mp, id);
59  if ( !model ) model = mp;
60  if ( ( item = item_find(block, MODEL_TYPE) ) ) mp->type_id = *(item->data);
61  if ( ( item = item_find(block, MODEL_SYM) ) ) mp->symmetry = *(item->data);
62  if ( ( item = item_find(block, MODEL_MAP_FILENAME) ) ) mp->fmap = find_file(*(item->data), path);
63  mp->hand = item_get_integer(block, MODEL_HAND);
65  mp->fom = item_get_float(block, MODEL_FOM);
66  mp->sel = item_get_integer(block, MODEL_SELECT);
67  comptype = NULL;
68  if ( item_get_number_for_block(block, COMPTYPE_ID) ) {
69  item = item_find(block, COMPTYPE_ID);
70  if ( item )
71  for ( data=item->data; data; data=data->next, i++ ) {
72  comptype = model_add_type_by_id(mp, *data);
73  if ( !mp->type ) mp->type = comptype;
74  }
75  item = item_find(block, COMPTYPE_FILENAME);
76  if ( item )
77  for ( data=item->data, comptype=mp->type; data && comptype; data=data->next, comptype=comptype->next )
78  comptype->fmod = find_file(*data, path);
79  item = item_find(block, COMPTYPE_NUMBER);
80  if ( item )
81  for ( data=item->data, comptype=mp->type; data && comptype; data=data->next, comptype=comptype->next )
82  comptype->num = data->integer();
83  item = item_find(block, COMPTYPE_MASS);
84  if ( item )
85  for ( data=item->data, comptype=mp->type; data && comptype; data=data->next, comptype=comptype->next )
86  comptype->mass = data->real();
87  item = item_find(block, COMPTYPE_FOM);
88  if ( item )
89  for ( data=item->data, comptype=mp->type; data && comptype; data=data->next, comptype=comptype->next )
90  comptype->fom = data->real();
91  item = item_find(block, COMPTYPE_SELECT);
92  if ( item )
93  for ( data=item->data, comptype=mp->type; data && comptype; data=data->next, comptype=comptype->next )
94  comptype->sel = data->integer();
95  }
96  comp = NULL;
98  item = item_find(block, COMPONENT_ID);
99  if ( item )
100  for ( data=item->data; data; data=data->next ) {
101  comp = component_add(&comp, *data);
102  if ( !mp->comp ) mp->comp = comp;
103  }
104  if ( !mp->comp && ( item = item_find(block, COMPONENT_X) ) ) {
105  for ( j=0, data=item->data; data; data=data->next ) {
106  id = Bstring(++j, "%d");
107  comp = component_add(&comp, id);
108  if ( !mp->comp ) mp->comp = comp;
109  }
110  }
111  item = item_find(block, COMPONENT_TYPE_ID);
112  if ( item )
113  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
114  comp->type = model_add_type_by_id(mp, *data);
115  item = item_find(block, COMPONENT_X);
116  if ( item )
117  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
118  comp->loc[0] = data->real();
119  item = item_find(block, COMPONENT_Y);
120  if ( item )
121  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
122  comp->loc[1] = data->real();
123  item = item_find(block, COMPONENT_Z);
124  if ( item )
125  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
126  comp->loc[2] = data->real();
127  item = item_find(block, COMPONENT_VIEW_X);
128  if ( item )
129  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
130  comp->view[0] = data->real();
131  item = item_find(block, COMPONENT_VIEW_Y);
132  if ( item )
133  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
134  comp->view[1] = data->real();
135  item = item_find(block, COMPONENT_VIEW_Z);
136  if ( item )
137  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
138  comp->view[2] = data->real();
139  item = item_find(block, COMPONENT_VIEW_ANGLE);
140  if ( item )
141  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
142  comp->view[3] = data->real()*M_PI/180.0;
143  item = item_find(block, COMPONENT_RADIUS);
144  if ( item )
145  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
146  comp->radius = data->real();
147  item = item_find(block, COMPONENT_RED);
148  if ( item )
149  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
150  comp->color[0] = data->real();
151  item = item_find(block, COMPONENT_GREEN);
152  if ( item )
153  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
154  comp->color[1] = data->real();
155  item = item_find(block, COMPONENT_BLUE);
156  if ( item )
157  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
158  comp->color[2] = data->real();
159  item = item_find(block, COMPONENT_ALPHA);
160  if ( item )
161  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
162  comp->color[3] = data->real();
163  item = item_find(block, COMPONENT_DENSITY);
164  if ( item )
165  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
166  comp->density = data->real();
167  item = item_find(block, COMPONENT_FOM);
168  if ( item )
169  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
170  comp->fom = data->real();
171  item = item_find(block, COMPONENT_SELECT);
172  if ( item )
173  for ( data=item->data, comp=mp->comp; data && comp; data=data->next, comp=comp->next )
174  comp->sel = data->integer();
175  }
176  link = NULL;
177  if ( item_get_number_for_block(block, COMPLINK_1) ) {
178  item = item_find(block, COMPLINK_1);
179  if ( item )
180  for ( data=item->data; data; data=data->next ) {
181  link = (Blink *) add_item((char **) &link, sizeof(Blink));
182  if ( !mp->link ) mp->link = link;
183  link->sel = 1;
184  for ( comp=mp->comp; comp && !link->comp[0]; comp=comp->next )
185  if ( comp->id == *data ) link->comp[0] = comp;
186  if ( !link->comp[0] ) cerr << "Error: Component " << *data << " not found! (1)" << endl;
187  }
188  item = item_find(block, COMPLINK_2);
189  if ( item )
190  for ( data=item->data, link=mp->link; data && link; data=data->next, link=link->next ) {
191  for ( comp=mp->comp; comp && !link->comp[1]; comp=comp->next )
192  if ( comp->id == *data ) link->comp[1] = comp;
193  if ( !link->comp[1] ) cerr << "Error: Component " << *data << " not found! (2)" << endl;
194  }
195  item = item_find(block, COMPLINK_ANGLE);
196  if ( item )
197  for ( data=item->data, link=mp->link; data && link; data=data->next, link=link->next )
198  link->angle = data->real() * M_PI/180.0;
199  item = item_find(block, COMPLINK_RADIUS);
200  if ( item )
201  for ( data=item->data, link=mp->link; data && link; data=data->next, link=link->next )
202  link->radius = data->real();
203  item = item_find(block, COMPLINK_RED);
204  if ( item )
205  for ( data=item->data, link=mp->link; data && link; data=data->next, link=link->next )
206  link->color[0] = data->real();
207  item = item_find(block, COMPLINK_GREEN);
208  if ( item )
209  for ( data=item->data, link=mp->link; data && link; data=data->next, link=link->next )
210  link->color[1] = data->real();
211  item = item_find(block, COMPLINK_BLUE);
212  if ( item )
213  for ( data=item->data, link=mp->link; data && link; data=data->next, link=link->next )
214  link->color[2] = data->real();
215  item = item_find(block, COMPLINK_ALPHA);
216  if ( item )
217  for ( data=item->data, link=mp->link; data && link; data=data->next, link=link->next )
218  link->color[3] = data->real();
219  item = item_find(block, COMPLINK_FOM);
220  if ( item )
221  for ( data=item->data, link=mp->link; data && link; data=data->next, link=link->next )
222  link->fom = data->real();
223  item = item_find(block, COMPLINK_SELECT);
224  if ( item )
225  for ( data=item->data, link=mp->link; data && link; data=data->next, link=link->next )
226  link->sel = data->integer();
227  for ( link=mp->link; link; link=link->next )
228  link->length = link->comp[0]->loc.distance(link->comp[1]->loc);
229  }
230  }
231 
232  model->comment = star->comment;
233 
234  kill_star(star);
235 
236 // model_list_setup_links(model);
238 
239  return model;
240 }
241 
249 {
250  long len;
251  Bstring id;
252  Bstar* star = init_star();
253  Bstar_block* block;
254  Bstar_item* item = NULL;
255  Bstring* data = NULL;
256 
257  Bmodel* mp = NULL;
258  Bcomptype* comptype = NULL;
259  Bcomponent* comp = NULL;
260  Blink* link = NULL;
261 
262  star->comment = model->comment;
263  star->line_length = 200;
264  star->split = model->split;
265 
267 
268  int n, loop, err = 0;
269  for ( n=0, mp = model; mp; mp = mp->next, n++ ) {
270  block = (Bstar_block *) add_item((char **)&star->block, sizeof(Bstar_block));
271  if ( mp->id.length() < 1 ) mp->id = Bstring(n+1, "%d");
272  item_put_string(block, MODEL_ID, mp->id);
273  block->tag = mp->id;
274  if ( mp->type_id.length() ) item_put_string(block, MODEL_TYPE, mp->type_id);
275  if ( mp->symmetry.length() ) item_put_string(block, MODEL_SYM, mp->symmetry);
276  item_put_integer(block, MODEL_HAND, mp->hand, "%d");
277  if ( mp->fmap.length() ) item_put_string(block, MODEL_MAP_FILENAME, mp->fmap);
278  item_put_integer(block, MODEL_MAP_NUMBER, mp->img_num, "%d");
279  item_put_float(block, MODEL_FOM, mp->fom, "%f");
280  item_put_integer(block, MODEL_SELECT, mp->sel, "%d");
281  if ( mp->type ) {
282  item = item_find_or_make(block, COMPTYPE_ID); // Component type section
283  data = NULL;
284  for ( comptype = mp->type; comptype; comptype = comptype->next ) {
285  if ( comptype->id.length() < 1 ) comptype->id = "?";
286  data = string_add(&data, comptype->id);
287  if ( !item->data ) item->data = data;
288  len = data->length();
289  if ( item->maxlen < len ) item->maxlen = len;
290  }
291  item = item_find_or_make(block, COMPTYPE_FILENAME);
292  data = NULL;
293  for ( comptype = mp->type; comptype; comptype = comptype->next ) {
294  if ( comptype->fmod.length() < 1 ) comptype->fmod = "?";
295  data = string_add(&data, comptype->fmod);
296  if ( !item->data ) item->data = data;
297  len = data->length();
298  if ( item->maxlen < len ) item->maxlen = len;
299  }
300  item_put_list(block, COMPTYPE_NUMBER, (char *) mp->type,
301  (char *)&mp->type->num - (char *)mp->type, "%4d");
302  item_put_list(block, COMPTYPE_MASS, (char *) mp->type,
303  (char *)&mp->type->mass - (char *)mp->type, "%12.2f");
304  item_put_list(block, COMPTYPE_FOM, (char *) mp->type,
305  (char *)&mp->type->fom - (char *)mp->type, "%7.4f");
306  item_put_list(block, COMPTYPE_SELECT, (char *) mp->type,
307  (char *)&mp->type->sel - (char *)mp->type, "%4d");
308  }
309  if ( mp->comp ) {
310  item = item_find_or_make(block, COMPONENT_ID); // Component section
311  data = NULL;
312  for ( comp = mp->comp; comp; comp = comp->next ) {
313  if ( comp->id.length() < 1 ) comp->id = "?";
314  data = string_add(&data, comp->id);
315  if ( !item->data ) item->data = data;
316  len = data->length();
317  if ( item->maxlen < len ) item->maxlen = len;
318  }
319  item = item_find_or_make(block, COMPONENT_TYPE_ID);
320  data = NULL;
321  for ( comp = mp->comp; comp; comp = comp->next ) {
322  if ( comp->type ) id = comp->type->id;
323  else id = "?";
324  data = string_add(&data, id);
325  if ( !item->data ) item->data = data;
326  len = data->length();
327  if ( item->maxlen < len ) item->maxlen = len;
328  }
329  item_put_list(block, COMPONENT_X, (char *) mp->comp,
330  (char *)&mp->comp->loc[0] - (char *)mp->comp, "%8.3f");
331  item_put_list(block, COMPONENT_Y, (char *) mp->comp,
332  (char *)&mp->comp->loc[1] - (char *)mp->comp, "%8.3f");
333  item_put_list(block, COMPONENT_Z, (char *) mp->comp,
334  (char *)&mp->comp->loc[2] - (char *)mp->comp, "%8.3f");
335  item_put_list(block, COMPONENT_VIEW_X, (char *) mp->comp,
336  (char *)&mp->comp->view[0] - (char *)mp->comp, "%7.4lf");
337  item_put_list(block, COMPONENT_VIEW_Y, (char *) mp->comp,
338  (char *)&mp->comp->view[1] - (char *)mp->comp, "%7.4lf");
339  item_put_list(block, COMPONENT_VIEW_Z, (char *) mp->comp,
340  (char *)&mp->comp->view[2] - (char *)mp->comp, "%7.4lf");
341  item_put_angle_list(block, COMPONENT_VIEW_ANGLE, (char *) mp->comp,
342  (char *)&mp->comp->view[3] - (char *)mp->comp, "%7.2lf");
343  item_put_list(block, COMPONENT_RADIUS, (char *) mp->comp,
344  (char *)&mp->comp->radius - (char *)mp->comp, "%8.3f");
345  item_put_list(block, COMPONENT_RED, (char *) mp->comp,
346  (char *)&mp->comp->color[0] - (char *)mp->comp, "%5.3f");
347  item_put_list(block, COMPONENT_GREEN, (char *) mp->comp,
348  (char *)&mp->comp->color[1] - (char *)mp->comp, "%5.3f");
349  item_put_list(block, COMPONENT_BLUE, (char *) mp->comp,
350  (char *)&mp->comp->color[2] - (char *)mp->comp, "%5.3f");
351  item_put_list(block, COMPONENT_ALPHA, (char *) mp->comp,
352  (char *)&mp->comp->color[3] - (char *)mp->comp, "%5.3f");
353  item_put_list(block, COMPONENT_DENSITY, (char *) mp->comp,
354  (char *)&mp->comp->density - (char *)mp->comp, "%8.3f");
355  item_put_list(block, COMPONENT_FOM, (char *) mp->comp,
356  (char *)&mp->comp->fom - (char *)mp->comp, "%8.5f");
357  item_put_list(block, COMPONENT_SELECT, (char *) mp->comp,
358  (char *)&mp->comp->sel - (char *)mp->comp, "%4d");
359  }
360  if ( mp->link ) {
361  item = item_find_or_make(block, COMPLINK_1);
362  data = NULL;
363  for ( link = mp->link; link; link = link->next ) { // Link section
364  data = string_add(&data, link->comp[0]->id);
365  if ( !item->data ) item->data = data;
366  len = data->length();
367  if ( item->maxlen < len ) item->maxlen = len;
368  }
369  item = item_find_or_make(block, COMPLINK_2);
370  data = NULL;
371  for ( link = mp->link; link; link = link->next ) {
372  data = string_add(&data, link->comp[1]->id);
373  if ( !item->data ) item->data = data;
374  len = data->length();
375  if ( item->maxlen < len ) item->maxlen = len;
376  }
377  item_put_angle_list(block, COMPLINK_ANGLE, (char *) mp->link,
378  (char *)&mp->link->angle - (char *)mp->link, "%7.2f");
379  item_put_list(block, COMPLINK_RADIUS, (char *) mp->link,
380  (char *)&mp->link->radius - (char *)mp->link, "%8.3f");
381  item_put_list(block, COMPLINK_RED, (char *) mp->link,
382  (char *)&mp->link->color[0] - (char *)mp->link, "%5.3f");
383  item_put_list(block, COMPLINK_GREEN, (char *) mp->link,
384  (char *)&mp->link->color[1] - (char *)mp->link, "%5.3f");
385  item_put_list(block, COMPLINK_BLUE, (char *) mp->link,
386  (char *)&mp->link->color[2] - (char *)mp->link, "%5.3f");
387  item_put_list(block, COMPLINK_ALPHA, (char *) mp->link,
388  (char *)&mp->link->color[3] - (char *)mp->link, "%5.3f");
389  item_put_list(block, COMPLINK_FOM, (char *) mp->link,
390  (char *)&mp->link->fom - (char *)mp->link, "%8.5f");
391  item_put_list(block, COMPLINK_SELECT, (char *) mp->link,
392  (char *)&mp->link->sel - (char *)mp->link, "%4d");
393  }
394  loop = item_index(block, COMPONENT_ID);
395  loop_set_identifier(block, loop, 1, "component");
396  loop = item_index(block, COMPTYPE_ID);
397  loop_set_identifier(block, loop, 1, "component_type");
398  loop = item_index(block, COMPLINK_1);
399  loop_set_identifier(block, loop, 1, "component_link");
400  }
401 
402  if ( verbose & VERB_DEBUG )
403  cout << "DEBUG write_model_star: " << filename << endl;
404 
405  err = write_star(filename.c_str(), star);
406 
407  kill_star(star);
408 
409  if ( err < 0 ) return err;
410 
411  return n;
412 }
413 
Bstar_item::data
Bstring * data
Definition: rwstar.h:43
Bstar_item
Definition: rwstar.h:36
MODEL_SELECT
#define MODEL_SELECT
Definition: model_tags.h:25
Bmodel::fom
float fom
Definition: rwmodel.h:128
Bcomponent::next
Bcomponent * next
Definition: rwmodel.h:52
COMPLINK_ANGLE
#define COMPLINK_ANGLE
Definition: model_tags.h:62
item_put_list
int item_put_list(Bstar_block *block, const char *tag, char *list, size_t offset, const char *format)
Writes a list of string or numeric values into a data item associated with a specific data block and ...
Definition: rwstar.cpp:1436
item_change_tag
int item_change_tag(Bstar *star, const char *tag, const char *newtag)
Replaces one tag with another in the STAR data base.
Definition: rwstar.cpp:966
Bcomponent
Definition: rwmodel.h:51
Bmodel::hand
int hand
Definition: rwmodel.h:123
VERB_DEBUG
#define VERB_DEBUG
Definition: utilities.h:116
COMPONENT_DENSITY
#define COMPONENT_DENSITY
Definition: model_tags.h:43
COMPONENT_ALPHA
#define COMPONENT_ALPHA
Definition: model_tags.h:42
Bcomptype::fmod
Bstring fmod
Definition: rwmodel.h:29
item_index
int item_index(Bstar_block *block, const char *tag)
Gets the STAR item associated with a tag in a STAR data block.
Definition: rwstar.cpp:1029
item_get_integer
int item_get_integer(Bstar_block *block, const char *tag)
Gets an integer value associated with a tag in a STAR data block.
Definition: rwstar.cpp:1245
rwmodel.h
Header file for reading and writing atomic model files.
Bcomponent::loc
Vector3< float > loc
Definition: rwmodel.h:58
file_util.h
Header file for file checking functions.
Bcomptype::sel
int sel
Definition: rwmodel.h:34
item_get_float
float item_get_float(Bstar_block *block, const char *tag)
Gets a floating point value associated with a tag in a STAR data block.
Definition: rwstar.cpp:1273
Bstring
Definition: Bstring.h:29
add_item
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
Definition: linked_list.cpp:26
Bcomponent::id
Bstring id
Definition: rwmodel.h:53
Bstring::integer
long integer()
Definition: Bstring.cpp:547
component_add
Bcomponent * component_add(Bcomponent **comp, Bstring &id)
Adds a component to a linked list.
Definition: rwmodel.cpp:270
Bcomptype
Definition: rwmodel.h:25
Bstar::comment
Bstring comment
Definition: rwstar.h:81
Bmodel::next
Bmodel * next
Definition: rwmodel.h:120
COMPLINK_1
#define COMPLINK_1
Definition: model_tags.h:60
loop_set_identifier
int loop_set_identifier(Bstar_block *block, int loop, int n,...)
Assigns a loop identification number to items.
Definition: rwstar.cpp:1803
Bstring::real
double real()
Definition: Bstring.cpp:553
item_find_or_make
Bstar_item * item_find_or_make(Bstar_block *block, const char *tag)
Gets the STAR item associated with a tag in a STAR data block.
Definition: rwstar.cpp:1105
Bcomptype::mass
float mass
Definition: rwmodel.h:32
Bmodel::link
Blink * link
Definition: rwmodel.h:133
length
double length(vector< T > v)
Definition: Vector3.h:530
COMPONENT_VIEW_X
#define COMPONENT_VIEW_X
Definition: model_tags.h:34
COMPONENT_SELECT
#define COMPONENT_SELECT
Definition: model_tags.h:45
Bstring::c_str
const char * c_str()
Definition: Bstring.h:70
Bstar_item::maxlen
int maxlen
Definition: rwstar.h:41
Bmodel::fmap
Bstring fmap
Definition: rwmodel.h:125
models_process
long models_process(Bmodel *model, long(modfunc)(Bmodel *))
Process a list of models using the specified function.
Definition: model_util.cpp:36
COMPTYPE_MAP_NUMBER
#define COMPTYPE_MAP_NUMBER
Definition: model_tags.h:51
MODEL_SYM
#define MODEL_SYM
Definition: model_tags.h:21
COMPONENT_VIEW_ANGLE
#define COMPONENT_VIEW_ANGLE
Definition: model_tags.h:37
Vector3::distance
double distance(const Vector3 &v)
Definition: Vector3.h:227
item_put_float
int item_put_float(Bstar_block *block, const char *tag, float value, const char *format)
Writes a floating point value into a data item associated with a specific data block and tag in a STA...
Definition: rwstar.cpp:1401
COMPONENT_Z
#define COMPONENT_Z
Definition: model_tags.h:33
Bmodel::comp
Bcomponent * comp
Definition: rwmodel.h:132
Bstar_block::tag
Bstring tag
Definition: rwstar.h:58
item_put_integer
int item_put_integer(Bstar_block *block, const char *tag, int value, const char *format)
Writes a integer into a data item associated with a specific data block and tag in a STAR data base.
Definition: rwstar.cpp:1368
COMPLINK_RED
#define COMPLINK_RED
Definition: model_tags.h:64
COMPTYPE_SELECT
#define COMPTYPE_SELECT
Definition: model_tags.h:55
Bmodel::id
Bstring id
Definition: rwmodel.h:121
COMPLINK_ALPHA
#define COMPLINK_ALPHA
Definition: model_tags.h:67
write_star
int write_star(const char *filename, Bstar *star)
Writes a STAR data base to one or more STAR format files.
Definition: rwstar.cpp:666
Bstring::pre_rev
Bstring pre_rev(char c)
Definition: Bstring.cpp:421
MODEL_ID
#define MODEL_ID
Definition: model_tags.h:18
COMPLINK_RADIUS
#define COMPLINK_RADIUS
Definition: model_tags.h:63
Bmodel::split
int split
Definition: rwmodel.h:130
verbose
int verbose
COMPONENT_Y
#define COMPONENT_Y
Definition: model_tags.h:32
item_get_number_for_block
long item_get_number_for_block(Bstar_block *block, const char *tag)
Gets the number of values associated with a tag in a STAR data block.
Definition: rwstar.cpp:1163
Bmodel::sel
int sel
Definition: rwmodel.h:129
COMPTYPE_FILENAME
#define COMPTYPE_FILENAME
Definition: model_tags.h:50
COMPONENT_ID
#define COMPONENT_ID
Definition: model_tags.h:29
COMPONENT_X
#define COMPONENT_X
Definition: model_tags.h:31
COMPONENT_VIEW_Z
#define COMPONENT_VIEW_Z
Definition: model_tags.h:36
Bmodel
Definition: rwmodel.h:119
Bcomponent::color
RGBA< float > color
Definition: rwmodel.h:63
COMPONENT_FOM
#define COMPONENT_FOM
Definition: model_tags.h:44
M_PI
#define M_PI
Definition: utilities.h:63
utilities.h
Header file for general utilities.
COMPONENT_VIEW_Y
#define COMPONENT_VIEW_Y
Definition: model_tags.h:35
Bmodel::img_num
int img_num
Definition: rwmodel.h:127
Bstring::length
long length() const
Definition: Bstring.cpp:263
Bcomponent::view
View view
Definition: rwmodel.h:59
Bcomptype::num
int num
Definition: rwmodel.h:30
Bcomponent::fom
float fom
Definition: rwmodel.h:65
read_star
int read_star(const char *filename, Bstar *star)
Reads paramaters and data into a STAR data base from a list of files.
Definition: rwstar.cpp:224
Bcomponent::type
Bcomptype * type
Definition: rwmodel.h:54
Bcomptype::id
Bstring id
Definition: rwmodel.h:27
model
Bmodel * model
Definition: bshow.cpp:34
kill_star
int kill_star(Bstar *star)
Destroys a STAR data base.
Definition: rwstar.cpp:132
COMPLINK_SELECT
#define COMPLINK_SELECT
Definition: model_tags.h:69
MODEL_MAP_NUMBER
#define MODEL_MAP_NUMBER
Definition: model_tags.h:23
Bstring::next
Bstring * next
Definition: Bstring.h:31
Bstar::line_length
int line_length
Definition: rwstar.h:80
MODEL_HAND
#define MODEL_HAND
Definition: model_tags.h:20
COMPONENT_TYPE_ID
#define COMPONENT_TYPE_ID
Definition: model_tags.h:30
find_file
Bstring find_file(Bstring filename, Bstring path, int flag=0)
Searches for a file within or without the given path.
Definition: file_util.cpp:54
read_model_star
Bmodel * read_model_star(Bstring *file_list)
Reads STAR model parameters.
Definition: rwmodel_star.cpp:26
linked_list.h
Header file for generalized linked list functions.
COMPTYPE_NUMBER
#define COMPTYPE_NUMBER
Definition: model_tags.h:52
model_add
Bmodel * model_add(Bmodel **model, Bstring &id)
Adds a model to a linked list.
Definition: rwmodel.cpp:181
COMPONENT_RED
#define COMPONENT_RED
Definition: model_tags.h:39
COMPLINK_2
#define COMPLINK_2
Definition: model_tags.h:61
item_find
Bstar_item * item_find(Bstar_block *block, const char *tag)
Gets the STAR item associated with a tag in a STAR data block.
Definition: rwstar.cpp:1083
COMPLINK_FOM
#define COMPLINK_FOM
Definition: model_tags.h:68
MODEL_TYPE
#define MODEL_TYPE
Definition: model_tags.h:19
model_util.h
Library routines used for model processing.
item_put_angle_list
int item_put_angle_list(Bstar_block *block, const char *tag, char *list, size_t offset, const char *format)
Writes a list of angular values in degrees into a data item associated with a specific data block and...
Definition: rwstar.cpp:1528
model_add_type_by_id
Bcomptype * model_add_type_by_id(Bmodel *model, Bstring &id)
Add a type to a model if the identifier does not exist already.
Definition: rwmodel.cpp:414
COMPTYPE_MASS
#define COMPTYPE_MASS
Definition: model_tags.h:53
rwstar.h
A header file for STAR format files.
item_put_string
int item_put_string(Bstar_block *block, const char *tag, char *string)
Writes a string into a data item associated with a specific data block and tag in a STAR data base.
Definition: rwstar.cpp:1300
COMPTYPE_FOM
#define COMPTYPE_FOM
Definition: model_tags.h:54
Bstar::block
Bstar_block * block
Definition: rwstar.h:82
Bmodel::type
Bcomptype * type
Definition: rwmodel.h:131
Bcomptype::next
Bcomptype * next
Definition: rwmodel.h:26
Bcomponent::radius
float radius
Definition: rwmodel.h:62
write_model_star
int write_model_star(Bstring &filename, Bmodel *model)
Writes STAR model parameters.
Definition: rwmodel_star.cpp:248
COMPLINK_BLUE
#define COMPLINK_BLUE
Definition: model_tags.h:66
MODEL_MAP_FILENAME
#define MODEL_MAP_FILENAME
Definition: model_tags.h:22
Bstar_block::filename
Bstring filename
Definition: rwstar.h:60
Bcomptype::fom
float fom
Definition: rwmodel.h:33
COMPLINK_GREEN
#define COMPLINK_GREEN
Definition: model_tags.h:65
Bcomponent::density
float density
Definition: rwmodel.h:64
Bstar_block
Definition: rwstar.h:55
Bstar_block::next
Bstar_block * next
Definition: rwstar.h:56
Bstar::split
int split
Definition: rwstar.h:79
COMPONENT_BLUE
#define COMPONENT_BLUE
Definition: model_tags.h:41
string_add
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
Definition: Bstring.cpp:713
init_star
Bstar * init_star()
Creates a STAR data base.
Definition: rwstar.cpp:111
COMPONENT_GREEN
#define COMPONENT_GREEN
Definition: model_tags.h:40
Bmodel::comment
Bstring comment
Definition: rwmodel.h:126
MODEL_FOM
#define MODEL_FOM
Definition: model_tags.h:24
COMPTYPE_ID
#define COMPTYPE_ID
Definition: model_tags.h:49
Bmodel::symmetry
Bstring symmetry
Definition: rwmodel.h:124
Bstar
Definition: rwstar.h:78
model_tags.h
All STAR and XML file format tags for models.
COMPONENT_RADIUS
#define COMPONENT_RADIUS
Definition: model_tags.h:38
Bmodel::type_id
Bstring type_id
Definition: rwmodel.h:122
Bcomponent::sel
int sel
Definition: rwmodel.h:66