Skip to content

Commit 513ba3d

Browse files
committed
Use cuda syntax highlighting and label tabs as CUDA C++
Except where Raw strings are used, which pygments CUDA highlighter does not appear to support
1 parent dbe817f commit 513ba3d

20 files changed

+79
-77
lines changed

src/guide/2-model-definition/1-model.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A ``ModelDescription`` is initialised with a name:
1515

1616
.. tabs::
1717

18-
.. code-tab:: cpp
18+
.. code-tab:: cuda CUDA C++
1919

2020
// Create a ModelDescription object called model, initialised with the name "some_model"
2121
flamegpu::ModelDescription model("some_model");

src/guide/2-model-definition/2-environment.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ An ``EnvironmentDescription`` is initialised as shown below:
1515

1616
.. tabs::
1717

18-
.. code-tab:: cpp
18+
.. code-tab:: cuda CUDA C++
1919

2020
// Create an EnvironmentDescription object called env
2121
flamegpu::EnvironmentDescription env;
@@ -48,7 +48,7 @@ Any arithmetic or enum type can be used as an environment property
4848

4949
.. tabs::
5050

51-
.. code-tab:: cpp
51+
.. code-tab:: cuda CUDA C++
5252

5353
// Define environmental properties and their initial values
5454
env.add<float>("f_prop", 12.0f); // Create float property 'f_prop', with value of 12
@@ -70,7 +70,7 @@ An environment can be associated with a particular model using the ``setEnvironm
7070

7171
.. tabs::
7272

73-
.. code-tab:: cpp
73+
.. code-tab:: cuda CUDA C++
7474

7575
// Attach the EnvironmentDescription to a ModelDescription
7676
model.setEnvironment(env);
@@ -85,7 +85,7 @@ Full Example Code From This Page
8585

8686
.. tabs::
8787

88-
.. code-tab:: cpp
88+
.. code-tab:: cuda CUDA C++
8989

9090
// Create an EnvironmentDescription object called env
9191
flamegpu::EnvironmentDescription env;

src/guide/2-model-definition/3-agent.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ FLAMEGPU2 agents are associated with a particular model. As such they are create
1111

1212
.. tabs::
1313

14-
.. code-tab:: cpp
14+
.. code-tab:: cuda CUDA C++
1515

1616
// Create a new agent called 'predator' associated the model 'model'
1717
flamegpu::AgentDescription &predator = model.newAgent("predator");
@@ -41,7 +41,7 @@ User Defined Variables
4141

4242
.. tabs::
4343

44-
.. code-tab:: cpp
44+
.. code-tab:: cuda CUDA C++
4545

4646
// Create two new floating point variables, x and y
4747
predator.newVariable<float>("x");
@@ -67,7 +67,7 @@ Array variables can also be defined by providing a name and array length:
6767

6868
.. tabs::
6969

70-
.. code-tab:: cpp
70+
.. code-tab:: cuda CUDA C++
7171

7272
// Create an array variable called exampleArray which is an array of 3 integers
7373
predator.newVariableArray<int>("exampleArray", 3);
@@ -87,7 +87,7 @@ All newly defined agent types will have a default state, but you can add additio
8787
.. tabs::
8888

8989

90-
.. code-tab:: cpp
90+
.. code-tab:: cuda CUDA C++
9191

9292
// Create two new states, resting and hunting
9393
predator.newState("resting");
@@ -105,7 +105,7 @@ Full Example Code From This Page
105105

106106
.. tabs::
107107

108-
.. code-tab:: cpp
108+
.. code-tab:: cuda CUDA C++
109109

110110
// Create a new agent called 'predator' associated the model 'model'
111111
flamegpu::AgentDescription &predator = model.newAgent("predator");

src/guide/3-behaviour-definition/1-defining-agent-functions.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For Non-RTC functions, when using the C++ interface, the ``FLAMEGPU_AGENT_FUNCTI
2727

2828
.. tabs::
2929

30-
.. code-tab:: cpp
30+
.. code-tab:: cuda CUDA C++
3131

