diff --git a/CMakeLists.txt b/CMakeLists.txt index 2eb0616..9665ec2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,6 +135,8 @@ IF(GINACDE_BUILD_STATIC_LIBS) set(testlibs ${CORELIBS} GiNaCDE_static) ENDIF() +add_subdirectory(examples EXCLUDE_FROM_ALL) + add_executable(test1 test/test1.cpp) target_link_libraries(test1 ${testlibs}) @@ -166,4 +168,3 @@ ENDIF() # Installing headers install (FILES ${GINACDE_HEADERS} DESTINATION include/GiNaCDE) install (FILES "${PROJECT_BINARY_DIR}/version.h" DESTINATION include/GiNaCDE) - diff --git a/README.md b/README.md index afc11ff..a030c0d 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,13 @@ Besides this, the solutions of the NLPDE are collected by a programming variable ## Examples The [`examples`](examples/) folder contains all the examples which solve some NLPDEs, such as, Eckhaus equation, Seventh-order SawadaKotara equations, Fifth-order Generalized KdV equation, Perturbed NLS Equation with Kerr Law Nonlinearity, KudryashovSinelshchikov Equation, etc. We have provided output text files after executing each example. - + +To compile the examples, move to the `build-dir` created earlier for building GiNaCDE, and execute +``` +$ make examples +``` +The executables will be placed into the `build-dir/bin` directory. + ### Additional notes Please note that one can obtain different results in output files compared to those provided by us in the [`examples`](examples/) folder for each example. This happens because of the GiNaC library. diff --git a/examples/5thGKdV.cpp b/examples/5thGKdV.cpp index 174566f..68bed74 100644 --- a/examples/5thGKdV.cpp +++ b/examples/5thGKdV.cpp @@ -7,7 +7,7 @@ -#include +#include int main() diff --git a/examples/7thorder.cpp b/examples/7thorder.cpp index 187509b..6879404 100644 --- a/examples/7thorder.cpp +++ b/examples/7thorder.cpp @@ -7,7 +7,7 @@ -#include +#include int main() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..9f54d32 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,26 @@ +# Source files in this directory +set(SRC_FILES + 5thGKdV + 7thorder + Eckhaus + example1 + example2 + KdVB + kerrNLS + KS + NLS +) + +# Add executables and link to library +if(GINACDE_BUILD_SHARED_LIBS OR GINACDE_BUILD_STATIC_LIBS) + foreach(src ${SRC_FILES}) + add_executable(${src} ${src}.cpp) + target_link_libraries(${src} + PUBLIC $,GiNaCDE,GiNaCDE_static> + ) + endforeach() +endif() + +# Add meta-target to compile +add_custom_target(examples) +add_dependencies(examples ${SRC_FILES}) diff --git a/examples/Eckhaus.cpp b/examples/Eckhaus.cpp index 1439c03..a995678 100644 --- a/examples/Eckhaus.cpp +++ b/examples/Eckhaus.cpp @@ -7,7 +7,7 @@ -#include +#include int main() diff --git a/examples/KS.cpp b/examples/KS.cpp index 3cc5981..6d7c7d7 100644 --- a/examples/KS.cpp +++ b/examples/KS.cpp @@ -1,13 +1,13 @@ /** @file KS.cpp * - * This program solves the Kudryashov–Sinelshchikov equation: + * This program solves the Kudryashov-Sinelshchikov equation: {u_{3x}} + gu{u_x} - n{u_{2x}} - \left( {u{u_{2x}} + u_x^2} \right)d - k{u_x}{u_{2x}} - e\left( {u{u_{3x}} + {u_x}{u_{2x}}} \right) + {u_t} = 0, */ -#include +#include int main() diff --git a/examples/KdVB.cpp b/examples/KdVB.cpp index 8f9d218..b150fe0 100644 --- a/examples/KdVB.cpp +++ b/examples/KdVB.cpp @@ -7,7 +7,7 @@ -#include +#include int main() diff --git a/examples/NLS.cpp b/examples/NLS.cpp index 9d7a6df..5628e8e 100644 --- a/examples/NLS.cpp +++ b/examples/NLS.cpp @@ -7,7 +7,7 @@ -#include +#include int main() diff --git a/examples/example1.cpp b/examples/example1.cpp index 398f9cc..d9bc322 100644 --- a/examples/example1.cpp +++ b/examples/example1.cpp @@ -8,7 +8,7 @@ -#include +#include int main() diff --git a/examples/example2.cpp b/examples/example2.cpp index f2c9ec7..19b9170 100644 --- a/examples/example2.cpp +++ b/examples/example2.cpp @@ -19,7 +19,7 @@ xvi. Nonlinear Telegraph Equation */ -#include +#include //#include diff --git a/examples/kerrNLS.cpp b/examples/kerrNLS.cpp index 3e20a2c..4f7883f 100644 --- a/examples/kerrNLS.cpp +++ b/examples/kerrNLS.cpp @@ -7,7 +7,7 @@ -#include +#include int main()