/Users/bernard/b20/bsoft/src/rwmodel/rwmodel.cpp(3)

NAME
/Users/bernard/b20/bsoft/src/rwmodel/rwmodel.cpp - Library routines to read and write atomic model parameters.

SYNOPSIS

#include 'rwmodel.h'
#include 'rwmodel_star.h'
#include 'rwmodel_xml.h'
#include 'rwmodel_cmm.h'
#include 'rwmodel_bild.h'
#include 'rwmodel_mol.h'
#include 'rwmodel_vega.h'
#include 'model_links.h'
#include 'file_util.h'
#include 'linked_list.h'
#include 'Color.h'
#include 'utilities.h'

  Functions
Bmodel * read_model (Bstring &filename)
Bmodel * read_model (Bstring *file_list)
Bmodel * read_model (Bstring &filename, Bstring &paramfile)
Bmodel * read_model (Bstring *file_list, Bstring &paramfile)
Reads model parameters.
int write_model (Bstring &filename, Bmodel *model)
Writes model parameters.
Bmodel * model_init (Bstring &id)
Initializes a model structure.
Bmodel * model_init (const char *cid)
Bmodel * model_add (Bmodel **model, Bstring &id)
Adds a model to a linked list.
Bmodel * model_add (Bmodel **model, const char *cid)
Bmodel * model_add (Bmodel **model, Bmodel *model_nu)
Bcomptype * component_type_add (Bcomptype **type, Bstring &id)
Adds a component type to a linked list.
Bcomponent * component_add (Bcomponent **comp, Bstring &id)
Adds a component to a linked list.
Bcomponent * component_add (Bcomponent **comp, unsigned long number)
Blink * link_add (Blink **link, Bcomponent *comp1, Bcomponent *comp2, double length, double radius)
Adds a component link to a linked list.
Blink * link_add (Blink **link, Bcomponent *comp1, Bcomponent *comp2)
int link_index (Bcomponent *comp, Bcomponent *comp2)
Returns the index of a linked component.
int model_set_map_filenames (Bmodel *model, Bstring &mapfile)
Sets all the map file names of selected models.
Bcomptype * model_add_type_by_id (Bmodel *model, Bstring &id)
Add a type to a model if the identifier does not exist already.
Bcomptype * model_add_type_by_filename (Bmodel *model, Bstring &filename, int num)
Add a type to a model if the type with the given file name does not exist already.
Bcomptype * model_add_type_by_id_and_filename (Bmodel *model, Bstring &id, Bstring &filename, int num)
Add a type to a model if the type with the given id and file name does not exist already.
Bcomptype * model_get_type (Bmodel *model, Bstring &id)
Return the type corresponding to an identifier.
int model_set_type (Bmodel *model, Bstring &set_type)
Reset the component types.
int model_change_type (Bmodel *model, Bstring &change_type)
Change a component type name.
int model_count_component_types (Bmodel *model)
Counts the number of components for each type.
int model_check (Bmodel *model, Bstring path)
Checks model properties.
int model_component_count (Bmodel *model)
Counts the total number of components.
Bmodel * model_list_copy (Bmodel *model)
Copies a model.
Bmodel * model_copy (Bmodel *model)
Copies a model.
int component_type_copy (Bcomptype *fromct, Bcomptype *toct)
Copies all elements from one component to another.
int component_copy (Bcomponent *fromcomp, Bcomponent *tocomp)
Copies all elements from one component to another.
long component_count (Bcomponent *comp)
Counts the total number of components.
Bcomponent * component_find (Bcomponent *comp, Bstring &id)
Finds a component in a component list.
int link_copy (Blink *fromlink, Blink *tolink)
Copies all elements from one link to another.
Blink * link_find (Blink *link, Bcomponent *comp1, Bcomponent *comp2)
Finds a link in a link list.
int component_kill (Bcomponent *comp)
Deallocates memory for one component.
int component_list_kill (Bcomponent *comp)
Deallocates memory for a list of components.
int comp_type_kill (Bcomptype *type)
Deallocates memory for one component type.
int comp_type_list_kill (Bcomptype *type)
Deallocates memory for a list of component types.
int model_link_list_kill (Bmodel *model)
Deallocates memory for a list of component links.
int link_kill (Blink **link_list, Bcomponent *comp, int i)
Deletes a link.
int link_kill (Blink **link_list, Bcomponent *comp, Bcomponent *comp2)
Deletes a link.
int poly_list_kill (Bpolygon *poly)
Deallocates memory for a list of polygons.
int comp_associated_links_kill (Bcomponent *comp, Blink **link)
Deallocates memory for links associated with a component.
int model_kill (Bmodel *model)
Deallocates all memory in the list.
int model_update_comment (Bmodel *model, int n, char **strings)
Puts a set of strings and time in the comment of a model.
int model_associate (Bmodel *model, Bstring &associate_type, Bstring &associate_file)
Associates a model file with a component type.
int model_associate_mass (Bmodel *model, Bstring &associate_type, double mass)
Associates a mass with a component type.
int model_set_comptype_filenames (Bmodel *model, Bstring &filename)
Sets the filenames of all selected component types to the given string.
long model_set_component_radius (Bmodel *model, double comprad)
Set the display radius for all components to a specific value.
long model_set_density (Bmodel *model, double density)
Set the density of selected components to a specific value.
long model_set_fom (Bmodel *model, double fom)
Set the FOM of selected components to a specific value.

  Variables
