GFem language documentation -- 3.8.2 Saveall()

Previous: 3.8.1 plot, savemesh, save, load, loadmesh
Up: 3.8 Results

### 3.8.2 Saveall()

The purpose is to solve all the data for a PDE or a 2-system with only one instruction. It is meant for those who want to write their own solvers.

The syntax is:

    saveall('file_name', var_name1,...)

The syntax is exactly the same as that of `solve(,)` except that the first parameter is the file name. The other parameters are used only to indicate to the interpreter which is/are the unknown function.

The file format for the scalar equation (`laplace` is decomposed on `nuxx, nuyy`)

    u=p  if Dirichlet
    c u+dnu(u)=g if Neumann
    b u-dx(nuxx dx(u))-dx(nuxy dy(u))-dy(nuyx dx))-dy(nuyy dy(u))
     + a1 dx(u) + a2 dy(u) =f

is that each line has all the values for `x,y` being a vertex: `f, g, p, b, c, a1, a2, nuxx, nuxy, nuyx, nuyy`.

The actual routine is in C++

    int saveparam(fcts *param, triangulation* t, char *filename, int N)
    {
      int k, ns = t->np;
      ofstream file(filename);
      file<<ns<<"   "<<N<<endl;
      for(k=0; k<ns; k++)
      {
                    file << (param)->f[k]<<" " ; file<<"            ";
                    file << (param)->g[k]<<" " ; file<<"            ";
                    file << (param)->p[k]<<" " ; file<<"            ";
                    file << (param)->b[k]<<" " ; file<<"            ";
                    file << (param)->c[k]<<" " ; file<<"            ";
                    file << (param)->a1[k]<<" " ; file<<"           ";
                    file << (param)->a2[k]<<" " ; file<<"           ";
                    file << (param)->nuxx[k]<<" " ; file<<"         ";
                    file << (param)->nuxy[k]<<" " ; file<<"         ";
                    file << (param)->nuyx[k]<<" " ; file<<"         ";
                    file << (param)->nuyy[k]<<" " ; file<<"         ";
        file << endl;
      }
    }

The same function is used for complex coefficients, by overloading the operator <<:

    friend ostream& operator<<(ostream& os, const complex& a)
     {
       os<<a.re<<" " << a.im<<"             ";
       return os;
     }

For 2-systems also the same is used with

    ostream& operator<<(ostream& os, cvect& a)
      {
        for(int i=0; i<N;i++)
          os<<a[i]<<"  ";
        return os;
      }
    ostream& operator<<(ostream& os, cmat& a)
      {
        for(int i=0; i<N;i++)
         for(int j=0; j<N;j++)
           os<<a(i,j)<<"  ";
        return os;
      }

where `N=2` .

A Dirichlet condition is applied whenever p[k](?). ( Dirichlet conditions with value `0` are changed to value `1e-10` )