Example #1
0
 public static void SetEntry(ref int _ref, ref int i, ref int j, ref double val, out int ierr)
 {
     ierr = 0;
     try {
         IMutableMatrix M = (IMutableMatrix)Infrastructure.GetObject(_ref);
         M[i, j] = val;
     } catch (Exception e) {
         ierr = Infrastructure.ErrorHandler(e);
     }
 }
Example #2
0
 public static void GetLocLen(ref int _ref, out int LocLen, out int ierr)
 {
     ierr   = 0;
     LocLen = -1;
     try {
         ISparseMatrix M = (ISparseMatrix)Infrastructure.GetObject(_ref);
         LocLen = M.RowPartitioning.LocalLength;
     } catch (Exception e) {
         ierr = Infrastructure.ErrorHandler(e);
     }
 }
Example #3
0
 public static void GetI0(ref int _ref, out int i0, out int ierr)
 {
     ierr = 0;
     i0   = -1;
     try {
         ISparseMatrix M = (ISparseMatrix)Infrastructure.GetObject(_ref);
         i0 = (int)M.RowPartitioning.i0;
     } catch (Exception e) {
         ierr = Infrastructure.ErrorHandler(e);
     }
 }
Example #4
0
 public static void GetMPIsize(ref int _ref, out int MPIsize, out int ierr)
 {
     ierr    = 0;
     MPIsize = -1;
     try {
         IPartitioning p = (IPartitioning)Infrastructure.GetObject(_ref);
         MPIsize = (int)p.MpiSize;
     } catch (Exception e) {
         ierr = Infrastructure.ErrorHandler(e);
     }
 }
Example #5
0
 public static void GetLocLen(ref int _ref, out int LocLen, out int ierr)
 {
     ierr   = 0;
     LocLen = -1;
     try {
         IPartitioning p = (IPartitioning)Infrastructure.GetObject(_ref);
         LocLen = (int)p.LocalLength;
     } catch (Exception e) {
         ierr = Infrastructure.ErrorHandler(e);
     }
 }
Example #6
0
 public static void GetI0(ref int _ref, out int i0, out int ierr)
 {
     ierr = 0;
     i0   = -1;
     try {
         IPartitioning p = (IPartitioning)Infrastructure.GetObject(_ref);
         i0 = (int)p.i0;
     } catch (Exception e) {
         ierr = Infrastructure.ErrorHandler(e);
     }
 }
Example #7
0
 public static void GetRowPart(ref int MtxRef, out int PartRef, out int ierr)
 {
     ierr    = 0;
     PartRef = -1;
     try {
         ISparseMatrix M = (ISparseMatrix)Infrastructure.GetObject(MtxRef);
         PartRef = Infrastructure.RegisterObject(M.RowPartitioning);
     } catch (Exception e) {
         ierr = Infrastructure.ErrorHandler(e);
     }
 }
Example #8
0
        unsafe public static void SaveToTextFileSparseF(ref int _ref, byte *termchar, byte *path, out int ierr)
        {
            ierr = 0;
            try {
                string _path = Infrastructure.FortranToDotNET(path, *termchar);

                IMutableMatrixEx M = (IMutableMatrixEx)Infrastructure.GetObject(_ref);
                M.SaveToTextFileSparse(_path);
            } catch (Exception e) {
                ierr = Infrastructure.ErrorHandler(e);
            }
        }
Example #9
0
 unsafe public static void SaveToTextFileSparse(ref int _ref, byte *path, out int ierr)
 {
     ierr = 0;
     try {
         string           _paht = Marshal.PtrToStringAnsi((IntPtr)path);
         IMutableMatrixEx M     = (IMutableMatrixEx)Infrastructure.GetObject(_ref);
         //Console.WriteLine("saving: >" + _paht + "<");
         M.SaveToTextFileSparse(_paht);
     } catch (Exception e) {
         ierr = Infrastructure.ErrorHandler(e);
     }
 }
Example #10
0
 /// <summary>
 /// releases all C# - references on an object, making it ready for garbage-collection.
 /// </summary>
 public static void ReleaseObject(ref int _ref, out int ierr)
 {
     ierr = 0;
     try {
         object o = Infrastructure.GetObject(_ref);
         if (o is IDisposable)
         {
             ((IDisposable)o).Dispose();
         }
         Infrastructure.ForgetObject(_ref);
     } catch (Exception e) {
         ierr = Infrastructure.ErrorHandler(e);
     }
 }
Example #11
0
        unsafe public static void Laplacian(ref int GridRef,
                                            ref int DgDegree,

                                            out int ierr)
        {
            try {
                // grid, etc
                // =========

                GridData grd = (GridData)(Infrastructure.GetObject(GridRef));

                var b   = new Basis(grd, DgDegree);
                var map = new UnsetteledCoordinateMapping(b);

                var L  = new Laplace(1.3, grd.Cells.cj);
                var op = new SpatialOperator(1, 0, 1, QuadOrderFunc.Linear(), "T", "c1");
                op.EquationComponents["c1"].Add(L);
                op.Commit();

                // evaluate operator
                // =================

                var      Mtx = new BlockMsrMatrix(map, map);
                double[] B   = new double[map.LocalLength];

                var eval = op.GetMatrixBuilder(map, null, map);
                eval.ComputeMatrix(Mtx, B);

                // return data
                // ===========

                throw new NotImplementedException("todo");
            } catch (Exception e) {
                ierr = Infrastructure.ErrorHandler(e);
            }
            ierr = 0;
        }