192{
193 if (!op) {
195 "Cannot set null operator");
196 return;
197 }
198
201 "ParticleNetwork: unsupported operator type '{}' rejected as primary. "
202 "The primary must own PointVertex storage; a chain operator need not.",
203 op->get_type_name());
204 return;
205 }
206
208 const char* new_name = op->get_type_name().data();
209
211 "Switching operator: '{}' → '{}'",
212 old_name, new_name);
213
214 std::vector<PointVertex> vertices;
215
216 if (
auto* old_graphics =
dynamic_cast<PhysicsOperator*
>(
m_operator.get())) {
217 vertices = old_graphics->extract_vertices();
218
220 "Extracted {} vertices from old operator",
221 vertices.size());
222 }
else if (
auto* old_field =
dynamic_cast<FieldOperator*
>(
m_operator.get())) {
223 vertices = old_field->extract_point_vertices();
224
226 "Extracted {} vertices from old FieldOperator",
227 vertices.size());
230 }
231
232 if (auto* new_graphics = dynamic_cast<PhysicsOperator*>(op.get())) {
233 new_graphics->initialize(vertices);
234
235 if (auto* physics = dynamic_cast<PhysicsOperator*>(op.get())) {
237 }
238
240 "Initialized new graphics operator with {} points",
241 vertices.size());
242 }
243
244 if (auto* new_field = dynamic_cast<FieldOperator*>(op.get())) {
245 new_field->initialize(vertices);
246
248 "Initialized new FieldOperator with {} points",
249 vertices.size());
250 }
251
253
254 if (
auto* physics =
dynamic_cast<PhysicsOperator*
>(
m_operator.get())) {
256 physics->enable_spatial_interactions(should_interact);
257 }
258
260 "Operator switched successfully to '{}'", new_name);
261}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
Topology get_topology() const
Get the current topology.
Kinesis::SamplerBounds m_bounds
std::vector< PointVertex > generate_initial_vertices()
static bool is_compatible(const NetworkOperator &op) noexcept
Whether an operator can serve as this network's primary.
std::unique_ptr< NetworkOperator > m_operator
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
@ SPATIAL
Dynamic proximity-based (nodes within radius interact)