[petsc-users] DMPlexCreateLocalVec Within a function

Jed Brown jed at jedbrown.org
Sat Apr 16 03:21:41 CDT 2016

Matthew Kury <mkury at berkeley.edu> writes:

> 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) ;

This function doesn't exist, and neither does DMPlexCreateLocalVec (from
the subject of your email), but when I gaze into my crystal ball, it
says you're probably spelling it DMGetLocalVector.  Please send the full
error message.

> 		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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160416/297f14a1/attachment.pgp>

More information about the petsc-users mailing list