DM_add_spring
List of: Functions
Subjects: DML Loads, Deformable Modeling
Contents: Standalone Deformable Modeling

Action: Adds a spring to a deformable model and returns a new tag identifier or an error.

Prototype: int DM_add_spring (


int& rtn_err, // out: 0=success or neg




// err code


DS_dmod* dmod, // in: member of target




// dmod hierarchy to




// search


int tag_flag, // in: specify tgt dmod




// 1 = active dmod




// 2 = root dmod




// else = member dmod




// with tag=tag_flag


int domain_flag, // orig_dmod_space,




// 1=dpt in unit_space,




// 2=dpt in




// internal_pfunc_space.


double* dpt, // in: domain_pt loc of




// surf spring end




// sized:[domain_dim]




// ptr:[not-nested]


double* ipt // in: image_pt loc of



= NULL, // free spring end




// sized:[image_dim]




// ptr:[not-nested]


int ipt_flag // in: 0: let free_pt =



= 0, // image_loc of dpt




// 1: let free_pt = ipt


double gain // in: magnitude of



= 0.0, // load gain


int tag // in: when = -1 assign



= -1, // else use this




// tag number


SDM_options* sdmo // in:SDM_options pointer



= NULL // note: sets active dmod

);

Includes: #include "kernel/acis.hxx"

#include "dshusk/dskernel/dmapi.hxx"

#include "dshusk/dskernel/dsdmod.hxx"

#include "dshusk/dskernel/sdm_options.hxx"

Description: Builds and adds to the target deformable model a DS_spring with its domain point, image point, and gain specified by the input arguments. A spring is a force that acts on the surface at the point where the spring is attached, in a direction pointing to the spring's image point. gain is the spring's stiffness. The spring's image point can be specified in two ways: explicitly, by setting ipt_flag to 1 and giving an image point vector x,y,z, or by setting ipt_flag to 0 and having the system take the initial image point location from the deformable model's current location for the domain point's dpt position.


When domain_flag is set to 1, dpt is given in the unit range and mapped to the pfunc's actual domain range by this function. When domain_flag is set to 0, dpt is given in the dmod's original domain range. When domain_flag is set to 2, dpt is given in the dmod's pfunc's internal domain range.


When tag equals -1 the next available tag number is assigned to the newly created load. Otherwise, the input tag number is used.


tag_flag selects the target deformable model. When tag equals -1 the next available tag number is assigned to the newly created load. Otherwise, the input tag number is used. Other valid values for the tag flag are:


1 = active deformable model

2 = root deformable model


Otherwise, the target is the deformable model whose tag identifier equals abs(tag_flag)


Returns a new load's tag number when successful.

Errors: DM_parse_tag_flag() errors



DM_BAD_IPT_FLAG_VALUE

The ipt_flag must be 0 or 1.



DM_NULL_INPUT_PTR

The input ipt value cannot be NULL and the ipt_flag cannot be 1.



DM_NULL_INPUT_PTR

The dpt input pointer cannot be NULL.



DM_BAD_DOMAIN_PT_RANGE

The domain point must be completely contained by the deformable model.

Library: dshusk

Filename: ds/dshusk/dskernel/dmapi.hxx

Effect: Changes model
PDF/DS/03FNA.PDF
HTM/DATA/DS/DS/03FNA/0012.HTM