~ubuntu-branches/debian/squeeze/gmsh/squeeze

« back to all changes in this revision

Viewing changes to Plugin/ExtractEdges.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme
  • Date: 2009-09-02 18:12:15 UTC
  • mfrom: (1.2.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090902181215-yla8zvcas2ucvkm9
[Christophe Prud'homme]
* New upstream release
  + fixed surface mesh orientation bug introduced in 2.4.0;
  + mesh and graphics code refactoring;
  + small usability enhancements and bug fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
// bugs and problems to <gmsh@geuz.org>.
5
5
 
6
6
#include "ExtractEdges.h"
7
 
#include "BDS.h"
8
7
 
9
8
StringXNumber ExtractEdgesOptions_Number[] = {
10
9
  {GMSH_FULLRC, "Angle", NULL, 22.},
19
18
  }
20
19
}
21
20
 
22
 
GMSH_ExtractEdgesPlugin::GMSH_ExtractEdgesPlugin()
23
 
{
24
 
  ;
25
 
}
26
 
 
27
 
void GMSH_ExtractEdgesPlugin::getName(char *name) const
28
 
{
29
 
  strcpy(name, "Extract Edges");
30
 
}
31
 
 
32
 
void GMSH_ExtractEdgesPlugin::getInfos(char *author, char *copyright, char *help_text) const
33
 
{
34
 
  strcpy(author, "C. Geuzaine, J.-F. Remacle");
35
 
  strcpy(copyright, "C. Geuzaine, J.-F. Remacle");
36
 
  strcpy(help_text,
37
 
         "Plugin(ExtractEdges) extracts the geometry edges\n"
 
21
std::string GMSH_ExtractEdgesPlugin::getHelp() const
 
22
{
 
23
  return "Plugin(ExtractEdges) extracts the geometry edges\n"
38
24
         "from the surface view `iView', using `Angle' as\n"
39
25
         "the dihedral angle tolerance. If `iView' < 0, then\n"
40
26
         "plugin is run on the current view.\n"
41
27
         "\n"
42
 
         "Plugin(ExtractEdges) creates one new view.\n");
 
28
         "Plugin(ExtractEdges) creates one new view.\n";
43
29
}
44
30
 
45
31
int GMSH_ExtractEdgesPlugin::getNbOptions() const
52
38
  return &ExtractEdgesOptions_Number[iopt];
53
39
}
54
40
 
55
 
void GMSH_ExtractEdgesPlugin::catchErrorMessage(char *errorMessage) const
56
 
{
57
 
  strcpy(errorMessage, "Extract Edges failed...");
58
 
}
59
 
 
60
41
PView *GMSH_ExtractEdgesPlugin::execute(PView *v)
61
42
{
62
43
  int iView = (int)ExtractEdgesOptions_Number[1].def;
65
46
  PView *v1 = getView(iView, v);
66
47
  if(!v1) return v;
67
48
 
68
 
  PViewDataList *data1 = getDataList(v1);
69
 
  if(!data1) return v;
70
 
 
71
 
  PView *v2 = new PView(true);
72
 
 
 
49
  PViewData *data1 = v1->getData();
 
50
 
 
51
  PView *v2 = new PView();
73
52
  PViewDataList *data2 = getDataList(v2);
74
 
  if(!data2) return v;
75
53
 
76
 
  BDS_Mesh bds;
 
54
  //BDS_Mesh bds;
77
55
  //bds.import_view(v1, CTX::instance()->lc * 1.e-12);
78
56
  //bds.classify(angle * M_PI / 180.);
79
57
 
80
 
  Msg::Error("BDS->classify(angle, edge_prolongation) must be reinterfaced");
81
 
 
82
 
  std::list<BDS_Edge*>::iterator it  = bds.edges.begin();
83
 
  std::list<BDS_Edge*>::iterator ite = bds.edges.end();
84
 
  while (it != ite){
85
 
    BDS_GeomEntity *g = (*it)->g;
86
 
    if(g && g->classif_degree == 1) {
87
 
      List_Add(data2->SL, &(*it)->p1->X); List_Add(data2->SL, &(*it)->p2->X);
88
 
      List_Add(data2->SL, &(*it)->p1->Y); List_Add(data2->SL, &(*it)->p2->Y);
89
 
      List_Add(data2->SL, &(*it)->p1->Z); List_Add(data2->SL, &(*it)->p2->Z);
90
 
      double val = g->classif_tag;
91
 
      List_Add(data2->SL, &val);
92
 
      List_Add(data2->SL, &val);
93
 
      data2->NbSL++;
94
 
    }
95
 
    ++it;
96
 
  }
 
58
  Msg::Error("classify(angle, edge_prolongation) must be reinterfaced");
97
59
 
98
60
  data2->setName(data1->getName() + "_ExtractEdges");
99
61
  data2->setFileName(data1->getName() + "_ExtractEdges.pos");