Skip to content

Commit 920f338

Browse files
authored
Merge pull request #116 from cindytsai/dim
Support Dim 2/1 and Fix Bug
2 parents e05ee45 + 9f1b7c1 commit 920f338

24 files changed

+876
-385
lines changed

.github/workflows/unit-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ jobs:
105105
- "-DSERIAL_MODE=ON -DINTERACTIVE_MODE=ON -DLIBYT_RUN_TEST=ON -DUSE_PYBIND11=ON"
106106
- "-DSERIAL_MODE=ON -DINTERACTIVE_MODE=ON -DLIBYT_RUN_TEST=ON -DUSE_PYBIND11=OFF"
107107
include:
108-
- os: ubuntu-20.04
108+
- os: ubuntu-22.04
109109
python_version: '3.7'
110110
build_options: "-DSERIAL_MODE=ON -DINTERACTIVE_MODE=ON -DLIBYT_RUN_TEST=ON -DUSE_PYBIND11=ON"
111-
- os: ubuntu-20.04
111+
- os: ubuntu-22.04
112112
python_version: '3.7'
113113
build_options: "-DSERIAL_MODE=ON -DINTERACTIVE_MODE=ON -DLIBYT_RUN_TEST=ON -DUSE_PYBIND11=OFF"
114114

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15)
33
# cmake-format: off
44
###### PROJECT Info #####################################################################
55
project(LIBYT_PROJECT
6-
VERSION 0.2.0
6+
VERSION 0.3.0
77
DESCRIPTION "In situ Python analysis tool using yt and Python"
88
)
99

doc/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "libyt"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = 0.2.0
51+
PROJECT_NUMBER = 0.3.0
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewer a

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
copyright = '2024, Shin-Rong Tsai, Hsi-Yu Schive, Matthew Turk'
1313
author = 'Shin-Rong Tsai, Hsi-Yu Schive, Matthew Turk'
1414

15-
version = "0.2.0"
16-
release = "0.2.0"
15+
version = "0.3.0"
16+
release = "0.3.0"
1717

1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

doc/in-situ-python-analysis/libyt-python-module.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import libyt
77
```
88

9-
> {octicon}`info;1em;sd-text-info;` `libyt` Python module is only importable during simulation runtime.
9+
```{note}
10+
`libyt` Python module is only importable during simulation runtime.
11+
```
1012

1113
## Dictionaries
1214

@@ -131,7 +133,9 @@ get_field_remote(fname_list : list,
131133
```
132134
- Usage: Return a dictionary that contains requested field data. The data is scattered in different processes. It is a collective operation.
133135

134-
> {octicon}`alert;1em;sd-text-danger;` This is a collective operation, and it requires every MPI process to participate.
136+
```{attention}
137+
This is a collective operation, and it requires every MPI process to participate.
138+
```
135139

136140
### `get_particle_remote`
137141
```python
@@ -145,6 +149,8 @@ get_particle_remote(par_dict : dict,
145149
```
146150
- Usage: Return a dictionary that contains requested particle data. The data is scattered in different processes. It is a collective operation.
147151

148-
> {octicon}`alert;1em;sd-text-danger;` This is a collective operation, and it requires every MPI process to participate.
152+
```{attention}
153+
This is a collective operation, and it requires every MPI process to participate.
154+
```
149155