int verbose

Detailed Description

Library routines to read and write atomic model parameters.

Author:
    Bernard Heymann

Date:
    Created: 20060919

    Modified: 20161004

Definition in file rwmodel.cpp.

Function Documentation

  int comp_associated_links_kill (Bcomponent * comp, Blink ** link)

Deallocates memory for links associated with a component.

Parameters:
    *comp associated componet.
    **link pointer to component link list.

Returns:
    int number of component links deallocated.

Definition at line 1092 of file rwmodel.cpp.

  int comp_type_kill (Bcomptype * type)

Deallocates memory for one component type.

Parameters:
    *type component type.

Returns:
    int 0.

Definition at line 912 of file rwmodel.cpp.

  int comp_type_list_kill (Bcomptype * type)

Deallocates memory for a list of component types.

Parameters:
    *type component type list.

Returns:
    int total number of component types.

Definition at line 926 of file rwmodel.cpp.

  Bcomponent* component_add (Bcomponent ** comp, Bstring & id)

Adds a component to a linked list.

The function allocates memory for a new component structure.
If the content of the pointer is null, the new structure is
the first in the list. Otherwise, the end of the list is found
and the new structure added to it.

Parameters:
    **comp component list.
    &id component identifier.

Returns:
    Bcomponent new component.

Definition at line 267 of file rwmodel.cpp.

  Bcomponent* component_add (Bcomponent ** comp, unsigned long number)

Definition at line 294 of file rwmodel.cpp.

  int component_copy (Bcomponent * fromcomp, Bcomponent * tocomp)

Copies all elements from one component to another.

Parameters:
    *fromcomp source component.
    *tocomp destination component.

Returns:
    int 0.

Definition at line 783 of file rwmodel.cpp.

  long component_count (Bcomponent * comp)

Counts the total number of components.

Parameters:
    *comp component list.

Returns:
    long number of components.

Definition at line 805 of file rwmodel.cpp.

  Bcomponent* component_find (Bcomponent * comp, Bstring & id)

Finds a component in a component list.

Parameters:
    *comp starting component.
    &id component identifier.

Returns:
    Bcomponent* component found, NULL otherwise.

Definition at line 822 of file rwmodel.cpp.

  int component_kill (Bcomponent * comp)

Deallocates memory for one component.

Parameters:
    *comp component.

Returns:
    int 0.

Definition at line 877 of file rwmodel.cpp.

  int component_list_kill (Bcomponent * comp)

Deallocates memory for a list of components.

Parameters:
    *comp component list.

Returns:
    int total number of components.

Definition at line 891 of file rwmodel.cpp.

  Bcomptype* component_type_add (Bcomptype ** type, Bstring & id)

Adds a component type to a linked list.

Parameters:
    **type component type list.
    &id component type identifier.

Returns:
    Bcomptype* new component type.

    The function allocates memory for a new component type structure.
    If the content of the pointer is null, the new structure is
    the first in the list. Otherwise, the end of the list is found
    and the new structure added to it.

Definition at line 230 of file rwmodel.cpp.

  int component_type_copy (Bcomptype * fromct, Bcomptype * toct)

Copies all elements from one component to another.

Parameters:
    *fromct source component.
    *toct destination component.

Returns:
    int 0.

Definition at line 763 of file rwmodel.cpp.

  Blink* link_add (Blink ** link, Bcomponent * comp1, Bcomponent * comp2, double length, double radius)

Adds a component link to a linked list.

The function allocates memory for a new link structure.
If the content of the pointer is null, the new structure is
the first in the list. Otherwise, the end of the list is found
and the new structure added to it.

Parameters:
    **link component link list.
    *comp1 first component.
    *comp2 second component.
    length length of link.
    radius display radius.

Returns:
    Bcomponent new component.

Definition at line 315 of file rwmodel.cpp.

  Blink* link_add (Blink ** link, Bcomponent * comp1, Bcomponent * comp2)

Definition at line 363 of file rwmodel.cpp.

  int link_copy (Blink * fromlink, Blink * tolink)

Copies all elements from one link to another.

