Skip to content

Commit 262fbf0

Browse files
Alomirdlebauer
andauthored
SIP78 Convert switches to run time options (#96)
* Initial commit * Removes makedepend info * Code cleanup * Splits cli into .h and .c; also code cleanup * Adds back namelistInputs.c temporarily * Removes namelistInput.c after merrge with master * Tweaks check order in readInputFile * Makes Context struct extern in header * Fixes return codes for help and version * Adds config file to help CLion users * added quickstart (#101) * more helpful error reading / writing * Update format for clang-format * Moves version string to new version.h * Fixes merge error --------- Co-authored-by: David LeBauer <dlebauer@gmail.com>
1 parent fe9fcd8 commit 262fbf0

14 files changed

Lines changed: 1848 additions & 489 deletions

File tree

CMakeLists.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This file is here to make CLion users' lives better, but it is not complete.
2+
# One cannot build sipnet from this file. But, it does let CLion do a much
3+
# better job with code analysis.
4+
5+
# As C files are added and/or removed, this file should be updated.
6+
7+
cmake_minimum_required(VERSION 3.30)
8+
project(sipnet C)
9+
10+
set(CMAKE_C_STANDARD 23)
11+
12+
include_directories(src)
13+
include_directories(src/common)
14+
include_directories(src/sipnet)
15+
include_directories(tests)
16+
include_directories(tests/sipnet/test_events_infrastructure)
17+
include_directories(tests/sipnet/test_events_types)
18+
include_directories(tests/sipnet/test_bugfixes)
19+
include_directories(tests/sipnet/test_sipnet_infrastructure)
20+
include_directories(tests/utils)
21+
22+
add_compile_options(-Wall -Wpedantic -Werror)
23+
24+
add_library(commonlib
25+
src/common/spatialParams.c
26+
src/common/util.c
27+
)
28+
29+
add_library(sipnetlib
30+
src/sipnet/cli.c
31+
src/sipnet/context.c
32+
src/sipnet/events.c
33+
src/sipnet/frontend.c
34+
src/sipnet/outputItems.c
35+
src/sipnet/runmean.c
36+
src/sipnet/sipnet.c
37+
)

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ LIB_DIR=./libs
77
LDFLAGS=-L$(LIB_DIR)
88

99
# Main executables
10-
COMMON_CFILES:=util.c namelistInput.c modelParams.c
10+
COMMON_CFILES:=util.c modelParams.c
1111
COMMON_CFILES:=$(addprefix src/common/, $(COMMON_CFILES))
1212
COMMON_OFILES=$(COMMON_CFILES:.c=.o)
1313

14-
SIPNET_CFILES:=sipnet.c frontend.c runmean.c outputItems.c events.c
14+
SIPNET_CFILES:=sipnet.c frontend.c runmean.c outputItems.c events.c context.c cli.c
1515
SIPNET_CFILES:=$(addprefix src/sipnet/, $(SIPNET_CFILES))
1616
SIPNET_OFILES=$(SIPNET_CFILES:.c=.o)
1717
SIPNET_LIBS=-lsipnet_common

docs/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ SIPNET (Simplified Photosynthesis and Evapotranspiration Model) is an ecosystem
44
carbon and water dynamics. Originally developed for assimilation of eddy covariance flux data in forest ecosystems,
55
current development is focused on representing carbon balance and GHG fluxes and agricultural management practices.
66

7+
## Quick Start
8+
9+
1. Clone the repository:
10+
```bash
11+
git clone https://github.com/PecanProject/sipnet.git
12+
cd sipnet
13+
```
14+
2. Build the SIPNET executable:
15+
```bash
16+
make
17+
```
18+
3. Run a test simulation:
19+
```bash
20+
./src/sipnet -i tests/smoke/sipnet.in
21+
```
22+
4. Check the output:
23+
```bash
24+
cat tests/smoke/niwot.out
25+
```
26+
727
## Getting Started
828

929
### Installing

src/common/exitCodes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ typedef enum {
2121
EXIT_CODE_UNKNOWN_EVENT_TYPE_OR_PARAM = 4,
2222
EXIT_CODE_INPUT_FILE_ERROR = 5,
2323
EXIT_CODE_FILE_OPEN_OR_READ_ERROR = 6,
24-
EXIT_CODE_INTERNAL_ERROR = 7
24+
EXIT_CODE_INTERNAL_ERROR = 7,
25+
EXIT_CODE_BAD_CLI_ARGUMENT = 8
2526
} exit_code_t;
2627

2728
#endif

src/common/namelistInput.c

Lines changed: 0 additions & 292 deletions
This file was deleted.

0 commit comments

Comments
 (0)