[petsc-users] Static Library based app for petsc
Abhishek G.S.
gsabhishek1ags at gmail.com
Tue Aug 24 23:59:32 CDT 2021
Thanks for the reply.
On Wed, 25 Aug 2021 at 10:01, Jed Brown <jed at jedbrown.org> wrote:
> PETSc does not "wrap" cout.
>
What I meant here is that petsc has a custom output stream through
PetscPrintf. I was wondering if that might have affected the stdout and
hence the no print. The constructor in the libTest/include/test.h was just
supposed to print a string when called in the benchmarks/Test1/main.cpp
> Creating a library first, with an executable front-end that most/all
> initial users will use is generally good design. More users of the library
> emerge as people try to do more advanced/custom things that are not
> appropriate to do with the executable.
>
Ok... This makes sense. (It would be great if you could point me towards
some project whose structure I can borrow.)
Why I did what I did was that if the petsc environment is encapsulated in
the library, the rest of the code in the main.cpp would be outside. Since I
was writing a code for a very small audience(mostly me) I thought it would
be easier to debug if I was inside the petsc environment.
>
> "Abhishek G.S." <gsabhishek1ags at gmail.com> writes:
>
> > Hi,
> > I am trying to develop a static-library-based app using petsc. The
> > structure goes as,
> > .
> > ├── benchmarks
> > │ └── Test1
> > │ ├── main.cpp
> > │ └── Makefile
> > └── libTest
> > ├── build
>
> Are build products meant to go into this build/ directory, not under lib/
> as you have it?
>
I routed the static library output to the libTest/lib folder in the
libTest/CMakeLists.txt.
The /benchmarks/Test1/Makefile includes this to the ld path
>
> > ├── CMakeLists.txt
> > ├── include
> > │ ├── test.cpp
>
> cpp files would usually go under src/ or almost anywhere but in include/
>
noted.
>
> > │ └── test.h
> > └── lib
> > └── libTest.a
> >
> > While this code compiles, I am unable to create a minimal working example
> > for the same. The aim is to just print "Hello World". Why is it that
> > nothing prints?. Is it something to do with the PETSC wrapper for cout?
> > Also, I would like to know whether it's a good idea to go ahead with this
> > kind of code structure.
> >
> > Thanks for the help.
> >
> > Code: https://github.com/gsabhishek/PetscStaticLibraryApp.git
> >
> > Thanks for the help
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210825/bb9e94ca/attachment.html>
More information about the petsc-users
mailing list