>I ran make -n example-opt in the section of examples on eigenproblems_ex2, made a copy of eigenproblems_ex2, >changed the name of the original eigenproblems_ex2 to realeigenproblems_ex2, and put my .C file in the new folder called >eigenproblems_ex2 in , deleting the old .C file that was there (I changed the name of my .C file to eigenproblems_ex2.C). I >then tried running the code that I obtained as output from make -n example-opt and obtained the following responses:
The response is different now since it turned out I accidentally had the original .C file still in this one so I moved my .C file in and got a different series of errors. On Tue, Aug 9, 2016 at 12:54 PM, Harry Pearce <harroontheg...@gmail.com> wrote: > > The program I ran wasn't in the libmesh directory when I ran it. I just > compiled it with: > > mpicxx -o HPeigenproblems_PZ_8_2_16_2 HPeigenproblems_PZ_8_2_16_2.C -lz > -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lmesh_opt -I/usr/local/include > -pthread -I/usr/local/include -std=gnu++11 -O2 -felide-constructors > -funroll-loops -fstrict-aliasing -Wdisabled-optimization -fopenmp > > So I would think this would mean that libmesh could still have SLEPc. > Additionally I looked in the configure.log file within libmesh-1.0.0-rc1 > and it didn't look like SLEPc was missing. The real example files (The ones > that came with libmesh) ran fine. > > I ran make -n example-opt in the section of examples on eigenproblems_ex2, > made a copy of eigenproblems_ex2, changed the name of the original > eigenproblems_ex2 to realeigenproblems_ex2, and put my .C file in the new > folder called eigenproblems_ex2 in , deleting the old .C file that was > there (I changed the name of my .C file to eigenproblems_ex2.C). I then > tried running the code that I obtained as output from make -n example-opt > and obtained the following responses: > > My input: /opt/libmesh-1.0.0-rc1/examples/eigenproblems/eigenproblems_ex2$ > sudo echo " CXX " example_opt-eigenproblems_ex2.o;mpicxx > -DHAVE_CONFIG_H -I. -I../../../include -DNDEBUG > -I/opt/slepc-3.7.0/include -I/opt/slepc-3.7.0/arch-linux2-c-debug/include > -I/opt/petsc-3.7.1/include -I/opt/petsc-3.7.1/arch-linux2-c-debug/include > -I/usr/include/mpich -I/usr/local/include -I../../../include > -I../../../contrib/nanoflann/include -I../../../contrib/fparser > -I../../../contrib/libHilbert/include -I../../../contrib/nemesis/v5.22/nemesis > -I../../../contrib/exodusii/v5.22/exodus/cbind/include > -I../../../contrib/netcdf/v4/include -I../../../contrib/eigen/eigen > -I../../../contrib/gmv -I../../../contrib/qhull/qhull/src > -I../../../contrib/qhull/qhull/src/libqhull > -I../../../contrib/qhull/qhull/src/libqhullcpp > -I../../../contrib/parmetis/include -I../../../contrib/metis/include > -I../../../contrib/gzstream -std=gnu++11 -O2 -felide-constructors > -funroll-loops -fstrict-aliasing -Wdisabled-optimization -fopenmp > -std=gnu++11 -MT example_opt-eigenproblems_ex2.o -MD -MP -MF > .deps/example_opt-eigenproblems_ex2.Tpo -c -o > example_opt-eigenproblems_ex2.o `test -f 'eigenproblems_ex2.C' || echo > './'`eigenproblems_ex2.C > CXX example_opt-eigenproblems_ex2.o > eigenproblems_ex2.C:18:21: fatal error: nr3.h: No such file or directory > #include "nr3.h" > ^ > compilation terminated. > hpearce@islands:/opt/libmesh-1.0.0-rc1/examples/ > eigenproblems/eigenproblems_ex2$ mv -f .deps/example_opt-eigenproblems_ex2.Tpo > .deps/example_opt-eigenproblems_ex2.Po > mv: cannot stat ‘.deps/example_opt-eigenproblems_ex2.Tpo’: No such file > or directory > hpearce@islands:/opt/libmesh-1.0.0-rc1/examples/ > eigenproblems/eigenproblems_ex2$ rm -f example-opt > rm: cannot remove ‘example-opt’: Permission denied > hpearce@islands:/opt/libmesh-1.0.0-rc1/examples/ > eigenproblems/eigenproblems_ex2$ echo " CXXLD " example-opt;/bin/bash > ../../../libtool --silent --tag=CXX --mode=link mpicxx -std=gnu++11 -O2 > -felide-constructors -funroll-loops -fstrict-aliasing > -Wdisabled-optimization -fopenmp -std=gnu++11 -o example-opt > example_opt-eigenproblems_ex2.o ../../../libmesh_opt.la -lz > -Wl,-rpath,/opt/slepc-3.7.0/arch-linux2-c-debug/lib > -L/opt/slepc-3.7.0/arch-linux2-c-debug/lib -lslepc > -L/opt/petsc-3.7.1/arch-linux2-c-debug/lib -L/lib/x86_64-linux-gnu > -lpetsc -Wl,-rpath,/opt/petsc-3.7.1/arch-linux2-c-debug/lib -lf2clapack > -lf2cblas -lmpichf90 -lgfortran -lquadmath -lm -lmpichcxx -lstdc++ > -Wl,-rpath,/lib/x86_64-linux-gnu -lmpich -lopa -lmpl -lrt -lcr -lpthread > -lgcc_s -ldl -L/usr/lib/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8 > -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/4.8 -Wl,-rpath,/usr/lib/x86_64- > linux-gnu > CXXLD example-opt > rm: cannot remove 'example-opt': Permission denied > rm: cannot remove '.libs/example-opt': Permission denied > rm: cannot remove '.libs/lt-example-opt': Permission denied > /usr/bin/ld: cannot open output file .libs/example-opt: Permission denied > collect2: error: ld returned 1 exit status > > > > On Tue, Aug 9, 2016 at 10:52 AM, Mike Marchywka <marchy...@hotmail.com> > wrote: > >> >> >> >> >> ________________________________ >> > From: harroontheg...@gmail.com >> > Date: Tue, 9 Aug 2016 10:35:47 -0700 >> > Subject: Re: [Libmesh-users] FW: libmesh problem: libmesh_nullptr was >> > not declared in scope >> > To: marchy...@hotmail.com >> > CC: royst...@ices.utexas.edu; libmesh-users@lists.sourceforge.net >> > >> > >> > >> > Thank you for your help so far. It looks like this problem is close to >> > being finished. Your recommendation of using #include "libmesh/foo.h" >> > worked for compiling the program (I used the full path for >> > libmesh_nullptr.h in the include part and that fixed those errors) but >> > now when I run the executable I get the following error: >> > >> > ERROR: This example requires libMesh to be >> > compiled with SLEPc eigen solvers support! >> > >> > I already have SLEPc though. I would think to fix this problem I would >> > need to either add a compiler flag for SLEPc or add the program I have >> > to the example programs. >> > >> > I would think linking would work just as well as adding to my example >> > programs so I added -L/opt/slepc-3.7.0/sys >> > to the compiling command but this didn't fix the problem. >> >> >> I noticed a couple of things immediately about libmesh that were >> interesting. >> One was the term "exact solution" appearing almost everywhere and >> even being allowed on the command line IIRC in one case- there is >> some hope even if everything runs ok you can check the result. The other >> was the large array of build options and the checks in the examples- I >> had no idea I needed vtk for >> example of what any of the other things brought. To add these, you >> need to rebuild libmesh and reconfigure to enable if >> not found automatically. I ignore all the automake stuff, just run >> ./configure >> with the options set although make clean may help first. >> >> And again go to the examples and run make -n on any target and >> see what you get. >> >> Curious what the name collision is however. I just ran a script to find >> repeated names in my /usr/include and some occur 30 times lol. >> Using directories is probably a good idea. >> >> --- end of comments >> >> > >> > >> > Harry Pearce >> > >> > >> > >> > On Mon, Aug 8, 2016 at 11:20 AM, Mike Marchywka >> > <marchy...@hotmail.com<mailto:marchy...@hotmail.com>> wrote: >> > >> > >> > >> > >> > ________________________________ >> >> From: harroontheg...@gmail.com<mailto:harroontheg...@gmail.com> >> >> Date: Mon, 8 Aug 2016 10:35:42 -0700 >> >> Subject: Re: [Libmesh-users] FW: libmesh problem: libmesh_nullptr was >> >> not declared in scope >> >> To: marchy...@hotmail.com<mailto:marchy...@hotmail.com>; >> > royst...@ices.utexas.edu<mailto:royst...@ices.utexas.edu> >> >> CC: >> > libmesh-users@lists.sourceforge.net<mailto:libmesh-users@ >> lists.sourceforge.net> >> >> >> >> Oops I thought I replied to everyone. >> >> >> >>>Did it complain it can't find the header file first? >> >> >> >> It did complain about the libmesh.h header before I added the following >> >> to set my environment: >> >> export PATH=/opt/petsc-3.7.1:/opt/slepc-3.7.0:/opt/libmesh-1.0.0- >> rc1:$PATH >> >> export PATH=/opt/petsc-3.7.1:/opt/libmesh-1.0.0-rc1:$PATH >> >> export PATH=$PETSC_DIR/arch-linux2-c-debug:$PATH >> >> export CPATH=/opt/libmesh-1.0.0-rc1/include/libmesh/:$CPATH >> > >> > without the libmesh dir on the include it could be a name collision. >> > There is probably some way to get the compiler to tell you which dir >> > it includes from. Also you can get all of include paths, use "find" or >> > something and check for duplicate header names. >> > >> > The examples inlcuded "libmesh/foo.h" which is probably a good idea >> > to stick with although maybe someone who has used it more can comment :) >> > >> > >> >> >> >>>if you run "make -n example-opt" and copy the output it should work >> >> >> >> I tried running that command in the directory where my example program >> >> is and it said >> >> "make: *** No rule to make target `example-opt'. Stop." >> > >> > Well, the idea was using the makefile for a working example. >> > Maybe I mistyped the target name but you can look through the >> > examples. >> > >> >> >> >> >> >> >> >>>although without the libmesh dir in the includes I guess you would have >> >>>to add it to the include paths. >> >> libmesh.h is in the includes file. >> >> >> >> I still have the question about how to add my example file to the >> >> configure.ac<http://configure.ac><http://configure.ac> file in the >> > section AC_CONFIG_FILES >> >> since it's required in order to add a new example file according to >> >> https://github.com/libMesh/libmesh/wiki/Adding-a-new-example. If you >> >> don't know how to add the example to the AC_CONFIG_FILES (for example >> >> do I add the directory of the Makefile I want to create in it?) Is >> >> there another potential way to compile my program? I did try editing >> >> the example makefile to include the directory of my project under >> >> SUBDIRS but when I tried to run the makefile the compiler said: >> > >> > What are you using for a makefile now? I'm not sure this is even >> relevant >> > for what you are doing. Getting your code to compile AFAICT is a >> standalone >> > activity that will just need libmesh include files and libs for linking. >> > >> > --- end of new comments --- >> > >> >> >> >> Making all in eigenproblems/eigenproblems_femviblibtests_ex1 >> >> make[1]: Entering directory >> >> >> > `/opt/libmesh-1.0.0-rc1/examples/eigenproblems/eigenproblems >> _femviblibtests_ex1' >> >> make[1]: *** No rule to make target `all'. Stop. >> >> make[1]: Leaving directory >> >> >> > `/opt/libmesh-1.0.0-rc1/examples/eigenproblems/eigenproblems >> _femviblibtests_ex1' >> >> make: *** [all-recursive] Error 1 >> >> >> >> On Mon, Aug 8, 2016 at 10:34 AM, Harry Pearce >> >> >> > <harroontheg...@gmail.com<mailto:harroontheg...@gmail.com><mailto: >> harroontheg...@gmail.com<mailto:harroontheg...@gmail.com>>> >> > wrote: >> >>>Did it complain it can't find the header file first? >> >> >> >> It did complain about the libmesh.h header before I added the following >> >> to set my environment: >> >> export PATH=/opt/petsc-3.7.1:/opt/slepc-3.7.0:/opt/libmesh-1.0.0- >> rc1:$PATH >> >> export PATH=/opt/petsc-3.7.1:/opt/libmesh-1.0.0-rc1:$PATH >> >> export PATH=$PETSC_DIR/arch-linux2-c-debug:$PATH >> >> export CPATH=/opt/libmesh-1.0.0-rc1/include/libmesh/:$CPATH >> >> >> >>>if you run "make -n example-opt" and copy the output it should work >> >> >> >> I tried running that command in the directory where my example program >> >> is and it said >> >> "make: *** No rule to make target `example-opt'. Stop." >> >> >> >> >> >> >> >>>although without the libmesh dir in the includes I guess you would have >> >>>to add it to the include paths. >> >> libmesh.h is in the includes file. >> >> >> >> I still have the question about how to add my example file to the >> >> configure.ac<http://configure.ac><http://configure.ac> file in the >> > section AC_CONFIG_FILES >> >> since it's required in order to add a new example file according to >> >> https://github.com/libMesh/libmesh/wiki/Adding-a-new-example. If you >> >> don't know how to add the example to the AC_CONFIG_FILES (for example >> >> do I add the directory of the Makefile I want to create in it?) Is >> >> there another potential way to compile my program? I did try editing >> >> the example makefile to include the directory of my project under >> >> SUBDIRS but when I tried to run the makefile the compiler said: >> >> >> >> Making all in eigenproblems/eigenproblems_femviblibtests_ex1 >> >> make[1]: Entering directory >> >> >> > `/opt/libmesh-1.0.0-rc1/examples/eigenproblems/eigenproblems >> _femviblibtests_ex1' >> >> make[1]: *** No rule to make target `all'. Stop. >> >> make[1]: Leaving directory >> >> >> > `/opt/libmesh-1.0.0-rc1/examples/eigenproblems/eigenproblems >> _femviblibtests_ex1' >> >> make: *** [all-recursive] Error 1 >> >> >> >> Harry Pearce >> >> >> >> >> >> On Fri, Aug 5, 2016 at 2:32 PM, Mike Marchywka >> >> >> > <marchy...@hotmail.com<mailto:marchy...@hotmail.com><mailto: >> marchy...@hotmail.com<mailto:marchy...@hotmail.com>>> >> > wrote: >> >> >> >> >> >> >> >> Did it complain it can't find the header file first? >> >> My includes for libmesh all start libmesh/foo.h >> >> >> >> if you run "make -n example-opt" and copy the output it should work >> >> although without the libmesh dir in the includes I guess you would have >> >> to add it to the include paths. >> >> >> >> >> >> ________________________________ >> >>> From: >> > harroontheg...@gmail.com<mailto:harroontheg...@gmail.com><mailto: >> harroontheg...@gmail.com<mailto:harroontheg...@gmail.com>> >> >>> Date: Fri, 5 Aug 2016 14:07:58 -0700 >> >>> Subject: Re: [Libmesh-users] FW: libmesh problem: libmesh_nullptr was >> >>> not declared in scope >> >>> To: >> > marchy...@hotmail.com<mailto:marchy...@hotmail.com><mailto:m >> archy...@hotmail.com<mailto:marchy...@hotmail.com>> >> >>> CC: >> > royst...@ices.utexas.edu<mailto:royst...@ices.utexas.edu><mailto: >> royst...@ices.utexas.edu<mailto:royst...@ices.utexas.edu>>; >> >> >> > libmesh-users@lists.sourceforge.net<mailto:libmesh-users@ >> lists.sourceforge.net><mailto:libmesh-users@lists.sourceforge.net<mailto: >> libmesh-users@lists.sourceforge.net>> >> >>> >> >>>>"I skimmed most of the messages and it did sound like it would be >> > something >> >>>>easy to find by looking at the exact code so I was a bit surprised >> >>> with that last post :)" >> >>> >> >>> Just in case it is something easy to spot I have the code at the >> bottom >> >>> of the email highlighted. If you don't need the code you can just >> >>> ignore the highlighted part of the email. >> >>> >> >>>>The linking is a bit unorthodox, indeed I think you had some specific >> >>>>recommendations for linking to libmesh that hid most of the details, >> but >> >>>>actually building it and compiling with it were pretty easy. I turned >> >>> on some debug info >> >>>>from the example make script, just copied its invokation of g++ and >> > libtool >> >>>>and that seems to work for some simple case. >> >>> >> >>> This is my first time compiling a libmesh code so I tried to figure >> out >> >>> what compiler flags to use in the suggested manner >> >>> for simple codes (according to >> >>> http://libmesh.github.io/installation.html) which is libmesh-config >> >>> --cxx` -o HPeigenproblems_PZ_8_2_16_2 HPeigenproblems_PZ_8_2_16_2.C >> >>> `libmesh-config --cxxflags --include --ldflags --libs`. >> >>> >> >>> This is my first time compiling a libmesh code so I thought maybe I >> >>> should use a Makefile.am from a regular libmesh example. >> >>> (My other example files compiled properly) so I was thinking that it >> >>> might work to follow the instructions for adding a new libmesh example >> >>> (https://github.com/libMesh/libmesh/wiki/Adding-a-new-example) which >> >>> invoves changing the Makefile.am and run.sh from another example file >> >>> to run the program. >> >>> >> >>> I started following the directions for adding a new example and am not >> >>> sure what line to put into AC_CONFIG_FILES in >> >>> >> > configure.ac<http://configure.ac><http://configure.ac><http: >> //configure.ac> >> > at the top >> >> level of libmesh. I would >> >>> have thought it would have been the directory of the example file I am >> >>> adding or the Makefile that goes with it but I do not see the >> >>> directories of any other example programs in AC_CONFIG_FILES within >> the >> >>> >> > configure.ac<http://configure.ac><http://configure.ac><http: >> //configure.ac> >> > program. >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> Harry Pearce >> >>> >> >>> Just in case highlighting doesn't show up on the libmesh users >> archive, >> >>> the highlighted code is below: >> >>> #include <fstream> >> >>> #include "libmesh.h" >> >>> #include "mesh.h" >> >>> #include "libmesh_config.h" >> >>> //#include "mesh_generation.h" >> >>> // #include "exodusII_io.h" >> >>> #include "eigen_system.h" >> >>> #include "equation_systems.h" >> >>> // #include "fe.h" >> >>> // #include "quadrature_gauss.h" >> >>> // #include "dense_matrix.h" >> >>> // #include "sparse_matrix.h" >> >>> // #include "numeric_vector.h" >> >>> // #include "dof_map.h" >> >>> #include "libmesh_nullptr.h" >> >>> #include <string.h> >> >>> // #include "parallel_algebra.h" >> >>> //#include "parallel.h" >> >>> //#include <auto_ptr.h> >> >>> >> >>> >> >>> using namespace libMesh; >> >>> >> >>> char prefix[80]; >> >>> >> >>> void assemble_mass(EquationSystems& es, >> >>> >> >>> const std::string& system_name); >> >>> >> >>> int main (int argc, char** argv) >> >>> >> >>> { >> >>> >> >>> LibMeshInit init (argc, argv); >> >>> >> >>> #ifndef LIBMESH_HAVE_SLEPC >> >>> >> >>> if (libMesh::processor_id() == 0) >> >>> >> >>> std::cerr << "ERROR: This example requires libMesh to be\n" >> >>> >> >>> << "compiled with SLEPc eigen solvers support!" >> >>> >> >>> << std::endl; >> >>> >> >>> return 0; >> >>> >> >>> #else >> >>> >> >>> #ifdef LIBMESH_DEFAULT_SINGLE_PRECISION >> >>> >> >>> libmesh_example_assert(false, "--disable-singleprecision"); >> >>> >> >>> #endif >> >>> >> >>> if (argc < 3) >> >>> >> >>> { >> >>> >> >>> if (libMesh::processor_id() == 0) >> >>> >> >>> std::cerr << "\nUsage: " << argv[0] >> >>> >> >>> << " -n <number of eigen values>" >> >>> >> >>> << std::endl; >> >>> >> >>> libmesh_error(); >> >>> >> >>> } >> >>> >> >>> >> >>> >> >>> else >> >>> >> >>> { >> >>> >> >>> std::cout << "Running " << argv[0]; >> >>> >> >>> >> >>> >> >>> for (int i=1; i<argc; i++) >> >>> >> >>> std::cout << " " << argv[i]; >> >>> >> >>> >> >>> >> >>> std::cout << std::endl << std::endl; >> >>> >> >>> } >> >>> >> >>> const unsigned int nev = std::atoi(argv[2]); >> >>> >> >>> // libmesh_example_assert(3 <= LIBMESH_DIM, "2D support"); >> >>> >> >>> >> >>> >> >>> Mesh mesh; >> >>> >> >>> MeshTools::Generation::build_cube (mesh, >> >>> >> >>> 10, 10, 10, >> >>> >> >>> -1., 1., >> >>> >> >>> -1., 1., >> >>> >> >>> -1., 1., >> >>> >> >>> HEX27); >> >>> >> >>> mesh.print_info(); >> >>> >> >>> >> >>> >> >>> char xyzfilename[80]; >> >>> >> >>> strcpy(prefix,argv[3]); >> >>> >> >>> strcpy(xyzfilename,argv[3]); >> >>> >> >>> strcat(xyzfilename,".xyz"); >> >>> >> >>> std::cout << "Writing nodal xyz coordinates to file: " << >> >>> xyzfilename << std::endl; >> >>> >> >>> std::ofstream xyzfile; >> >>> >> >>> xyzfile.open (xyzfilename); >> >>> >> >>> MeshBase::const_node_iterator node_it = mesh.nodes_begin(); >> >>> >> >>> >> >>> >> >>> >> >>> const MeshBase::const_node_iterator node_end = mesh.nodes_end(); >> >>> >> >>> xyzfile << "Number of nodes: " << mesh.n_nodes() << "\n"; >> >>> >> >>> for (; node_it != node_end; ++node_it) >> >>> >> >>> { >> >>> >> >>> //count++; >> >>> >> >>> const Point& p = **node_it; >> >>> >> >>> const Real px = p(0); >> >>> >> >>> const Real py = p(1); >> >>> >> >>> xyzfile << px << " " << py << " \n"; >> >>> >> >>> } >> >>> >> >>> xyzfile.close(); >> >>> >> >>> std::cout << "Finished writing nodal xyz coordinates to file: " << >> >>> xyzfilename << std::endl; >> >>> >> >>> >> >>> EquationSystems equation_systems (mesh); >> >>> >> >>> EigenSystem & eigen_system = >> >>> >> >>> equation_systems.add_system<EigenSystem> ("Eigensystem"); >> >>> >> >>> >> >>> >> >>> >> >>> eigen_system.add_variable("u", SECOND); >> >>> >> >>> eigen_system.attach_assemble_function (assemble_mass); >> >>> >> >>> >> >> >> > equation_systems.parameters.se<http://equation_systems.parameters.se>< >> http://equation_systems.parameters.se>t<unsigned >> >> int>("eigenpairs") = nev; >> >>> >> >>> >> >> >> > equation_systems.parameters.se<http://equation_systems.parameters.se>< >> http://equation_systems.parameters.se>t<unsigned >> >> int>("basis vectors") = nev*3; >> >>> >> >>> eigen_system.eigen_solver->set_eigensolver_type(KRYLOVSCHUR); >> >>> >> >>> // eigen_system.eigen_solver->set_eigensolver_type(LAPACK); >> >>> >> >>> eigen_system.eigen_solver->set_position_of_spectrum(SMALLEST_REAL); >> >>> >> >>> >> >> >> > equation_systems.parameters.se<http://equation_systems.parameters.se>< >> http://equation_systems.parameters.se>t<Real>("linear >> >> solver tolerance") = >> >>> pow(TOLERANCE, 5./3.); >> >>> >> >>> >> >> >> > equation_systems.parameters.se<http://equation_systems.parameters.se>< >> http://equation_systems.parameters.se>t<unsigned >> >> int> >> >>> >> >>> ("linear solver maximum iterations") = 1000; >> >>> >> >>> eigen_system.set_eigenproblem_type(GHEP); >> >>> >> >>> equation_systems.init(); >> >>> >> >>> equation_systems.print_info(); >> >>> >> >>> >> >>> >> >>> eigen_system.solve(); >> >>> >> >>> unsigned int nconv = eigen_system.get_n_converged(); >> >>> >> >>> std::cout << "Number of converged eigenpairs: " << nconv >> >>> >> >>> << "\n" << std::endl; >> >>> >> >>> if (nconv != 0) >> >>> >> >>> { >> >>> >> >>> eigen_system.get_eigenpair(nconv-1); >> >>> >> >>> >> >>> >> >>> #ifdef LIBMESH_HAVE_EXODUS_API >> >>> >> >>> ExodusII_IO (mesh).write_equation_systems ("out.e", equation_systems); >> >>> >> >>> #endif // #ifdef LIBMESH_HAVE_EXODUS_API >> >>> >> >>> } >> >>> >> >>> else >> >>> >> >>> { >> >>> >> >>> std::cout << "WARNING: Solver did not converge!\n" << nconv << >> >>> std::endl; >> >>> >> >>> } >> >>> >> >>> #endif // LIBMESH_HAVE_SLEPC >> >>> >> >>> return 0; >> >>> >> >>> } >> >>> >> >>> void assemble_mass(EquationSystems& es, >> >>> >> >>> const std::string& system_name) >> >>> >> >>> { >> >>> >> >>> char potfilename[80]; >> >>> >> >>> strcpy(potfilename,prefix); >> >>> >> >>> strcat(potfilename,".pot.out"); >> >>> >> >>> std::fstream potfile; >> >>> >> >>> potfile.open(potfilename, std::ios::out); >> >>> >> >>> if(!potfile) {std::cerr << "Error opening PES output file."; return;} >> >>> >> >>> libmesh_assert (system_name == "Eigensystem"); >> >>> >> >>> #ifdef LIBMESH_HAVE_SLEPC >> >>> >> >>> const MeshBase& mesh = es.get_mesh(); >> >>> >> >>> const unsigned int dim = mesh.mesh_dimension(); >> >>> >> >>> EigenSystem & eigen_system = es.get_system<EigenSystem> (system_name); >> >>> >> >>> FEType fe_type = eigen_system.get_dof_map().variable_type(0); >> >>> >> >>> SparseMatrix<Number>& matrix_A = *eigen_system.matrix_A; >> >>> >> >>> SparseMatrix<Number>& matrix_B = *eigen_system.matrix_B; >> >>> >> >>> AutoPtr<FEBase> fe (FEBase::build(dim, fe_type)); >> >>> >> >>> QGauss qrule (dim, fe_type.default_quadrature_order()); >> >>> >> >>> fe->attach_quadrature_rule (&qrule); >> >>> >> >>> const std::vector<Real>& JxW = fe->get_JxW(); >> >>> >> >>> const std::vector<Point>& q_point = fe->get_xyz(); >> >>> >> >>> const std::vector<std::vector<Real>>& phi = fe->get_phi(); >> >>> >> >>> const std::vector<std::vector<RealGradient>>& dphi = fe->get_dphi(); >> >>> >> >>> const DofMap& dof_map = eigen_system.get_dof_map(); >> >>> >> >>> DenseMatrix<Number> Me; >> >>> >> >>> DenseMatrix<Number> Ke; >> >>> >> >>> std::vector<unsigned int> dof_indices; >> >>> >> >>> MeshBase::const_element_iterator el = >> >>> mesh.active_local_elements_begin(); >> >>> >> >>> const MeshBase::const_element_iterator end_el = >> >>> mesh.active_local_elements_end(); >> >>> >> >>> >> >>> >> >>> std::cout << "Writing PES data to file: " << potfilename << std::endl; >> >>> >> >>> double V, gxx, gxy, gyy, gzx, gzy, gzz; >> >>> >> >>> for ( ; el != end_el; ++el) >> >>> >> >>> { >> >>> >> >>> const Elem* elem = *el; >> >>> >> >>> dof_map.dof_indices (elem, dof_indices); >> >>> >> >>> fe->reinit (elem); >> >>> >> >>> Ke.resize (dof_indices.size(), dof_indices.size()); >> >>> >> >>> Me.resize (dof_indices.size(), dof_indices.size()); >> >>> >> >>> for (unsigned int qp=0; qp<qrule.n_points(); qp++) >> >>> >> >>> { >> >>> >> >>> const double x = q_point[qp](0); >> >>> >> >>> const double y = q_point[qp](1); >> >>> >> >>> const double z = q_point[qp](2); >> >>> >> >>> /* >> >>> >> >>> Doub potpoint(ndim); >> >>> >> >>> potpoint[0] = x; >> >>> >> >>> potpoint[1] = y; >> >>> >> >>> potpoint[2] = z; >> >>> >> >>> */ >> >>> >> >>> V=x*x + y*y + z*z; >> >>> >> >>> gxx=0.10; >> >>> >> >>> gyy=1.20; >> >>> >> >>> gxy=1.10; >> >>> >> >>> gzx=0.003; >> >>> >> >>> gzy=0.40; >> >>> >> >>> gzz=0.50; >> >>> >> >>> >> >>> potfile << x << '\t' << y << '\t' << z << '\t' << V << '\t' << "\n"; >> >>> >> >>> >> >>> /* >> >>> >> >>> const Elem* elem = *el; >> >>> >> >>> dof_map.dof_indices (elem, dof_indices); >> >>> >> >>> fe->reinit (elem); >> >>> >> >>> Ke.resize (dof_indices.size(), dof_indices.size()); >> >>> >> >>> Me.resize (dof_indices.size(), dof_indices.size()); >> >>> >> >>> */ >> >>> >> >>> // for (unsigned int qp=0; qp<qrule.n_points(); qp++) >> >>> >> >>> for (unsigned int i=0; i<phi.size(); i++) >> >>> >> >>> for (unsigned int j=0; j<phi.size(); j++) >> >>> >> >>> { >> >>> >> >>> >> >>> Ke(i,j) += JxW[qp]*( >> >>> >> >>> 0.5*( gxx*dphi[i][qp](0)*dphi[j][qp](0) >> >>> >> >>> + gyy*dphi[i][qp](1)*dphi[j][qp](1) >> >>> >> >>> + gzz*dphi[i][qp](2)*dphi[j][qp](2) >> >>> >> >>> + gxy*dphi[i][qp](0)*dphi[j][qp](1) >> >>> >> >>> + gxy*dphi[i][qp](1)*dphi[j][qp](0) >> >>> >> >>> + gzx*dphi[i][qp](0)*dphi[j][qp](2) >> >>> >> >>> + gzx*dphi[i][qp](2)*dphi[j][qp](0) >> >>> >> >>> + gzy*dphi[i][qp](1)*dphi[j][qp](2) >> >>> >> >>> + gzy*dphi[i][qp](2)*dphi[j][qp](1) >> >>> >> >>> // + dgxxdx*dphi[i][qp](0) >> >>> >> >>> // + dgyydy*dphi[i][qp](1) >> >>> >> >>> // + dgzzdz*dphi[i][qp](2) >> >>> >> >>> // + dgxydx*dphi[i][qp](1) >> >>> >> >>> // + dgxydy*dphi[i][qp](0) >> >>> >> >>> // + dgxzdx*dphi[i][qp](2) >> >>> >> >>> // + dgzxdz*dphi[i][qp](0) >> >>> >> >>> // + dgyzdy*dphi[i][qp](2) >> >>> >> >>> // + dgzydz*dphi[i][qp](1) >> >>> >> >>> )*33.71526 + V*phi[i][qp]*phi[j][qp]); >> >>> >> >>> >> >>> >> >>> Me(i,j) += JxW[qp]*phi[i][qp]*phi[j][qp]; >> >>> >> >>> } >> >>> >> >>> matrix_A.add_matrix (Ke, dof_indices); >> >>> >> >>> matrix_B.add_matrix (Me, dof_indices); >> >>> >> >>> } >> >>> >> >>> } // end of element loop >> >>> >> >>> std::cout << "Finished writing PES data to file: " << potfilename >> >>> << std::endl; >> >>> >> >>> potfile.close(); >> >>> >> >>> std::cout << "Matrix A assembly completed! " << "\n" << std::endl; >> >>> >> >>> std::cout << "Matrix B assembly completed! " << "\n" << std::endl; >> >>> >> >>> std::cout << "Exporting Matrix A in matlab sparse matrix format... >> >>> " << "\n" << std::endl; >> >>> >> >>> char buf1[14]; >> >>> >> >>> sprintf (buf1, "A.m"); >> >>> >> >>> matrix_A.print_matlab(buf1); >> >>> >> >>> std::cout << "Matrix A Exported! " << "\n" << std::endl; >> >>> >> >>> // matrix_A.clear(); >> >>> >> >>> std::cout << "Matrix A Cleared from Memory! " << "\n" << std::endl; >> >>> >> >>> std::cout << "Exporting Matrix B in matlab sparse matrix format... >> >>> " << "\n" << std::endl; >> >>> >> >>> char buf2[14]; >> >>> >> >>> sprintf (buf2, "B.m"); >> >>> >> >>> matrix_B.print_matlab(buf2); >> >>> >> >>> std::cout << "Matrix B Exported! " << "\n" << std::endl; >> >>> >> >>> // matrix_B.clear(); >> >>> >> >>> std::cout << "Matrix B Cleared from Memory! " << "\n" << std::endl; >> >>> >> >>> #endif // LIBMESH_HAVE_SLEPC >> >>> >> >>> /** >> >>> >> >>> * All done! >> >>> >> >>> */ >> >>> >> >>> return; >> >>> >> >>> On Thu, Aug 4, 2016 at 5:41 PM, Mike Marchywka >> >>> >> >> >> > <marchy...@hotmail.com<mailto:marchy...@hotmail.com><mailto: >> marchy...@hotmail.com<mailto:marchy...@hotmail.com>><mailto: >> marchy...@hotmail.com<mailto:marchy...@hotmail.com><mailto:m >> archy...@hotmail.com<mailto:marchy...@hotmail.com>>>> >> >> wrote: >> >>> >> >>> >> >>> >> >>> >> >>> ---------------------------------------- >> >>>> Date: Thu, 4 Aug 2016 19:11:03 -0500 >> >>>> From: >> >> >> > royst...@ices.utexas.edu<mailto:royst...@ices.utexas.edu><mailto: >> royst...@ices.utexas.edu<mailto:royst...@ices.utexas.edu>><mailto: >> royst...@ices.utexas.edu<mailto:royst...@ices.utexas.edu><mailto:roys >> t...@ices.utexas.edu<mailto:royst...@ices.utexas.edu>>> >> >>>> To: >> >> >> > marchy...@hotmail.com<mailto:marchy...@hotmail.com><mailto:m >> archy...@hotmail.com<mailto:marchy...@hotmail.com>><mailto:m >> archy...@hotmail.com<mailto:marchy...@hotmail.com><mailto:ma >> rchy...@hotmail.com<mailto:marchy...@hotmail.com>>> >> >>>> CC: >> >>> >> >> >> > libmesh-users@lists.sourceforge.net<mailto:libmesh-users@ >> lists.sourceforge.net><mailto:libmesh-users@lists.sourceforge.net<mailto: >> libmesh-users@lists.sourceforge.net>><mailto:libmesh-us...@lists.sou >> rceforge.net<mailto:libmesh-users@lists.sourceforge.net><mailto: >> libmesh-users@lists.sourceforge.net<mailto:libmesh- >> us...@lists.sourceforge.net>>> >> >>>> Subject: Re: [Libmesh-users] FW: libmesh problem: libmesh_nullptr was >> >>> not declared in scope >> >>>> >> >>>> >> >>>> >> >>>> On Thu, 4 Aug 2016, Mike Marchywka wrote: >> >>>> >> >>>>>> I have not followed the exchange but sometimes I end up including >> >>> headers within a namespace or >> >>>>>> something. Is libmesh being included within something? Not sure >> >>> what that does with some >> >>>>>> macros and others not lol. >> >>>> >> >>>> That was my first guess, too! That's actually why I was asking about >> >>>> the config macros - if he was in the nullptr-workaround case, then >> >>>> accidentally including a libMesh header within a namespace would have >> >>>> exactly the effect seen: the class we define wouldn't exist in the >> >>>> global namespace and the compiler wouldn't recognize it. >> >>> >> >>> I skimmed most of the messages and it did sound like it would be >> something >> >>> easy to find by looking at the exact code so I was a bit surprised >> with >> >>> that last post :) >> >>> >> >>> For problems in unfamiliar code grep can be amazingly >> >>> useful even if you expect 1000's of hits they usually end up being >> easy >> >>> to sort out. >> >>> >> >>> The linking is a bit unorthodox, indeed I think you had some specific >> >>> recommendations for linking to libmesh that hid most of the details, >> but >> >>> actually building it and compiling with it were pretty easy. I turned >> >>> on some debug info >> >>> from the example make script, just copied its invokation of g++ and >> > libtool >> >>> and that seems to work for some simple case. >> >>> >> >>> >> >>> >> >>> >> >>>> --- >> >>>> Roy >> >>> >> >>> >> >> >> > ------------------------------------------------------------ >> ------------------ >> >>> _______________________________________________ >> >>> Libmesh-users mailing list >> >>> >> >> >> > Libmesh-users@lists.sourceforge.net<mailto:Libmesh-users@ >> lists.sourceforge.net><mailto:Libmesh-users@lists.sourceforge.net<mailto: >> Libmesh-users@lists.sourceforge.net>><mailto:libmesh-us...@lists.sou >> rceforge.net<mailto:Libmesh-users@lists.sourceforge.net><mailto: >> Libmesh-users@lists.sourceforge.net<mailto:Libmesh- >> us...@lists.sourceforge.net>>> >> >>> https://lists.sourceforge.net/lists/listinfo/libmesh-users >> >>> >> >> >> >> >> >> >> > >> > >> > > > ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohodev2dev _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users