File: DiscreteSF.h

package info (click to toggle)
madlib 1.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,196 kB
  • sloc: cpp: 39,851; sh: 10,041; makefile: 473
file content (106 lines) | stat: -rw-r--r-- 3,451 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// -*- C++ -*-
// -------------------------------------------------------------------
// MAdLib - Copyright (C) 2008-2009 Universite catholique de Louvain
//
// See the Copyright.txt and License.txt files for license information. 
// You should have received a copy of these files along with MAdLib. 
// If not, see <http://www.madlib.be/license/>
//
// Please report all bugs and problems to <contrib@madlib.be>
//
// Authors: Gaetan Compere, Jean-Francois Remacle
// -------------------------------------------------------------------

#ifndef _H_DISCRETESF
#define _H_DISCRETESF

#include "SizeFieldBase.h"

#include <string>

namespace MAd {

  // -------------------------------------------------------------------
  enum DiscreteSFType {
    UNKNOWN_DSFTYPE,
    VERTEX_P1_DSFTYPE
  };

  // -------------------------------------------------------------------
  class DiscreteSF : public SizeFieldBase
  {
  public:

    DiscreteSF(pMesh, std::string name="");
    ~DiscreteSF();

    sFieldType getType() const { return DISCRETESFIELD; }
    virtual DiscreteSFType discretization() const = 0;
    pMesh getMesh() { return mesh; }

    // delete sizes
    virtual void cleanUp() = 0;
    void deleteSize(pEntity);

    // Intersect with another size field
    virtual void intersect(const pSField) = 0;

    // smooth the size field
    virtual void smooth(double) = 0;

    // set a size at all vertices 
    virtual void setCurrentSize() = 0;
    virtual void setCurvatureSize(bool aniso, 
                                  double alpha=2., // prescribe 2*PI*alpha edges around a circle
                                  double hMin=1.e-4) = 0; // minimal size
    virtual void setAllVSizes(pMSize) = 0;
    virtual void setAllVSizes(double[3][3], double[3]) = 0;
    virtual void setAllVSizes(double) = 0;
    virtual void scale(double) = 0;

    // set the size at a vertex 
    void setSize(pEntity, double[3][3], double[3]);
    void setSize(pEntity, pMSize);
    void setSize(pEntity, double);
    void setSize(int, double);

    // get the size at a location (allocate space!)
    virtual pMSize getSize(const pVertex) const = 0;
    virtual pMSize getSizeOnEntity(const pEntity, const double[3]) const = 0;

    // get the size at a vertex (do not allocate space)
    virtual const pMSize findSize(const pVertex) const = 0;
    virtual pMSize findSize(const pVertex) = 0;

    // edge length (squared)
    virtual double SF_VV_lengthSq(const pVertex, const pVertex) const = 0;
    virtual double SF_XYZ_lengthSq(const double[3], const double[3],
                                   const pMSize, const pMSize=NULL) const = 0;

    // face area (squared)
    virtual double SF_F_areaSq(const pFace) const = 0;
    virtual double SF_XYZ_areaSq(const double[3][3], const pMSize,
                                 const double[3]) const = 0;
    
    // region volume
    virtual double SF_R_volume(const pRegion) const = 0;
    virtual double SF_XYZ_volume(const double[4][3], const pMSize) const = 0;

    // center and its associated size
    virtual double SF_E_center(const pEdge, double[3], double *reducSq, pMSize *) const = 0;
    virtual double SF_VV_center(const pVertex, const pVertex,
                                double[3], double *reducSq, pMSize *) const = 0;

  protected:

    pMesh mesh;
    int dim;
    pMeshDataId pMSizeFieldId;

  };

}

// -------------------------------------------------------------------

#endif