Skip to content

Commit 940b648

Browse files
author
leonardo beltrame
committed
Updated README
1 parent 05ed86d commit 940b648

File tree

1 file changed

+7
-44
lines changed

1 file changed

+7
-44
lines changed

DataFormats/SoATemplate/README.md

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Structure of array (SoA) generation
22

3-
The two header files [`SoALayout.h`](SoALayout.h) and [`SoAView.h`](SoAView.h) define preprocessor macros that
3+
The header file [`SoALayout.h`](SoALayout.h) defines preprocessor macros that
44
allow generating SoA classes. The SoA classes generate multiple, aligned column from a memory buffer. The memory
55
buffer is allocated separately by the user, and can be located in a memory space different from the local one (for
66
example, a SoA located in a GPU device memory can be fully pre-defined on the host and the resulting structure is
@@ -30,21 +30,18 @@ alignment.
3030

3131
## View
3232

33-
`SoAView` is a macro generated templated class allowing access to columns defined in one or multiple `SoALayout`s or
34-
`SoAViews`. The view can be generated in a constant and non-constant flavors. All view flavors provide with the same
35-
interface where scalar elements are accessed with an `operator()`: `soa.scalar()` while columns (Eigen or not) are
36-
accessed via a array of structure (AoS) -like syntax: `soa[index].x()`. The "struct" object returned by `operator[]`
37-
can be used as a shortcut: `auto si = soa[index]; si.z() = si.x() + zi.y();`
38-
39-
A view can be instanciated by being passed the corresponding layout.
40-
4133
Layout classes also define a `View` and `ConstView` subclass that provide access to each column and
4234
scalar of the layout. In addition to those fully parametrized templates, two others levels of parametrization are
4335
provided: `ViewTemplate`, `ViewViewTemplateFreeParams` and respectively `ConstViewTemplate`,
4436
`ConstViewTemplateFreeParams`. The parametrization of those templates is explained in the [Template
4537
parameters section](#template-parameters).
4638

47-
It is also possible to build a generic `View` or `ConstView` passing from the [Metarecords sublass](#metarecords-subclass).
39+
The view can be generated in a constant and non-constant flavors. All view flavors provide with the same
40+
interface where scalar elements are accessed with an `operator()`: `soa.scalar()` while columns (Eigen or not) are
41+
accessed via a array of structure (AoS) -like syntax: `soa[index].x()`. The "struct" object returned by `operator[]`
42+
can be used as a shortcut: `auto si = soa[index]; si.z() = si.x() + si.y();`
43+
44+
A view can be instanciated by being passed the corresponding layout or passing from the [Metarecords subclass](#metarecords-subclass).
4845
This view can point to data belonging to different SoAs and thus not contiguous in memory.
4946

5047
## Descriptor
@@ -199,40 +196,6 @@ AlignedBuffer h_buf (reinterpret_cast<std::byte*>(aligned_alloc(SoA1LayoutAligne
199196
SoA1LayoutAligned soaLayout(h_buf.get(), elements);
200197
```
201198
202-
A view will derive its column types from one or multiple layouts. The macro generating the view takes a list of layouts or views it
203-
gets is data from as a first parameter, and the selection of the columns the view will give access to as a second parameter.
204-
205-
```C++
206-
// A 1 to 1 view of the layout (except for unsupported types).
207-
GENERATE_SOA_VIEW(SoA1ViewTemplate,
208-
SOA_VIEW_LAYOUT_LIST(
209-
SOA_VIEW_LAYOUT(SoA1Layout, soa1)
210-
),
211-
SOA_VIEW_VALUE_LIST(
212-
SOA_VIEW_VALUE(soa1, x),
213-
SOA_VIEW_VALUE(soa1, y),
214-
SOA_VIEW_VALUE(soa1, z),
215-
SOA_VIEW_VALUE(soa1, color),
216-
SOA_VIEW_VALUE(soa1, value),
217-
SOA_VIEW_VALUE(soa1, py),
218-
SOA_VIEW_VALUE(soa1, count),
219-
SOA_VIEW_VALUE(soa1, anotherCount),
220-
SOA_VIEW_VALUE(soa1, description),
221-
SOA_VIEW_VALUE(soa1, someNumber)
222-
)
223-
);
224-
225-
using SoA1View = SoA1ViewTemplate<>;
226-
227-
SoA1View soaView(soaLayout);
228-
229-
for (size_t i=0; i < soaLayout.metadata().size(); ++i) {
230-
auto si = soaView[i];
231-
si.x() = si.y() = i;
232-
soaView.someNumber() += i;
233-
}
234-
```
235-
236199
The mutable and const views with the exact same set of columns and their parametrized variants are provided from the layout as:
237200
238201
```C++

0 commit comments

Comments
 (0)