Skip to content

Commit

Permalink
Switch boids_spatial3D to use the dependency graph
Browse files Browse the repository at this point in the history
  • Loading branch information
ptheywood committed Oct 19, 2022
1 parent 9eebb85 commit 3f1858d
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions examples/boids_spatial3D/src/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -361,29 +361,28 @@ int main(int argc, const char ** argv) {
message.newVariable<float>("fy");
message.newVariable<float>("fz");
}
{ // Boid agent
flamegpu::AgentDescription &agent = model.newAgent("Boid");
agent.newVariable<float>("x");
agent.newVariable<float>("y");
agent.newVariable<float>("z");
agent.newVariable<float>("fx");
agent.newVariable<float>("fy");
agent.newVariable<float>("fz");
agent.newFunction("outputdata", outputdata).setMessageOutput("location");
agent.newFunction("inputdata", inputdata).setMessageInput("location");
}

/**
* Control flow
*/
{ // Layer #1
flamegpu::LayerDescription &layer = model.newLayer();
layer.addAgentFunction(outputdata);
}
{ // Layer #2
flamegpu::LayerDescription &layer = model.newLayer();
layer.addAgentFunction(inputdata);
}
// Boid agent
flamegpu::AgentDescription &agent = model.newAgent("Boid");
agent.newVariable<float>("x");
agent.newVariable<float>("y");
agent.newVariable<float>("z");
agent.newVariable<float>("fx");
agent.newVariable<float>("fy");
agent.newVariable<float>("fz");
flamegpu::AgentFunctionDescription& outputdataDescription = agent.newFunction("outputdata", outputdata);
outputdataDescription.setMessageOutput("location");
flamegpu::AgentFunctionDescription& inputdataDescription = agent.newFunction("inputdata", inputdata);
inputdataDescription.setMessageInput("location");

// Dependency specification
inputdataDescription.dependsOn(outputdataDescription);

// Identify the root of execution
model.addExecutionRoot(outputdataDescription);

// Build the execution graph
model.generateLayers();


/**
Expand Down

0 comments on commit 3f1858d

Please sign in to comment.