| 1 | //
 | 
|---|
| 2 | // volume.h
 | 
|---|
| 3 | //
 | 
|---|
| 4 | // Copyright (C) 1996 Limit Point Systems, Inc.
 | 
|---|
| 5 | //
 | 
|---|
| 6 | // Author: Curtis Janssen <cljanss@limitpt.com>
 | 
|---|
| 7 | // Maintainer: LPS
 | 
|---|
| 8 | //
 | 
|---|
| 9 | // This file is part of the SC Toolkit.
 | 
|---|
| 10 | //
 | 
|---|
| 11 | // The SC Toolkit is free software; you can redistribute it and/or modify
 | 
|---|
| 12 | // it under the terms of the GNU Library General Public License as published by
 | 
|---|
| 13 | // the Free Software Foundation; either version 2, or (at your option)
 | 
|---|
| 14 | // any later version.
 | 
|---|
| 15 | //
 | 
|---|
| 16 | // The SC Toolkit is distributed in the hope that it will be useful,
 | 
|---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 19 | // GNU Library General Public License for more details.
 | 
|---|
| 20 | //
 | 
|---|
| 21 | // You should have received a copy of the GNU Library General Public License
 | 
|---|
| 22 | // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
 | 
|---|
| 23 | // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
|---|
| 24 | //
 | 
|---|
| 25 | // The U.S. Government is granted a limited license as per AL 91-7.
 | 
|---|
| 26 | //
 | 
|---|
| 27 | 
 | 
|---|
| 28 | #ifndef _math_isosurf_volume_h
 | 
|---|
| 29 | #define _math_isosurf_volume_h
 | 
|---|
| 30 | 
 | 
|---|
| 31 | #ifdef __GNUC__
 | 
|---|
| 32 | #pragma interface
 | 
|---|
| 33 | #endif
 | 
|---|
| 34 | 
 | 
|---|
| 35 | #include <math/optimize/function.h>
 | 
|---|
| 36 | #include <math/scmat/matrix.h>
 | 
|---|
| 37 | #include <math/scmat/vector3.h>
 | 
|---|
| 38 | 
 | 
|---|
| 39 | namespace sc {
 | 
|---|
| 40 | 
 | 
|---|
| 41 | /** A Volume is a Function of three variables. */
 | 
|---|
| 42 | class Volume: public Function {
 | 
|---|
| 43 |   private:
 | 
|---|
| 44 |     double _interp_acc;
 | 
|---|
| 45 |   protected:
 | 
|---|
| 46 |     double& interpolation_accuracy();
 | 
|---|
| 47 | 
 | 
|---|
| 48 |     virtual void compute() = 0;
 | 
|---|
| 49 | 
 | 
|---|
| 50 |     virtual void failure(const char*);
 | 
|---|
| 51 |   public:
 | 
|---|
| 52 |     Volume();
 | 
|---|
| 53 |     Volume(const Ref<KeyVal>&);
 | 
|---|
| 54 |     ~Volume();
 | 
|---|
| 55 | 
 | 
|---|
| 56 |     void set_gradient(const SCVector3& g);
 | 
|---|
| 57 |     void set_gradient(RefSCVector& g);
 | 
|---|
| 58 |     void get_gradient(SCVector3& g);
 | 
|---|
| 59 |     void set_x(const SCVector3& x);
 | 
|---|
| 60 |     void set_x(const RefSCVector& x);
 | 
|---|
| 61 |     void get_x(SCVector3& x);
 | 
|---|
| 62 | 
 | 
|---|
| 63 |     // find the corners of a bounding box which approximately
 | 
|---|
| 64 |     // contains all points with a value between valuemin and valuemax
 | 
|---|
| 65 |     // the result must satisfy p1[i] < p2[i]
 | 
|---|
| 66 |     virtual void boundingbox(double valuemin,
 | 
|---|
| 67 |                              double valuemax,
 | 
|---|
| 68 |                              SCVector3& p1, SCVector3& p2) = 0;
 | 
|---|
| 69 | 
 | 
|---|
| 70 |     virtual void interpolate(const SCVector3& p1,
 | 
|---|
| 71 |                              const SCVector3& p2,
 | 
|---|
| 72 |                              double value,
 | 
|---|
| 73 |                              SCVector3& result);
 | 
|---|
| 74 |     virtual void solve(const SCVector3& p,
 | 
|---|
| 75 |                        const SCVector3& grad,
 | 
|---|
| 76 |                        double value,
 | 
|---|
| 77 |                        SCVector3& result);
 | 
|---|
| 78 | };
 | 
|---|
| 79 | 
 | 
|---|
| 80 | }
 | 
|---|
| 81 | 
 | 
|---|
| 82 | #ifdef INLINE_FUNCTIONS
 | 
|---|
| 83 | #include <math/isosurf/volume_i.h>
 | 
|---|
| 84 | #endif
 | 
|---|
| 85 | 
 | 
|---|
| 86 | #endif
 | 
|---|
| 87 | 
 | 
|---|
| 88 | // Local Variables:
 | 
|---|
| 89 | // mode: c++
 | 
|---|
| 90 | // c-file-style: "CLJ"
 | 
|---|
| 91 | // End:
 | 
|---|