150156
> {octicon}`calendar;1em;sd-text-secondary;` [`get_field_remote`](#get_field_remote) and [`get_particle_remote`](#get_particle_remote) may be hard to use in general case, since we have to prepare those list by ourselves. We will improve this and make it general in the future.

doc/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ hide-toc: true
33
---
44

55
# libyt Documents
6-
{bdg-primary}`version 0.2.0`
6+
{bdg-primary}`version 0.3.0`
77

88
`libyt` is an open source C library for simulation.
99
It is an in situ analysis tool that allows researchers to analyze and visualize data using [`yt`](https://yt-project.org/) or other Python packages in parallel during simulation runtime.

doc/libyt-api/yt_get_gridsptr.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ One `yt_grid` contains the hierarchy of the grid, particle counts, and field dat
1212
1313
### Hierarchy
1414
- `double left_edge[3], right_edge[3]` (Default=`DBL_UNDEFINED`)
15-
- Usage: Grid left and right edge in code units.
15+
- Usage: Grid left and right edge in code units. If it's a 2D/1D-simulation, fill the extra dimension with `0.0` and `1.0` for left and right edge respectively.
1616
- `long id` (Default=`LNG_UNDEFINED`)
1717
- Usage: Grid global id.
1818
- Valid Value: It should be contiguous starting from [`index_offset`](./yt_set_parameters.md#yt_param_yt).
@@ -22,7 +22,7 @@ One `yt_grid` contains the hierarchy of the grid, particle counts, and field dat
2222
- Should be in between `0` and `num_grids - 1`.
2323
- If the grid does not have parent grid, set to `-1`.
2424
- `int grid_dimensions[3]` (Default=`INT_UNDEFINED`)
25-
- Usage: Number of cells along each direction in [x][y][z] <--> [0][1][2] order excluding ghost cells.
25+
- Usage: Number of cells along each direction in [x][y][z] <--> [0][1][2] order excluding ghost cells. If it's a 2D/1D-simulation, fill the extra dimension with `1`.
2626
- `int level` (Default=`INT_UNDEFINED`)
2727
- Usage: AMR level of the grid.
2828
- Valid Value:
@@ -43,7 +43,7 @@ One `yt_grid` contains the hierarchy of the grid, particle counts, and field dat
4343
- Usage: a struct used for wrapping existing data pointers.
4444
- Data member:
4545
- `void* data_ptr`: Data pointer.
46-
- `int data_dimensions[3]`: Dimension of `data_ptr`, which is the actual dimension of this pointer. If `data_ptr` is a 1-dim array, set the last two elements to 0. (This only happens in particle data, and we aren't rely on this value to wrap the data.)
46+
- `int data_dimensions[3]`: Dimension of `data_ptr`, which is the actual dimension of this pointer. If `data_ptr` is a 2/1-dim array, the extra dimension is not in use. (This happens in particle data and 2/1-dimensional simulation, and we aren't rely on this value to wrap the data.)
4747
- `yt_dtype data_dtype`: Data type of `data_ptr`. We only need to set `data_dtype` when this grid's data type is different from the one set in fields'.
4848
- Valid Value: [`yt_dtype`](./data-type.md#yt_dtype)
4949

doc/libyt-api/yt_getgridinfo.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
```cpp
1010
int yt_getGridInfo_Dimensions( const long gid, int (*dimensions)[3] );
1111
```
12-
- Usage: Get dimension of grid `gid`. `dimensions[0]` corresponds to dimension in x-axis, `dimensions[1]` corresponds to dimension in y-axis, and `dimensions[2]` corresponds to dimension in z-axis, excluding ghost cells.
12+
- Usage: Get dimension of grid `gid`. `dimensions[0]` corresponds to dimension in x-axis, `dimensions[1]` corresponds to dimension in y-axis, and `dimensions[2]` corresponds to dimension in z-axis, excluding ghost cells. This also works with 2/1-dimensional simulation. The extra dimension will be filled with `1`.
1313
- Return: `YT_SUCCESS` or `YT_FAIL`
1414
1515
## `yt_getGridInfo_LeftEdge`
1616
```cpp
1717
int yt_getGridInfo_LeftEdge(const long gid, double (*left_edge)[3]);
1818
```
19-
- Usage: Get left edge of grid `gid`. `left_edge[0]` is left edge of the grid in x-axis in code length, `left_edge[1]` for y-axis, and `left_edge[2]` for z-axis.
19+
- Usage: Get left edge of grid `gid`. `left_edge[0]` is left edge of the grid in x-axis in code length, `left_edge[1]` for y-axis, and `left_edge[2]` for z-axis. This also works with 2/1-dimensional simulation. The extra dimension will be filled with `0.0`.
2020
- Return: `YT_SUCCESS` or `YT_FAIL`
2121

2222
## `yt_getGridInfo_RightEdge`
2323
```cpp
2424
int yt_getGridInfo_RightEdge(const long gid, double (*right_edge)[3]);
2525
```
26-
- Usage: Get right edge of grid `gid`. `right_edge[0]` is right edge of the grid in x-axis in code length, `right_edge[1]` for y-axis, and `right_edge[2]` for z-axis.
26+
- Usage: Get right edge of grid `gid`. `right_edge[0]` is right edge of the grid in x-axis in code length, `right_edge[1]` for y-axis, and `right_edge[2]` for z-axis. This also works with 2/1-dimensional simulation. The extra dimension will be filled with `1.0`.
2727
- Return: `YT_SUCCESS` or `YT_FAIL`
2828
2929
## `yt_getGridInfo_ParentId`
@@ -63,7 +63,7 @@ int yt_getGridInfo_FieldData(const long gid, const char *field_name, yt_data *fi
6363
- Return: `YT_SUCCESS` or `YT_FAIL` if it cannot get data.
6464
- `yt_data`
6565
- `data_ptr`: Data pointer.
66-
- `data_dimensions[3]`: Dimension of the `data_ptr` array, in the point of view of itself.
66+
- `data_dimensions[3]`: Dimension of the `data_ptr` array, in the point of view of itself. If it's a 2/1-dim array, the extra dimension will be `1`.
6767
- `data_dtype`: Data type of the array.
6868

6969
> {octicon}`info;1em;sd-text-info;` Field name `field_name` should be same as what you passed in [`yt_get_FieldsPtr`](./field/yt_get_fieldsptr.md#yt_get_fieldsptr).

doc/libyt-api/yt_set_parameters.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int yt_set_Parameters( yt_param_yt *param_yt )
1616
- `const char* fig_basename` (Default=`"Fig"`)
1717
- Usage: Base name of the output figures. Figure name will also be followed by counter number and `yt` functionality name.
1818
- `double domain_left_edge[3], domain_right_edge[3]` (Default=`DBL_UNDEFINED`)
19-
- Usage: Simulation left and right edge in code units.
19+
- Usage: Simulation left and right edge in code units. If it's a 2D/1D-simulation, fill the extra dimension with `0.0` and `1.0` for left and right edge respectively.
2020
- `double current_time` (Default=`DBL_UNDEFINED`)
2121
- Usage: Simulation time in code units.
2222
- `double current_redshift` (Default=`DBL_UNDEFINED`)
@@ -48,10 +48,9 @@ int yt_set_Parameters( yt_param_yt *param_yt )
4848
- `0`: No
4949
- `1`: Yes
5050
- `int dimensionality` (Default=`INT_UNDEFINED`)
51-
- Usage: Dimensionality of the simulation.
52-
> {octicon}`alert;1em;sd-text-danger;` `libyt` only support 3 for now.
51+
- Usage: Dimensionality of the simulation. Support 1/2/3-dimensional simulation.
5352
- `int domain_dimensions[3]` (Default=`INT_UNDEFINED`)
54-
- Usage: Number of cells along each dimension on the root AMR level.
53+
- Usage: Number of cells along each dimension on the root AMR level. If it's a 2D/1D-simulation, fill the extra dimension with `1`.
5554
- `int refine_by` (Default=`INT_UNDEFINED`)
5655
- Usage: Refinement factor between a grid and its subgrid.
5756
- `int index_offset` (Default=`0`)
@@ -81,7 +80,7 @@ param_yt.mass_unit = 1.9885e33; // mass uni
8180
param_yt.time_unit = 3.1557e13; // time unit (sec)
8281
param_yt.velocity_unit = param_yt.length_unit / param_yt.time_unit; // velocity unit (cm/s)
8382
param_yt.current_time = time; // simulation time in code units
84-
param_yt.dimensionality = 3; // dimensionality, support 3 only
83+
param_yt.dimensionality = 3; // dimensionality
8584
param_yt.refine_by = REFINE_BY; // refinement factor between a grid and its subgrid
8685
param_yt.num_grids = num_grids; // number of grids
8786
param_yt.num_grids_local = num_grids_local; // number of local grids

example/amr-example/example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ int main(int argc, char* argv[]) {
176176
param_yt.velocity_unit =
177177
param_yt.length_unit / param_yt.time_unit; // velocity unit (cm/s)
178178
param_yt.current_time = time; // simulation time in code units
179-
param_yt.dimensionality = 3; // dimensionality, support 3 only
179+
param_yt.dimensionality = 3; // dimensionality
180180
param_yt.refine_by = REFINE_BY; // refinement factor between a grid and its subgrid
181181
param_yt.index_offset = 1; // grid id starts at 1. (default is 0-indexed)
182182
param_yt.num_grids = num_grids; // number of grids

0 commit comments

Comments
 (0)