BRL-CAD
pc.h
Go to the documentation of this file.
1/* P C . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2008-2023 United States Government as represented by
5 * the U.S. Army Research Laboratory.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this file; see the file named COPYING for more
18 * information.
19 */
20/** @addtogroup libpc */
21/** @{ */
22/** @file pc.h
23 *
24 * Structures required for implementing Parametrics and constraints
25 *
26 */
27#ifndef PC_H
28#define PC_H
29
30#include "common.h"
31
32#include "bu/list.h"
33#include "bu/vls.h"
34#include "bn.h"
35
36__BEGIN_DECLS
37
38#ifndef PC_EXPORT
39# if defined(PC_DLL_EXPORTS) && defined(PC_DLL_IMPORTS)
40# error "Only PC_DLL_EXPORTS or PC_DLL_IMPORTS can be defined, not both."
41# elif defined(PC_DLL_EXPORTS)
42# define PC_EXPORT COMPILER_DLLEXPORT
43# elif defined(PC_DLL_IMPORTS)
44# define PC_EXPORT COMPILER_DLLIMPORT
45# else
46# define PC_EXPORT
47# endif
48#endif
49
50/*
51 * Macros for providing function prototypes, regardless of whether the
52 * compiler understands them or not. It is vital that the argument
53 * list given for "args" be enclosed in parens.
54 */
55
56#define PC_PCSET_PUSHP(_pcsp,_par) \
57 BU_LIST_PUSH(&(_pcsp->ps->l),&(_par->l));
58#define PC_PCSET_PUSHC(_pcsp,_con) \
59 BU_LIST_PUSH(&(_pcsp->cs->l),&(_con->l));
60
61/** Definitions for data storage and transfer type information */
62#define PC_DB_FASTF_T 1
63#define PC_DB_POINT_T 2
64#define PC_DB_VECTOR_T 3
65
66#define PC_DB_BYSTRUCT 1
67#define PC_DB_BYEXPR 2
68
69
70/**
71 * A composite set of parameters constraints with respect to those
72 * parameters. Used for declaration by each geometry object
73 */
74struct pc_param {
75 struct bu_list l;
76 struct bu_vls name; /** Name of the parameter */
77
78 /** @todo convert to enum after pc becomes a dependency of rt */
79 int ctype; /** Container type used for storing data */
80 int dtype; /** Data type of the data pointed to */
81
82 union { /** The Actual data / pointer */
84 void * ptr;
86};
87
89 int nargs;
91 int (*fp) (double ** a);
92};
93
95 struct bu_list l;
96 struct bu_vls name;
97 int ctype;
98 union {
102 const char **args;
103};
104
105struct pc_pc_set {
106 struct pc_param * ps;
107 struct pc_constrnt * cs;
108};
109
110/* functions defined in pc_main.c */
111
112PC_EXPORT extern void pc_init_pcset(struct pc_pc_set * pcs);
113PC_EXPORT extern void pc_free_pcset(struct pc_pc_set * pcs);
114PC_EXPORT extern void pc_free_constraint(struct pc_constrnt * c);
115PC_EXPORT extern void pc_getparameter(struct pc_param **p, int t);
116PC_EXPORT extern void pc_pushparam_expr(struct pc_pc_set * pcsp, const char *name, const char *str);
117PC_EXPORT extern void pc_pushparam_struct(struct pc_pc_set * pcs, const char * name, int type, void * ptr);
118PC_EXPORT extern void pc_getconstraint_expr(struct pc_constrnt ** c);
119PC_EXPORT extern void pc_getconstraint_struct(struct pc_constrnt **c, int nargs);
120PC_EXPORT extern void pc_pushconstraint_expr(struct pc_pc_set * pcsp, const char * name, const char * str);
121PC_EXPORT extern void pc_pushconstraint_struct(struct pc_pc_set * pcs, const char * name, int nargs, int dimension, int (*fp) (double ** args), const char ** args);
122PC_EXPORT extern void pc_pushconstraint_struct1(struct pc_pc_set * pcs, struct pc_constrnt * c);
123PC_EXPORT extern void pc_pushconstraint(struct pc_pc_set * pcs, const char * str);
124
125/* constraint eval functions defined in pc_constraints.c */
126
127PC_EXPORT extern int pc_isperpendicular(double ** v);
128PC_EXPORT extern void pc_mk_isperpendicular(struct pc_constrnt ** c, const char * name, const char **args);
129PC_EXPORT extern int pc_ismodpositive(double ** v);
130PC_EXPORT extern void pc_mk_ismodpositive(struct pc_constrnt ** c, const char * name, const char **args);
131
132__END_DECLS
133
134#endif
135/** @} */
136/*
137 * Local Variables:
138 * mode: C
139 * tab-width: 8
140 * indent-tabs-mode: t
141 * c-file-style: "stroustrup"
142 * End:
143 * ex: shiftwidth=4 tabstop=8
144 */
Header file for the BRL-CAD Numerical Computation Library, LIBBN.
Header file for the BRL-CAD common definitions.
void int * c
Definition: tig.h:139
void pc_mk_isperpendicular(struct pc_constrnt **c, const char *name, const char **args)
void pc_free_pcset(struct pc_pc_set *pcs)
void pc_getconstraint_expr(struct pc_constrnt **c)
void pc_getparameter(struct pc_param **p, int t)
void pc_pushconstraint_struct(struct pc_pc_set *pcs, const char *name, int nargs, int dimension, int(*fp)(double **args), const char **args)
void pc_pushparam_expr(struct pc_pc_set *pcsp, const char *name, const char *str)
void pc_pushconstraint_expr(struct pc_pc_set *pcsp, const char *name, const char *str)
void pc_init_pcset(struct pc_pc_set *pcs)
int pc_isperpendicular(double **v)
int pc_ismodpositive(double **v)
void pc_getconstraint_struct(struct pc_constrnt **c, int nargs)
void pc_mk_ismodpositive(struct pc_constrnt **c, const char *name, const char **args)
void pc_pushconstraint(struct pc_pc_set *pcs, const char *str)
void pc_pushconstraint_struct1(struct pc_pc_set *pcs, struct pc_constrnt *c)
void pc_pushparam_struct(struct pc_pc_set *pcs, const char *name, int type, void *ptr)
void pc_free_constraint(struct pc_constrnt *c)
Definition: list.h:131
Definition: vls.h:53
int nargs
Definition: pc.h:89
int dimension
Definition: pc.h:90
int(* fp)(double **a)
Definition: pc.h:91
Definition: pc.h:94
int ctype
Definition: pc.h:97
struct bu_vls name
Definition: pc.h:96
const char ** args
Definition: pc.h:102
struct bu_vls expression
Definition: pc.h:99
struct bu_list l
Definition: pc.h:95
struct pc_constraint_fp cf
Definition: pc.h:100
union pc_constrnt::@8 data
Definition: pc.h:74
int ctype
Definition: pc.h:79
struct bu_vls name
Definition: pc.h:76
union pc_param::@7 data
struct bu_vls expression
Definition: pc.h:83
struct bu_list l
Definition: pc.h:75
int dtype
Definition: pc.h:80
void * ptr
Definition: pc.h:84
Definition: pc.h:105
struct pc_constrnt * cs
Definition: pc.h:107
struct pc_param * ps
Definition: pc.h:106