コード例 #1
0
        /// <summary>
        /// see <see cref="IMonkeyImplicitPrecond.CreateTempObjects"/>
        /// </summary>
        public override void CreateTempObjects(VectorBase x, VectorBase b, MatrixBase mtx, Device dev)
        {
            if (!x.IsLocked)
            {
                throw new ArgumentException("x must be locked.", "x");
            }
            if (!b.IsLocked)
            {
                throw new ArgumentException("b must be locked.", "b");
            }
            if (!mtx.IsLocked)
            {
                throw new ArgumentException("mtx must be locked.", "mtx");
            }

            m_Matrix   = mtx;
            m_PcInput  = b;
            m_PcOutput = x;

            // create objects
            // ==============

            _xComm = x.CreateCommVector(mtx);
            tmp    = m_Device.CreateVector(m_PcOutput.Part);

            // lock objects
            // ============
            tmp.Lock();
            m_InvDiag.Lock();
        }
コード例 #2
0
ファイル: NeumannSeries.cs プロジェクト: xyuan/BoSSS
        /// <summary>
        /// This function creates the needed temporary objects according to the given parameters
        /// </summary>
        /// <param name="pc_output">The output vector</param>
        /// <param name="pc_input">The input vector</param>
        /// <param name="mtx">The matrix that is to be multiplied</param>
        /// <param name="dev"></param>
        public override void CreateTempObjects(VectorBase pc_output, VectorBase pc_input, MatrixBase mtx, Device dev)
        {
            if (!pc_output.IsLocked)
            {
                throw new ArgumentException("pc_output must be locked.", "pc_output");
            }
            if (!pc_input.IsLocked)
            {
                throw new ArgumentException("pc_input must be locked.", "pc_input");
            }
            if (!mtx.IsLocked)
            {
                throw new ArgumentException("mtx must be locked.", "mtx");
            }

            mPcInput  = pc_input;
            mPcOutput = pc_output;
            m_matrix  = mtx;

            //the temporary objects
            yOld   = m_Device.CreateVector(mPcInput.Part);
            yNew   = m_Device.CreateVector(mPcInput.Part);
            _yComm = yOld.CreateCommVector(m_matrix);
            //lock the temporary objects:
            yOld.Lock();
            yNew.Lock();
        }
コード例 #3
0
        /// <summary>
        /// sets the matrix of the solver
        /// </summary>
        virtual public void DefineMatrix(IMutableMatrixEx _M)
        {
            using (new FuncTrace()) {
                MsrMatrix M = _M as MsrMatrix;
                if (M == null)
                {
                    // provisorium, geht sicher besser
                    M = _M.ToMsrMatrix();
                }


                if (M.RowPartitioning.TotalLength != M.NoOfCols)
                {
                    throw new ArgumentException("Matrix has to be quadratic.", "_M");
                }
                m_Matrix = Device.CreateMatrix(M, m_MatrixType);
            }
        }
コード例 #4
0
ファイル: CommVector.cs プロジェクト: xyuan/BoSSS
            internal CommVector(MatrixBase M, VectorBase owner)
            {
                if (!owner.Part.Equals(M.ColPartition))
                {
                    throw new ArgumentException("column partition of matrix must be equal to partion of vector", "M");
                }
                m_Mtx   = M;
                m_Owner = owner;

                // allocate receive buffers
                int i = 0;

                RecvBuffersLock = new GCHandle[m_Mtx._SpmvCommPattern.NoOfReceivedEntries.Keys.Count];
                foreach (int proc in m_Mtx._SpmvCommPattern.NoOfReceivedEntries.Keys)
                {
                    double[] RecvBuffer = new double[m_Mtx._SpmvCommPattern.NoOfReceivedEntries[proc]];
                    RecvBuffers.Add(proc, RecvBuffer);
                    RecvBuffersLock[i] = GCHandle.Alloc(RecvBuffer, GCHandleType.Pinned);
                    i++;
                }
            }
コード例 #5
0
ファイル: CommVector.cs プロジェクト: xyuan/BoSSS
 /// <summary>
 /// creates ma communication vector object for the given matrix <paramref name="M"/>, i.e.
 /// an vector that can be multiplied with <paramref name="M"/>
 /// </summary>
 abstract public CommVector CreateCommVector(MatrixBase M);
コード例 #6
0
ファイル: Precond.cs プロジェクト: xyuan/BoSSS
 /// <summary>
 /// called after by the hosting solver before it starts,
 /// to provide configuration and the possibility th create temporary objects
 /// </summary>
 /// <param name="pc_output">
 /// Here, the hosting solver expects the result of the precondioning;
 /// see <see cref="DoPrecond"/>;
 /// </param>
 /// <param name="pc_input">
 /// Here, the hosting solver will place the input vector for the precondioning;
 /// see <see cref="DoPrecond"/>;
 /// </param>
 /// <param name="mtx"></param>
 /// <param name="dev"></param>
 abstract public void CreateTempObjects(VectorBase pc_output, VectorBase pc_input, MatrixBase mtx, Device dev);