Hello, 

        I have done some reading and I have not been able to find out what the 
proper way to create and use vectors within a function.

        If I have a function that passes in dm and V then: 
+++
                DMPlexGetLocalVec(dm, &VLocal) ;
                DMGlobalToLocalBegin(dm,V,INSERT_VALUES,VLocal); 
                DMGlobalToLocalEnd(dm,V,INSERT_VALUES,VLocal) ;

                VecGetArray(VLoc,VLocalArray);

                “Stuff with VLocalArray”

                VecRestoreArray(VLoc,VLocalArray);
                
                DMLocalToGlobalBegin(dm,VLocal,ADD_VALUES,V);
                DMLocalToGlobalEnd(dm,VLocal,ADD_VALUES,V);

                DMRestoreLocalVector(dm,&VLocal);
+++

        The second time I call the function I get errors with the VecGetArray() 
function.  I would appreciate any advice as to what is going wrong. 

Thank you, 

Matthew

Reply via email to