void UserApplication<Scalar, ParallelModel>::evaluateField( const std::string &field_name, const EvaluationSet<Kokkos::LayoutLeft, MemorySpace> eval_set, Field<Scalar, Kokkos::LayoutLeft, MemorySpace> field ) { // Ask the user to evaluate the field. View<Coordinate> evaluation_points( eval_set.evaluation_points ); View<LocalOrdinal> object_ids( eval_set.object_ids ); View<Scalar> values( field.dofs ); callUserFunction( _user_functions->_eval_field_func, field_name, evaluation_points, object_ids, values ); }
// ------------------------------------------------------------------------------------------ void write_segment_text(FILE *my_file) { int i, objnum; fprintf(my_file, "-----------------------------------------------------------------------------\n"); fprintf(my_file, "Segment stuff:\n"); for (i=0; i<=Highest_segment_index; i++) { fprintf(my_file, "Segment %4i: ", i); if (Segment2s[i].special != 0) fprintf(my_file, "special = %3i (%s), value = %3i ", Segment2s[i].special, Special_names[Segment2s[i].special], Segment2s[i].value); if (Segment2s[i].matcen_num != -1) fprintf(my_file, "matcen = %3i, ", Segment2s[i].matcen_num); fprintf(my_file, "\n"); } for (i=0; i<=Highest_segment_index; i++) { int depth; objnum = Segments[i].objects; fprintf(my_file, "Segment %4i: ", i); depth=0; if (objnum != -1) { fprintf(my_file, "Objects: "); while (objnum != -1) { fprintf(my_file, "[%8s %8s %3i] ", object_types(objnum), object_ids(objnum), objnum); objnum = Objects[objnum].next; if (depth++ > 30) { fprintf(my_file, "\nAborted after %i links\n", depth); break; } } } fprintf(my_file, "\n"); } }
// ---------------------------------------------------------------------------- void write_segment_text(FILE *my_file) { int i, nObject; fprintf(my_file, "-----------------------------------------------------------------------------\n"); fprintf(my_file, "Segment stuff:\n"); for (i=0; i<=gameData.segs.nLastSegment; i++) { fprintf(my_file, "Segment %4i: ", i); if (gameData.segs.segment2s[i].special != 0) fprintf(my_file, "special = %3i (%s), value = %3i ", gameData.segs.segment2s[i].special, Special_names[gameData.segs.segment2s[i].special], gameData.segs.segment2s[i].value); if (gameData.segs.segment2s[i].nMatCen != -1) fprintf(my_file, "matcen = %3i, ", gameData.segs.segment2s[i].nMatCen); fprintf(my_file, "\n"); } for (i=0; i<=gameData.segs.nLastSegment; i++) { int depth; nObject = gameData.segs.segments[i].objects; fprintf(my_file, "Segment %4i: ", i); depth=0; if (nObject != -1) { fprintf(my_file, "gameData.objs.objects: "); while (nObject != -1) { fprintf(my_file, "[%8s %8s %3i] ", objectTypes(nObject), object_ids(nObject), nObject); nObject = gameData.objs.objects[nObject].next; if (depth++ > 30) { fprintf(my_file, "\nAborted after %i links\n", depth); break; } } } fprintf(my_file, "\n"); } }
// ------------------------------------------------------------------------------------------------- say_totals(FILE *my_file, char *level_name) { int i; //, objnum; int total_robots = 0; int objects_processed = 0; int used_objects[MAX_OBJECTS]; fprintf(my_file, "\nLevel %s\n", level_name); for (i=0; i<MAX_OBJECTS; i++) used_objects[i] = 0; while (objects_processed < Highest_object_index+1) { int j, objtype, objid, objcount, cur_obj_val, min_obj_val, min_objnum; // Find new min objnum. min_obj_val = 0x7fff0000; min_objnum = -1; for (j=0; j<=Highest_object_index; j++) { if (!used_objects[j] && Objects[j].type!=OBJ_NONE) { cur_obj_val = Objects[j].type * 1000 + Objects[j].id; if (cur_obj_val < min_obj_val) { min_objnum = j; min_obj_val = cur_obj_val; } } } if ((min_objnum == -1) || (Objects[min_objnum].type == 255)) break; objcount = 0; objtype = Objects[min_objnum].type; objid = Objects[min_objnum].id; for (i=0; i<=Highest_object_index; i++) { if (!used_objects[i]) { if (((Objects[i].type == objtype) && (Objects[i].id == objid)) || ((Objects[i].type == objtype) && (objtype == OBJ_PLAYER)) || ((Objects[i].type == objtype) && (objtype == OBJ_COOP)) || ((Objects[i].type == objtype) && (objtype == OBJ_HOSTAGE))) { if (Objects[i].type == OBJ_ROBOT) total_robots++; used_objects[i] = 1; objcount++; objects_processed++; } } } if (objcount) { fprintf(my_file, "Object: "); fprintf(my_file, "%8s %8s %3i\n", object_types(min_objnum), object_ids(min_objnum), objcount); } } fprintf(my_file, "Total robots = %3i\n", total_robots); }