3232
// Define an agent function called agent_fn1 - specified ahead of main function
3333
FLAMEGPU_AGENT_FUNCTION(agent_fn1, flamegpu::MessageNone, flamegpu::MessageNone) {
@@ -45,9 +45,10 @@ For Non-RTC functions, when using the C++ interface, the ``FLAMEGPU_AGENT_FUNCTI
4545

4646
When using the Run-Time Compiled (RTC) functions, optionally in the C++ interface or required by the Python interface, the function must be defined in a string and associated with the AgentDescription using the ``newRTCFunction`` method.
4747

48+
.. cpp syntax highlighting due to issues with the cuda highlighter and raw strings.
4849
.. tabs::
4950

50-
.. code-tab:: cpp
51+
.. code-tab:: cpp CUDA C++
5152

5253
const char* agent_fn1_source = R"###(
5354
// Define an agent function called agent_fn1 - specified ahead of main function
@@ -89,7 +90,7 @@ If you wish to define regular functions which can be used within agent function
8990

9091
.. tabs::
9192

92-
.. code-tab:: cpp
93+
.. code-tab:: cuda CUDA C++
9394

9495
// Define a function for adding two integers which can be called inside agent functions.
9596
FLAMEGPU_DEVICE_FUNCTION int add(int a, int b) {
@@ -103,7 +104,7 @@ If you wish to define regular functions which can be used within agent function
103104

104105
.. tabs::
105106

106-
.. code-tab:: cpp
107+
.. code-tab:: cuda CUDA C++
107108

108109
// Define a function for subtracting two integers which can be called inside agent functions, or in host code
109110
FLAMEGPU_HOST_DEVICE_FUNCTION int subtract(int a, int b) {
@@ -113,9 +114,10 @@ If you wish to define regular functions which can be used within agent function
113114
Full Example Code From This Page
114115
--------------------------------
115116

117+
.. cpp syntax highlighting due to issues with the cuda highlighter and raw strings.
116118
.. tabs::
117119

118-
.. code-tab:: cpp
120+
.. code-tab:: cpp CUDA C++
119121

120122
// Define a function for adding two integers which can be called inside agent functions.
121123
FLAMEGPU_DEVICE_FUNCTION int add(int a, int b) {

src/guide/3-behaviour-definition/2-modifying-agent-variables.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ To achieve the high performance of FLAMEGPU2, agent behaviours must be implement
1313

1414
.. tabs::
1515

16-
.. code-tab:: cpp
16+
.. code-tab:: cuda CUDA C++
1717

1818
FLAMEGPU_AGENT_FUNCTION(ExampleFn, flamegpu::MessageNone, flamegpu::MessageNone) {
1919
// Get the value of agent variable 'x' and store it in local variable 'x'
@@ -34,7 +34,7 @@ in a single function call, during agent functions, elements must be accessed ind
3434

3535
.. tabs::
3636

37-
.. code-tab:: cpp
37+
.. code-tab:: cuda CUDA C++
3838

3939
FLAMEGPU_AGENT_FUNCTION(ExampleFn, flamegpu::MessageNone, flamegpu::MessageNone) {
4040
// Return agent variable 'location[1]' and store it in local variable 'y'

src/guide/3-behaviour-definition/3-interacting-with-environment.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Environmental properties are accessed as follows:
88

99
.. tabs::
1010

11-
.. code-tab:: cpp
11+
.. code-tab:: cuda CUDA C++
1212

1313
FLAMEGPU_AGENT_FUNCTION(ExampleFn, flamegpu::MessageNone, flamegpu::MessageNone) {
1414
// Get the value of environment variable 'interaction_radius' and store it in local variable 'interaction_radius'

src/guide/3-behaviour-definition/4-agent-communication.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ A new message type can defined using one of the above symbols:
2626

2727
.. tabs::
2828

29-
.. code-tab:: cpp
29+
.. code-tab:: cuda CUDA C++
3030

3131
// Create a new message type called "location" which uses the brute force communication strategy
3232
flamegpu::MessageBruteForce::Description &locationMessage = model.newMessage("location");
@@ -42,7 +42,7 @@ Data the message should contain can then be defined using the ``newVariable`` me
4242

4343
.. tabs::
4444

45-
.. code-tab:: cpp
45+
.. code-tab:: cuda CUDA C++
4646

4747
// Add a variable of type "int" with name "id" to the "location_message" type
4848
locationMessage.newVariable<int>("id");
@@ -60,7 +60,7 @@ and must match that of the message type:
6060

6161
.. tabs::
6262

63-
.. code-tab:: cpp
63+
.. code-tab:: cuda CUDA C++
6464

6565
// Define an agent function, "outputdata" which has no input messages and outputs a message using the "MessageBruteForce" communication strategy
6666
FLAMEGPU_AGENT_FUNCTION(outputdata, flamegpu::MessageNone, flamegpu::MessageBruteForce) {
@@ -71,7 +71,7 @@ and must match that of the message type:
7171
To specify the type of message the function should output, the ``setMessageOutput`` method of the ``AgentFunctionDescription`` object is used:
7272

7373
.. tabs::
74-
.. code-tab:: cpp
74+
.. code-tab:: cuda CUDA C++
7575

7676
// Specify that the "outputdata" agent function outputs a "location_message"
7777
outputdata.setMessageOutput("location_message");
@@ -85,7 +85,7 @@ The agent function will now output a message of type "location_message". The var
8585

8686
.. tabs::
8787

88-
.. code-tab:: cpp
88+
.. code-tab:: cuda CUDA C++
8989

9090
// Define an agent function, "outputdata" which has no input messages and outputs a message using the "MessageBruteForce" communication strategy
9191
FLAMEGPU_AGENT_FUNCTION(outputdata, flamegpu::MessageNone, flamegpu::MessageBruteForce) {
@@ -99,7 +99,7 @@ If you are using ``MessageSpatial2D`` or ``MessageSpatial3D`` then your message
9999

100100
.. tabs::
101101

102-
.. code-tab:: cpp
102+
.. code-tab:: cuda CUDA C++
103103

104104
// Define an agent function, "outputdata" which has no input messages and outputs a message using the "MessageSpatial3D" communication strategy
105105
FLAMEGPU_AGENT_FUNCTION(outputdata, flamegpu::MessageNone, flamegpu::MessageSpatial3D) {
@@ -114,7 +114,7 @@ You must also specify the interaction radius via the ``MessageDescription`` obje
114114

115115
.. tabs::
116116

117-
.. code-tab:: cpp
117+
.. code-tab:: cuda CUDA C++
118118

119119
// Specify that the "outputdata" agent function has an interaction radius of 2.0f
120120
outputdata.setMessageOutput(2.0f);
@@ -130,7 +130,7 @@ If you are using ``MessageArray1D``, ``MessageArray2D`` or ``MessageArray3D`` th
130130

131131
.. tabs::
132132

133-
.. code-tab:: cpp
133+
.. code-tab:: cuda CUDA C++
134134

135135
// Define an agent function, "outputdata" which has no input messages and outputs a message using the "MessageArray3D" communication strategy
136136
FLAMEGPU_AGENT_FUNCTION(outputdata, flamegpu::MessageNone, flamegpu::MessageArray3D) {
@@ -148,7 +148,7 @@ Reading a message is very similar to sending one. The second argument in the age
148148

149149
.. tabs::
150150

151-
.. code-tab:: cpp
151+
.. code-tab:: cuda CUDA C++
152152

153153
// Define an agent function, "inputdata" which has accepts an input message using the "MessageBruteForce" communication strategy and inputs no messages
154154
FLAMEGPU_AGENT_FUNCTION(inputdata, flamegpu::MessageBruteForce, flamegpu::MessageNone) {
@@ -161,7 +161,7 @@ The input message type is specified using the ``setMessageInput`` method of the
161161

162162
.. tabs::
163163

164-
.. code-tab:: cpp
164+
.. code-tab:: cuda CUDA C++
165165

166166
// Specify that the "inputdata" agent function inputs a "location_message"
167167
inputdata.setMessageInput("location_message");
@@ -176,7 +176,7 @@ With the input message type specified, the message list will be available in the
176176

177177
.. tabs::
178178

179-
.. code-tab:: cpp
179+
.. code-tab:: cuda CUDA C++
180180

181181
// Define an agent function, "inputdata" which has accepts an input message using the "MessageBruteForce" communication strategy and inputs no messages
182182
FLAMEGPU_AGENT_FUNCTION(inputdata, flamegpu::MessageBruteForce, flamegpu::MessageNone) {
@@ -193,7 +193,7 @@ Spatial messaging will return all messages within the radius specified at the mo
193193

194194
.. tabs::
195195

196-
.. code-tab:: cpp
196+
.. code-tab:: cuda CUDA C++
197197

198198
// Define an agent function, "inputdata" which has accepts an input message using the "MessageSpatial3D" communication strategy and inputs no messages
199199
FLAMEGPU_AGENT_FUNCTION(inputdata, flamegpu::MessageSpatial3D, flamegpu::MessageNone) {
@@ -230,7 +230,7 @@ Messages can be accessed from a specific array index:
230230

231231
.. tabs::
232232

233-
.. code-tab:: cpp
233+
.. code-tab:: cuda CUDA C++
234234

235235
// Define an agent function, "inputdata" which has accepts an input message using the "MessageSpatial3D" communication strategy and inputs no messages
236236
FLAMEGPU_AGENT_FUNCTION(inputdata, flamegpu::MessageArray3D, flamegpu::MessageNone) {
@@ -249,7 +249,7 @@ Similar to spatial messaging, array messages can be used to iterate the exclusiv
249249

250250
.. tabs::
251251

252-
.. code-tab:: cpp
252+
.. code-tab:: cuda CUDA C++
253253

254254
// Define an agent function, "inputdata" which has accepts an input message using the "MessageSpatial3D" communication strategy and inputs no messages
255255
FLAMEGPU_AGENT_FUNCTION(inputdata, flamegpu::MessageArray3D, flamegpu::MessageNone) {
@@ -271,7 +271,7 @@ If wrapping of array bounds is required, then an alternate iterator method ``wra
271271

272272
.. tabs::
273273

274-
.. code-tab:: cpp
274+
.. code-tab:: cuda CUDA C++
275275

276276
// Define an agent function, "inputdata" which has accepts an input message using the "MessageSpatial3D" communication strategy and inputs no messages
277277
FLAMEGPU_AGENT_FUNCTION(inputdata, flamegpu::MessageArray3D, flamegpu::MessageNone) {

0 commit comments

Comments
 (0)