Parameters:
    *fromlink source link.
    *tolink destination link.

Returns:
    int 0.

Definition at line 836 of file rwmodel.cpp.

  Blink* link_find (Blink * link, Bcomponent * comp1, Bcomponent * comp2)

Finds a link in a link list.

Parameters:
    *link starting link.
    *comp1 one component.
    *comp2 other component.

Returns:
    Blink* link found, NULL otherwise.

Definition at line 857 of file rwmodel.cpp.

  int link_index (Bcomponent * comp, Bcomponent * comp2)

Returns the index of a linked component.

Parameters:
    *comp component with list of linked components to be searched.
    *comp2 component to search for.

Returns:
    int link index, -1 if not found.

    If the second component is not found in the list of linked components,
    a -1 is returned.

Definition at line 378 of file rwmodel.cpp.

  int link_kill (Blink ** link_list, Bcomponent * comp, int i)

Deletes a link.

The link in the model link list is removed.
The associated references to the link in the component link arrays
are removed and the link arrays reorganized.

Parameters:
    **link_list pointer to list of links.
    *comp one component in the link.
    i index for second component in link array of first component.

Returns:
    Bdistmat* new distance matrix structure.

Definition at line 988 of file rwmodel.cpp.

  int link_kill (Blink ** link_list, Bcomponent * comp, Bcomponent * comp2)

Deletes a link.

The link in the model link list is removed.
The associated references to the link in the component link arrays
are removed and the link arrays reorganized.

Parameters:
    **link_list pointer to list of links.
    *comp one component in the link.
    *comp2 second component in the link.

Returns:
    Bdistmat* new distance matrix structure.

Definition at line 1051 of file rwmodel.cpp.

  Bmodel* model_add (Bmodel ** model, Bstring & id)

Adds a model to a linked list.

Parameters:
    **model model list.
    &id model identifier.

Returns:
    Bmodel* new model.

    The function allocates memory for a new model structure.
    If the content of the pointer is null, the new structure is
    the first in the list. Otherwise, the end of the list is found
    and the new structure added to it.

Definition at line 178 of file rwmodel.cpp.

  Bmodel* model_add (Bmodel ** model, const char * cid)

Definition at line 196 of file rwmodel.cpp.

  Bmodel* model_add (Bmodel ** model, Bmodel * model_nu)

Definition at line 205 of file rwmodel.cpp.

  Bcomptype* model_add_type_by_filename (Bmodel * model, Bstring & filename, int num)

Add a type to a model if the type with the given file name does not exist already.

Parameters:
    *model model parameters.
    &filename model file to check for and add.
    num model number within file.

Returns:
    Bcomptype* type identifier.

Definition at line 434 of file rwmodel.cpp.

  Bcomptype* model_add_type_by_id (Bmodel * model, Bstring & id)

Add a type to a model if the identifier does not exist already.

Parameters:
    *model model parameters.
    &id component type identifier to check for and add.

Returns:
    Bcomptype* type identifier.

Definition at line 411 of file rwmodel.cpp.

  Bcomptype* model_add_type_by_id_and_filename (Bmodel * model, Bstring & id, Bstring & filename, int num)

Add a type to a model if the type with the given id and file name does not exist already.

Parameters:
    *model model parameters.
    &id component type identifier to check for and add.
    &filename model file to check for and add.
    num model number within file.

Returns:
    Bcomptype* type identifier.

Definition at line 465 of file rwmodel.cpp.

  int model_associate (Bmodel * model, Bstring & associate_type, Bstring & associate_file)

Associates a model file with a component type.

Parameters:
    *model the model.
    &associate_type component type.
    &associate_file component file name.

Returns:
    int number of types associated.

    Model files can be coordinates or maps.

Definition at line 1177 of file rwmodel.cpp.

  int model_associate_mass (Bmodel * model, Bstring & associate_type, double mass)

Associates a mass with a component type.

Parameters:
    *model model list.
    &associate_type component type.
    mass component type mass.

Returns:
    int number of types associated.

Definition at line 1207 of file rwmodel.cpp.

  int model_change_type (Bmodel * model, Bstring & change_type)

Change a component type name.

Parameters:
    *model model.
    &change_type component type.

Returns:
    int number of models.

    Sets all the component types to the given string.

Definition at line 545 of file rwmodel.cpp.

  int model_check (Bmodel * model, Bstring path)

Checks model properties.

Parameters:
    *model model.
    path search path to find map files.

Returns:
    int 0.

Definition at line 592 of file rwmodel.cpp.

  int model_component_count (Bmodel * model)

Counts the total number of components.

Parameters:
    *model model parameters.

Returns:
    int 0.

Definition at line 635 of file rwmodel.cpp.

  Bmodel* model_copy (Bmodel * model)

