Hi Petr:Overture is compiled in double precision by default so a realArray is an array of doubles.
To avoid too many temporaries you should can use the lower level "coefficients" functions that directly fill
in the coefficient matrix: (see tcm3.C for e.g.)op[grid].coefficients(MappedGridOperators::laplacianOperator,coeff[grid],I1,I2,I3);
If you need to form more complicated coefficient operators you may still need one temporary array to
store intermediate results such as in (see Oges.C : ) realSerialArray yyCoeff(M,Ib1,Ib2,Ib3); yyCoeff=0.;op[grid].assignCoefficients(MappedGridOperators::yyDerivative,yyCoeff,Ib1,Ib2,Ib3,0,0); // coeff[grid](M,Ib1,Ib2,Ib3)+=op[grid].yyCoefficients(Ib1,Ib2,Ib3)(M,Ib1,Ib2,Ib3); // add p.yy on axis
coeffLocal(M,Ib1,Ib2,Ib3)+=yyCoeff; // add p.yy on axisFor bigger systems (like the Navier-Stokes) we will directly fill in the coefficient matrix (in fortran usually) using macros but this is not so easy to explain. You also might be able to follow the tcmge.C example I sent out previously to fill in the coefficient matrix "by hand" if you know the coefficients.
I hope that helps. ...Bill Petr Hotmar wrote:
I would like to understand better if and how I can control filling of coefficient matrices and prevent generation of any additional unwanted arrays. Any ideas on how to modify the 'high-level' interface so as to increase memory efficiency?Having 140,000 grid points, 3D and 4 variables, I would expect the coefficient matrix (of floats) to be ~ 240MB. However, coeff.setIsACoefficientMatrix consumes 0.4GB and the subsequent filling (coeff=xCoefficients(...) etc.), specifically the scalar assignment#0 doubleMappedGridFunction::operator= (this=0xad7fa68, x=0) at doubleMappedGridFunction.C:2779 #1 0x011cbceb in GenericCompositeGridOperators::yCoefficients (this=0xbff94e80, C1=@0xbff98460, C2=@0xbff9844c, C3=@0x839e770, C4=@0x839e770) at GenericCompositeGridOperators.C:564,consumes my remaining 2GB (?!) of RAM, crashing with HEAP ERROR. Can I prevent this? Also, are the doubles being used instead of floats (the error mentions MDI_double_Allocate)?Thank you, PetrOn Sun, Mar 8, 2009 at 11:00 PM, Petr Hotmar <petr.hotmar@xxxxxxxxx <mailto:petr.hotmar@xxxxxxxxx>> wrote:Data overflow I'm solving a system of two simple Helmholtz equations on a single rectangular 3D grid using coefficient matrices. After relatively mild refinement of the grid (from 20x20x20 to 50x50x50 grid lines), the code crashes upon filling coeffs for interior points (coeff=op.laplacianCoefficients(0,0)+...) with: HEAP ERROR: Array_Data_Pointer == NULL in double*MDI_double_Allocate (Size = 79361856)!I understand the matrix is stored in sparse format, so I would assume the size of the problem to be still manageable even in the serial environment. Any ideas greatly welcome, Petr