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

« back to all changes in this revision

Viewing changes to Numeric/gmshAssembler.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme
  • Date: 2009-07-13 15:49:21 UTC
  • mfrom: (7.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090713154921-zer07j8wixwa07ig
Tags: 2.3.1.dfsg-4
[Christophe Prud'homme]
* Bug fix: "gmsh with cgns write support", thanks to Oliver Borm
  (Closes: #529972).
* debian/rules: make sure that Gmsh is built with occ support on all
  platforms thanks to Denis Barbier (#536435).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
2
 
//
3
 
// See the LICENSE.txt file for license information. Please report all
4
 
// bugs and problems to <gmsh@geuz.org>.
5
 
 
6
 
#include "MVertex.h"
7
 
#include "gmshAssembler.h"
8
 
#include "gmshLinearSystem.h"
9
 
 
10
 
void gmshAssembler::assemble(MVertex *vR, int iCompR, int iFieldR,
11
 
                             MVertex *vC, int iCompC, int iFieldC,
12
 
                             double val)
13
 
{
14
 
  if (!lsys->isAllocated()){
15
 
    lsys->allocate(numbering.size());
16
 
  }
17
 
 
18
 
  std::map<gmshDofKey, int>::iterator itR = numbering.find(gmshDofKey(vR, iCompR, iFieldR));
19
 
  if (itR != numbering.end()){
20
 
    std::map<gmshDofKey, int>::iterator itC = numbering.find(gmshDofKey(vC, iCompC, iFieldC));
21
 
    if (itC != numbering.end()){
22
 
      lsys->addToMatrix(itR->second, itC->second, val);
23
 
    }
24
 
    else {
25
 
      std::map<gmshDofKey, double>::iterator itF = fixed.find(gmshDofKey(vC, iCompC, iFieldC));
26
 
      if (itF != fixed.end()){
27
 
        lsys->addToRightHandSide(itR->second, -val*itF->second);
28
 
      }
29
 
      else{
30
 
        std::map<gmshDofKey, std::vector<std::pair<gmshDofKey, double> > >::iterator itConstrC =
31
 
          constraints.find(gmshDofKey(vC, iCompC, iFieldC));
32
 
        if (itConstrC != constraints.end()){
33
 
          for (unsigned int i = 0; i < itConstrC->second.size(); i++){
34
 
            gmshDofKey &dofKeyConstrC = itConstrC->second[i].first;
35
 
            double valConstrC = itConstrC->second[i].second;
36
 
            assemble(vR, iCompR, iFieldR,
37
 
                     dofKeyConstrC.v,dofKeyConstrC.comp, dofKeyConstrC.field,
38
 
                     val * valConstrC);
39
 
          }
40
 
        }
41
 
      }
42
 
    }
43
 
  }
44
 
  else{
45
 
    std::map<gmshDofKey, std::vector<std::pair<gmshDofKey, double> > >::iterator itConstrR =
46
 
      constraints.find(gmshDofKey(vR, iCompR, iFieldR));
47
 
    if (itConstrR != constraints.end()){
48
 
      for (unsigned int i = 0; i < itConstrR->second.size(); i++){
49
 
        gmshDofKey &dofKeyConstrR = itConstrR->second[i].first;
50
 
        double valConstrR = itConstrR->second[i].second;
51
 
        assemble(dofKeyConstrR.v,dofKeyConstrR.comp, dofKeyConstrR.field,
52
 
                 vC, iCompC, iFieldC,
53
 
                 val * valConstrR);
54
 
      }
55
 
    }
56
 
  }
57
 
}
58
 
 
59
 
void gmshAssembler::assemble(MVertex *vR, int iCompR, int iFieldR,
60
 
                             double val)
61
 
{
62
 
  if (!lsys->isAllocated())lsys->allocate(numbering.size());
63
 
  std::map<gmshDofKey, int>::iterator itR = numbering.find(gmshDofKey(vR, iCompR, iFieldR));
64
 
  if (itR != numbering.end()){
65
 
    lsys->addToRightHandSide(itR->second, val);
66
 
  }
67
 
}
68