// -*- FreeFem++ -*-
// Sample of SaveHB
// Author: fujiwara@acs.i.kyoto-u.ac.jp
mesh Th = square(3,3);
macro Grad(u) [dx(u),dy(u)] // EOM

fespace Vh(Th,P1);
varf vP(u,v) = int2d(Th)(Grad(u)'*Grad(v)) + int2d(Th)(v) + on(1,u=1);

matrix A = vP(Vh,Vh);
real[int] rhs = vP(0,Vh);

load "SaveHB" 
int ret = SaveHB("sample.hb", A, rhs, "sample of SaveHB");
A.CSR; 
cout << A << endl; 
cout << " A = " << A << endl;
cout << " rhs  = " << rhs << endl;

assert(ret == 0); 

// End of file
