[petsc-users] DMNetwork usage example

Abhyankar, Shrirang G. abhyshr at mcs.anl.gov
Wed Apr 8 23:40:55 CDT 2015


From:  Dharmendar Reddy <dharmareddy84 at gmail.com>
Date:  Wednesday, April 8, 2015 at 11:04 PM
To:  hong zhang <hzhang at mcs.anl.gov>
Cc:  PETSc users list <petsc-users at mcs.anl.gov>
Subject:  Re: [petsc-users] DMNetwork usage example


>Hello,
>
>           I have a few question regarding the usage.
>
>In DMNetworkRegisterComponent(DM dm,const char *name,PetscInt
>size,PetscInt *key)
>size - the storage size in bytes for this component data
>
>
>If i call it from fortran, is size then the number of components ?
>
>

I don¹t think the Fortran interface for DMNetwork works and neither have I
tested it.

>
>
>For example, if i have a network of nodes, I want to store the location
>of the node ( double precision :: x,y,z) in the component named
>"position", then is the call:
>
>
>
>call DMNetworkRegisterComponent(DM dm,"position", 3, positionkey, ierr)
>
>
>

The size parameter is the storage size component data. So if you have a
component position described by

struct position {
   double x,y,z;
};

then the call to DMNetworkRegisterComponent (in C) would be

DMNetworkRegisterComponent(dm,
<string_identifier>,sizeof(position),&positionkey);

I don¹t think I can get to making the Fortran interface work for DMNetwork
in the next couple of months. You can try to use DMPlex instead if you are
in urgent need of a Fortran interface for network problems. DMNetwork is
built on top of DMPlex and uses a lot of its elements to manage the
network layout and communication. Please read Chapter 17 in the manual.

> 
>
>I need to create a network. I know the number of nodes on network and the
>maximum number of neighbors any node can have. I can only add the node to
>node connections as few at a time.

I am not sure I understand. If you provide the number of nodes and a list
of node connectivity, DMNetwork will set up the network layout.

Shri


>
>
>
>Is this possible to do with DMNetowrk ?
>
>
>
>Reddy
>
>
>
>On Wed, Apr 8, 2015 at 10:07 PM, Hong <hzhang at mcs.anl.gov> wrote:
>
>See
>petsc/src/snes/examples/tutorials/network/pflow
>
>
>Hong
>
>
>On Wed, Apr 8, 2015 at 9:39 PM, Dharmendar Reddy
><dharmareddy84 at gmail.com> wrote:
>
>Hello,
>
>          Is there a Fortran or C code example illustrating the usage of
>DMNetwork ?
>
>
>
>Thanks
>
>Reddy
>
>
>
>
>
>
>
>
>
>
>



More information about the petsc-users mailing list