Developer documentation | Axl-2.5.1

axlFieldParametricVolume.cpp
Go to the documentation of this file.
1 /* axlFieldParametricVolume.cpp ---
2  *
3  * Author: Anais Ducoffe
4  * Copyright (C) 2013 - Anais Ducoffe, Inria.
5  */
6 
7 /* Commentary:
8  *
9  */
10 
11 /* Change log:
12  *
13  */
14 #include <sstream>
15 
17 #include "axlAbstractProcess.h"
18 
19 #include <dtkCoreSupport/dtkGlobal.h>
20 
21 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
22 #include <dtkCoreSupport/dtkAbstractProcessFactory.h>
23 
26 
27 class axlFieldParametricVolumePrivate
28 {
29 public:
33 
36 };
37 
38 // /////////////////////////////////////////////////////////////////
39 // axlFieldParametricVolume implementation
40 // /////////////////////////////////////////////////////////////////
41 
43 
47 {
48  d->input = NULL;
49  d->function = NULL;
50  this->setObjectName(this->identifier());
51 }
52 
53 
54 
56 
60 {
61  delete d;
62 
63  d = NULL;
64 }
65 
66 
67 
70 // *
71 // */
72 //void axlFieldParametricVolume::setType(axlFieldParametricVolume::Type type)
73 //{
74 
75 // d->type = type;
76 //}
77 
80 // *
81 // */
82 //void axlFieldParametricVolume::setKind(axlFieldParametricVolume::Kind kind)
83 //{
84 
85 // d->kind = kind;
86 //}
87 
90 // *
91 // */
92 //void axlFieldParametricVolume::setSupport(axlFieldParametricVolume::Support support)
93 //{
94 // d->support = support;
95 //}
96 
97 
98 //axlFieldParametricVolume::Type axlFieldParametricVolume::type(void)
99 //{
100 // return d->type;
101 //}
102 
103 //axlFieldParametricVolume::Kind axlFieldParametricVolume::kind(void)
104 //{
105 // return d->kind;
106 //}
107 
108 //axlFieldParametricVolume::Support axlFieldParametricVolume::support(void)
109 //{
110 // return d->support;
111 //}
112 
114 
117 double axlFieldParametricVolume::scalar(double u, double v , double w)
118 {
119 // if(!(this->kind() == Scalar)) {
120 // qDebug() << "Getting scalar value on non scalar field.";
121 // return 0;
122 // }
123  return d->function->eval(u,v,w).x();
124 
125 
126 
127 }
128 
130 
133 double *axlFieldParametricVolume::vector(double u, double v, double w)
134 {
135 // if(!(this->kind() == Vector)) {
136 // qDebug() << "Getting vector value on non vector field.";
137 // return NULL;
138 // }
139  return d->function->eval(u,v,w).coordinates();
140 
141 }
142 
144 
147 double *axlFieldParametricVolume::tensor(double u, double v, double w)
148 {
149 // if(!(this->kind() == Tensor)) {
150 // qDebug() << "Getting tensor value on non tensor field.";
151 // return NULL;
152 // }
153 
154  //TO DO
155  return NULL;
156 }
157 
160 // *
161 // */
162 //QString axlFieldParametricVolume::name(void)
163 //{
164 // return this->objectName() ;
165 //}
166 
169 // *
170 // */
171 //void axlFieldParametricVolume::setName(QString name)
172 //{
173 // this->setObjectName(name);
174 
175 //}
176 
178 
182 {
183  QString qstr;
184 
185  qstr.append("axlFieldParametricVolume : \n");
186 
187 
188  switch(d->type){
190  qstr.append("Type : integer");
191  break;
193  qstr.append("Type : Float");
194  break;
196  qstr.append("Type : Double");
197  break;
198  default:
199  qDebug() << "Unsupported field type";
200  }
201 
202 
203  switch(d->kind) {
205  qstr.append(";Kind : Scalar");
206  break;
208  qstr.append(";Kind : Vector");
209  break;
211  qstr.append(";Kind : Tensor");
212  break;
213  default:
214  qDebug() << ";Unsupported field kind";
215  }
216 
217  switch(d->support) {
219  qstr.append(";Support : Point");
220  break;
222  qstr.append(";Support : Cell");
223  break;
225  qstr.append(";Support : Custom");
226  break;
227  default:
228  qDebug() << ";No support";
229  }
230 
231  return qstr;
232 
233 }
234 
235 
237 
241 {
242 
243  return "axlFieldParametricVolume";
244 }
245 
247 
251  if(dynamic_cast<axlAbstractVolumeParametric*>(data))
252  d->function = dynamic_cast<axlAbstractVolumeParametric*>(data);
253 }
254 
256 
260  return d->function;
261 }
262 
264 
268  if(dynamic_cast<axlAbstractVolumeParametric *>(data))
269  d->input = dynamic_cast<axlAbstractVolumeParametric *>(data);
270 }
271 
272 
274 
278 
279  return d->input->startParam_u();
280 
281 }
282 
283 
285 
289  return d->input->startParam_v();
290 }
291 
292 
294 
298  return d->input->startParam_w();
299 }
300 
301 
303 
307 
308  return d->input->endParam_u();
309 }
310 
311 
313 
317 
318  return d->input->endParam_v();
319 }
320 
321 
323 
327 
328  return d->input->endParam_w();
329 }
330 
331 
333 
337 
338  return d->input->numSamples_u();
339 }
340 
342 
346  return d->input->numSamples_v();
347 }
348 
349 
351 
355  return d->input->numSamples_w();
356 }
357 
358 
360 
364  return d->input->numSamples_u() *d->input->numSamples_v() *d->input->numSamples_w();
365 }
366 
367 
368 
371 
375 {
376  emit updated();
377 }
378 
379 // /////////////////////////////////////////////////////////////////
380 // axlFieldBSpline documentation
381 // /////////////////////////////////////////////////////////////////
382 
389 // /////////////////////////////////////////////////////////////////
390 // Type instanciation
391 // /////////////////////////////////////////////////////////////////
392 
393 dtkAbstractData *createaxlFieldParametricVolume(void)
394 {
395  return new axlFieldParametricVolume();
396 }
397 
398 
double start_v(void)
Returns the first parameter value of the field.
virtual double * vector(double u, double v, double w)
Returns the value of the spatial field at the coordinates point entered.
void setVolume(axlAbstractData *data)
Sets the BSpline on which the BSpline field is applied.
virtual QString identifier(void) const
Returns the identifier of the field "axlFieldParametricVolume".
double start_w(void)
Returns the first parameter value of the field.
void setFunction(axlAbstractData *data)
Sets the Bspline function which determines the values of the parametric field.
double end_u(void)
Returns the last parameter value of the field.
double end_w(void)
Returns the last parameter value of the field.
dtkAbstractData * createaxlFieldParametricVolume(void)
Class axlAbstractFieldParametricVolume defines an API for parametric field.
double numbersample_w(void)
Returns the number of parameters.
virtual double * tensor(double u, double v, double w)
Returns the value of the spatial field at the coordinates point entered.
double start_u(void)
Returns the first parameter value of the field.
double end_v(void)
Returns the last parameter value of the field.
virtual ~axlFieldParametricVolume(void)
Destroys a Bspline field.
double numbersample_u(void)
Returns the number of parameters.
double numbersample_v(void)
Returns the number of parameters.
Class axlFieldParametricVolume defines an API for field which owns a BSpline Volume.
axlAbstractData * getFunction(void)
Returns the Bspline function which determines the values of the parametric field. ...
Class axlAbstractData defines an API for all type of axel data.
virtual double scalar(double u, double v, double w)
Returns the value of the spatial field at the coordinates point entered.
virtual QString description(void) const
Returns the description of the field.
int size(void)
Returns the number of values evaluated for this BSpline field on each samples of the input BSpline...