Re: [petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Junchao Zhang
rs@mcs.anl.gov > *Subject:* Re: [petsc-users] Reading Vectors from a PETSc Vec > > > > On Mon, Nov 14, 2022 at 7:50 PM Mohammad Ali Yaqteen > wrote: > > I am using Eigen library to which I have to write these vector values from > PETSc Vec. tdof is the length of the

Re: [petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Mohammad Ali Yaqteen
: petsc-users@mcs.anl.gov Subject: Re: [petsc-users] Reading Vectors from a PETSc Vec On Mon, Nov 14, 2022 at 7:50 PM Mohammad Ali Yaqteen mailto:mhyaqt...@sju.ac.kr>> wrote: I am using Eigen library to which I have to write these vector values from PETSc Vec. tdof is the length of the

Re: [petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Matthew Knepley
On Mon, Nov 14, 2022 at 7:50 PM Mohammad Ali Yaqteen wrote: > I am using Eigen library to which I have to write these vector values from > PETSc Vec. tdof is the length of the vector that I need and ei is the > number of value in as an index: > > PetscIntei[tdof]; > Pets

Re: [petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Mohammad Ali Yaqteen
I am using Eigen library to which I have to write these vector values from PETSc Vec. tdof is the length of the vector that I need and ei is the number of value in as an index: PetscIntei[tdof]; PetscScalar eveci[tdof]; for (int i = 0; i < tdof; i++) ei[i] = i; if (ncon

Re: [petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Matthew Knepley
On Mon, Nov 14, 2022 at 7:39 PM Mohammad Ali Yaqteen wrote: > I am using the following procedure to read from Vec, but it keeps giving > me the same values! I was told that using VecGetValues gives wrog output. > By who? It does not give the wrong output. You do not show where in the code you d

[petsc-users] Reading Vectors from a PETSc Vec

2022-11-14 Thread Mohammad Ali Yaqteen
I am using the following procedure to read from Vec, but it keeps giving me the same values! I was told that using VecGetValues gives wrog output. If not this, then what function should be used to read the contents of a vector? for (int i = 0; i < nconv; i++) { PetscCall(EPSG

Re: [petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Medane TCHAKOROM
e: It does not apply, because "their communicator must be on the same set of processes" . In my case, I have two disjoint subcomm from PETSC_COMM_WORD with same number of processes. I want to send information (Petsc Vec) from one subcomm t

Re: [petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Junchao Zhang
> >> Re: >> >> >> It does not apply, because "their communicator must be on the same set >> of processes" . >> >> In my case, I have two disjoint subcomm from PETSC_COMM_WORD with same >> number of processes. >> >> I want to

Re: [petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Medane TCHAKOROM
: Re: It does not apply, because "their communicator must be on the same set of processes" . In my case, I have two disjoint subcomm from PETSC_COMM_WORD with same number of processes. I want to send information (Petsc Vec) from one subcomm to another

Re: [petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Medane TCHAKOROM
Re: Please, could you if possible, provide a basic example code. I do not understand how to "go to the supercommunicator, incorporating these two groups and use VecScatter" Another question is: If I was to use "MPI calls", can I use Petsc Vec as a buffer ? If so,

Re: [petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Junchao Zhang
gt; processes" . > > In my case, I have two disjoint subcomm from PETSC_COMM_WORD with same > number of processes. > > I want to send information (Petsc Vec) from one subcomm to another subcomm. > > Thanks > On 16/02/2022 15:43, Junchao Zhang wrote: > > S

Re: [petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Matthew Knepley
ith same > number of processes. > > I want to send information (Petsc Vec) from one subcomm to another subcomm. > The way I do this is to go to the supercommunicator, incorporating these two groups and use VecScatter. The alternative is just to use custom MPI calls as you say. T

Re: [petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Medane TCHAKOROM
Re: It does not apply, because "their communicator must be on the same set of processes" . In my case, I have two disjoint subcomm from PETSC_COMM_WORD with same number of processes. I want to send information (Petsc Vec) from one subcomm to another subcomm. Thanks On 16/02/

Re: [petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Junchao Zhang
e in differents communicators. Does > VecScatter functionnality still applies ? > > Thanks. > On 16/02/2022 15:03, Matthew Knepley wrote: > > On Wed, Feb 16, 2022 at 8:55 AM Medane TCHAKOROM < > medane.tchako...@univ-fcomte.fr> wrote: > >> Hello, >> >> I want

Re: [petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Medane TCHAKOROM
Re: I forgot to mention that the nodes are in differents communicators. Does VecScatter functionnality still applies ? Thanks. On 16/02/2022 15:03, Matthew Knepley wrote: On Wed, Feb 16, 2022 at 8:55 AM Medane TCHAKOROM wrote: Hello, I want to pass a Petsc Vec from one node to

Re: [petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Matthew Knepley
On Wed, Feb 16, 2022 at 8:55 AM Medane TCHAKOROM < medane.tchako...@univ-fcomte.fr> wrote: > Hello, > > I want to pass a Petsc Vec from one node to another one. Is there any > Petsc method for doing this > You likely want the VecScatter functionality. There is a discussion

[petsc-users] Nodes Communication - Petsc Vec

2022-02-16 Thread Medane TCHAKOROM
Hello, I want to pass a Petsc Vec from one node to another one. Is there any Petsc method for doing this or should I use MPI_Irecv and MPI_Isend for non-blocking communication ? When using MPI_Isend, can i send a Petsc Vec, or should I get the array from it, and then send it ? Thanks

Re: [petsc-users] Store type (Eigen::Vector2d) in a petsc vec

2019-02-05 Thread Jed Brown via petsc-users
Andrew Parker writes: > Thanks, so you would suggest a flat vector storing u, v, w (or indeed x, y, > z) or interleaved and then construct eigen types on the fly? Interleaved if you want to use Eigen types in the same memory, or if your code (like most applications) benefits more from memory l

Re: [petsc-users] Store type (Eigen::Vector2d) in a petsc vec

2019-02-05 Thread Andrew Parker via petsc-users
wrote: > My suggestion is to use PETSc like usual and inside your > residual/Jacobian evaluation, for each cell or batch of cells, create > Eigen objects. For size 2d or 3d, it won't matter much whether you make > them share memory with the PETSc Vec -- the Eigen types should mostl

Re: [petsc-users] Store type (Eigen::Vector2d) in a petsc vec

2019-02-05 Thread Jed Brown via petsc-users
My suggestion is to use PETSc like usual and inside your residual/Jacobian evaluation, for each cell or batch of cells, create Eigen objects. For size 2d or 3d, it won't matter much whether you make them share memory with the PETSc Vec -- the Eigen types should mostly exist in registers. A

Re: [petsc-users] Query regarding accessing data in a Petsc Vec object

2014-09-28 Thread Patrick Sanan
Note that PETSc is designed to hide the details of the implementations from you (It's in C, but uses the techniques of Object-Oriented programming that you might be more familiar with in C++), so normal use would never require the user to know anything about the way PETSc objects represent data

Re: [petsc-users] Query regarding accessing data in a Petsc Vec object

2014-09-28 Thread Anton Popov
On 9/28/14 1:57 PM, Parvathi M.K wrote: I want to access the data stored in the vec object directly without using any functions. Is this possible? I tried using something like p->hdr._ in a printf statement (where p is a vector). I wish to know which element of the _p_Vec structure stores th

Re: [petsc-users] Query regarding accessing data in a Petsc Vec object

2014-09-28 Thread Parvathi M.K
I want to access the data stored in the vec object directly without using any functions. Is this possible? I tried using something like p->hdr._ in a printf statement (where p is a vector). I wish to know which element of the _p_Vec structure stores the data. On Sun, Sep 28, 2014 at 4:45 PM, Par

Re: [petsc-users] Query regarding accessing data in a Petsc Vec object

2014-09-28 Thread Anton Popov
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecGetArray.html On 9/28/14 1:15 PM, Parvathi M.K wrote: Hey, I am fairly new to PetSc. I was just curious as to how you can directly access the data stored in a Petsc object, say a vector without using VecGetValues(). I've gone

[petsc-users] Query regarding accessing data in a Petsc Vec object

2014-09-28 Thread Parvathi M.K
Hey, I am fairly new to PetSc. I was just curious as to how you can directly access the data stored in a Petsc object, say a vector without using VecGetValues(). I've gone through the header files, petscimpl.h and vecimpl.h which contain the definitions of the PetscObject and Vec structures. I ca

Re: [petsc-users] question about the PETSc Vec object and C++ destructors

2014-02-05 Thread Vijay S. Mahadevan
> is done, the destructor of the temporary object is called. Also note that > since you have not implemented an assignment operator for your class, the > default is tiled which merely copies `x` which is most certainly what you > want since in PETSc `Vec` is simply an opaque pointer. Th

Re: [petsc-users] question about the PETSc Vec object and C++ destructors

2014-02-05 Thread Mohammad Mirzadeh
certainly what you want since in PETSc `Vec` is simply an opaque pointer. This means to properly be able to copy one `thing` to another you need to implement the assignment operator and most probably also the copy ctor . See http://stackoverflow.com/questions/4172722/what-is-the-rule-of-threefor more de

Re: [petsc-users] question about the PETSc Vec object and C++ destructors

2014-02-05 Thread Matthew Knepley
On Wed, Feb 5, 2014 at 8:02 PM, David Liu wrote: > Hi, this is a question mainly to clear up my understanding of what the Vec > object is. Consider the following C++ code: > > //= > > #include > > > class thing{ > > public: > Vec x; > thing(){}; > thing(int N){ > PetscPr

[petsc-users] question about the PETSc Vec object and C++ destructors

2014-02-05 Thread David Liu
Hi, this is a question mainly to clear up my understanding of what the Vec object is. Consider the following C++ code: //= #include class thing{ public: Vec x; thing(){}; thing(int N){ PetscPrintf(PETSC_COMM_WORLD, "x before create = %i\n", x); VecCreateSeq(PETSC_COMM

[petsc-users] How to get a duoble array into petsc Vec?

2011-05-20 Thread Dürrwang, Jürgen
vector. I tried to loop over each element like this petsc Vec[i] = double array[i], but I need a cast for that?.has anybody an idea? Thanks J?rgen -- next part -- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachme

[petsc-users] How to get a duoble array into petsc Vec?

2011-05-19 Thread Dürrwang, Jürgen
Hi, I am trying to put data form a double c array to an petsc vector. I tried to loop over each element like this petsc Vec[i] = double array[i], but I need a cast for thathas anybody an idea? Thanks J?rgen -- next part -- An HTML attachment was scrubbed... URL

[petsc-users] How to get a duoble array into petsc Vec?

2011-05-19 Thread Shri
element like this petsc Vec[i] = double array[i], but I need a cast for that?.has anybody an idea? Thanks J?rgen -- next part -- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110519/860007f8/attachment.htm>

[petsc-users] How to get a duoble array into petsc Vec?

2011-05-19 Thread Matthew Knepley
2011/5/19 D?rrwang, J?rgen > Hi, > > > > I am trying to put data form a double c array to an petsc vector. I tried > to loop over each element like this petsc Vec[i] = double array[i], but I > need a cast for that?.has anybody an idea? > http://www.mcs.anl.gov/petsc/

[petsc-users] How to get a duoble array into petsc Vec?

2011-05-19 Thread Morlighem, Mathieu (334H-Affiliate)
Try this instead: for(i=0;ihttp://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110519/26c424d2/attachment.htm>

Petsc Vec

2007-06-30 Thread Aron Ahmadia
Hi David, You're looking to use a PetscViewer. I see that there's not much in the user's manual on how to use them, but the basic idea is that you create a binary or ascii viewer (PetscViewerASCIIOpen, PetscViewerBinaryOpen), then call VecView to save it to disk. The inverse call is VecLoad. I

Petsc Vec

2007-06-30 Thread David Fuentes
Hello, I would like to write a Vec to a file and read it in at a later point in time. Are there any utilities in Petsc to do this? thank you, David Fuentes