Copies a model.

Parameters:
    *model model parameters.

Returns:
    Bmodel* model copy.

    Copies only the first model in the list.

Definition at line 685 of file rwmodel.cpp.

  int model_count_component_types (Bmodel * model)

Counts the number of components for each type.

Parameters:
    *model model.

Returns:
    int 0.

Definition at line 568 of file rwmodel.cpp.

  Bcomptype* model_get_type (Bmodel * model, Bstring & id)

Return the type corresponding to an identifier.

Parameters:
    *model model parameters.
    &id component identifier to check for and add.

Returns:
    Bcomptype* component type.

Definition at line 491 of file rwmodel.cpp.

  Bmodel* model_init (Bstring & id)

Initializes a model structure.

Parameters:
    &id model identifier.

Returns:
    Bmodel* new model structure.

Definition at line 144 of file rwmodel.cpp.

  Bmodel* model_init (const char * cid)

Definition at line 157 of file rwmodel.cpp.

  int model_kill (Bmodel * model)

Deallocates all memory in the list.

Parameters:
    *model model parameters.

Returns:
    int 0.

Definition at line 1124 of file rwmodel.cpp.

  int model_link_list_kill (Bmodel * model)

Deallocates memory for a list of component links.

Only the first model in the list is processed.

Parameters:
    *model model.

Returns:
    int total number of component links.

Definition at line 950 of file rwmodel.cpp.

  Bmodel* model_list_copy (Bmodel * model)

Copies a model.

Copies all the models in a list.

Parameters:
    *model model parameters.

Returns:
    Bmodel* model copy.

Definition at line 657 of file rwmodel.cpp.

  long model_set_component_radius (Bmodel * model, double comprad)

Set the display radius for all components to a specific value.

Parameters:
    *model model parameters.
    comprad component display radius.

Returns:
    long number of components selected.

Definition at line 1264 of file rwmodel.cpp.

  int model_set_comptype_filenames (Bmodel * model, Bstring & filename)

Sets the filenames of all selected component types to the given string.

Parameters:
    *model model parameters.
    &filename component file name.

Returns:
    int number of component types set.

    The image numbers are sequentially set as well.

Definition at line 1239 of file rwmodel.cpp.

  long model_set_density (Bmodel * model, double density)

Set the density of selected components to a specific value.

Parameters:
    *model model parameters.
    density new density value.

Returns:
    long number of components selected.

Definition at line 1285 of file rwmodel.cpp.

  long model_set_fom (Bmodel * model, double fom)

Set the FOM of selected components to a specific value.

Parameters:
    *model model parameters.
    fom new FOM value.

Returns:
    long number of components selected.

Definition at line 1306 of file rwmodel.cpp.

  int model_set_map_filenames (Bmodel * model, Bstring & mapfile)

Sets all the map file names of selected models.

Parameters:
    *model model parameters.
    &mapfile map file name.

Returns:
    int 0.

Definition at line 395 of file rwmodel.cpp.

  int model_set_type (Bmodel * model, Bstring & set_type)

Reset the component types.

Parameters:
    *model model.
    &set_type component type.

Returns:
    int number of models.

    Sets all the component types to the given string.

Definition at line 516 of file rwmodel.cpp.

  int model_update_comment (Bmodel * model, int n, char ** strings)

Puts a set of strings and time in the comment of a model.

Parameters:
    *model the model.
    n the number of strings.
    **strings an array of strings.

Returns:
    int string length of the new comment.

    This is designed to pack the command line into a string followed by
    a second string for the time.

Definition at line 1158 of file rwmodel.cpp.

  int poly_list_kill (Bpolygon * poly)

Deallocates memory for a list of polygons.

Parameters:
    *poly polygon list.

Returns:
    int total number of polygons.

Definition at line 1070 of file rwmodel.cpp.

  Bmodel* read_model (Bstring & filename)

Definition at line 28 of file rwmodel.cpp.

  Bmodel* read_model (Bstring * file_list)

Definition at line 33 of file rwmodel.cpp.

  Bmodel* read_model (Bstring & filename, Bstring & paramfile)

Definition at line 39 of file rwmodel.cpp.

  Bmodel* read_model (Bstring * file_list, Bstring & paramfile)

Reads model parameters.

Parameters:
    *file_list list of model parameter file names.
    &paramfile parameter file.

Returns:
    Bmodel* model parameters.

Definition at line 50 of file rwmodel.cpp.

  int write_model (Bstring & filename, Bmodel * model)

Writes model parameters.

Parameters:
    &filename model parameter file name.
    *model model parameters.

Returns:
    int number of models.

Definition at line 91 of file rwmodel.cpp.

Variable Documentation

  int verbose

Author

Generated automatically by Doxygen for Bsoft from the source code.