Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples to build system #9

Merged
merged 3 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down Expand Up @@ -166,4 +168,3 @@ ENDIF()
# Installing headers
install (FILES ${GINACDE_HEADERS} DESTINATION include/GiNaCDE)
install (FILES "${PROJECT_BINARY_DIR}/version.h" DESTINATION include/GiNaCDE)

8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/5thGKdV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@



#include <GiNaCDE/GiNaCDE.h>
#include <GiNaCDE.h>


int main()
Expand Down
2 changes: 1 addition & 1 deletion examples/7thorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@



#include <GiNaCDE/GiNaCDE.h>
#include <GiNaCDE.h>


int main()
Expand Down
26 changes: 26 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 $<IF:$<BOOL:GINACDE_BUILD_SHARED_LIBS>,GiNaCDE,GiNaCDE_static>
)
endforeach()
endif()

# Add meta-target to compile
add_custom_target(examples)
add_dependencies(examples ${SRC_FILES})
2 changes: 1 addition & 1 deletion examples/Eckhaus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@



#include <GiNaCDE/GiNaCDE.h>
#include <GiNaCDE.h>


int main()
Expand Down
4 changes: 2 additions & 2 deletions examples/KS.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

/** @file KS.cpp
*
* This program solves the KudryashovSinelshchikov 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 <GiNaCDE/GiNaCDE.h>
#include <GiNaCDE.h>


int main()
Expand Down
2 changes: 1 addition & 1 deletion examples/KdVB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@



#include <GiNaCDE/GiNaCDE.h>
#include <GiNaCDE.h>


int main()
Expand Down
2 changes: 1 addition & 1 deletion examples/NLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@



#include <GiNaCDE/GiNaCDE.h>
#include <GiNaCDE.h>


int main()
Expand Down
2 changes: 1 addition & 1 deletion examples/example1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@



#include <GiNaCDE/GiNaCDE.h>
#include <GiNaCDE.h>


int main()
Expand Down
2 changes: 1 addition & 1 deletion examples/example2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
xvi. Nonlinear Telegraph Equation */


#include <GiNaCDE/GiNaCDE.h>
#include <GiNaCDE.h>
//#include <conio.h>


Expand Down
2 changes: 1 addition & 1 deletion examples/kerrNLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@



#include <GiNaCDE/GiNaCDE.h>
#include <GiNaCDE.h>


int main()
Expand Down