Create IDS with Arrays of Structures (AoS)ΒΆ
See also
API documentation for ids_init()
This example focuses on creating empty IDS and allocating arrays inside IDS structure.
% empty IDS structures can be created without opening data entry
% all you have to do is to instantiate IDS object
empty_core_profiles = ids_init('core_profiles');
% Note! Every IDS must have <ids>/ids_properties/homogeneous_time field set with one of possible values
% Possible homogeneous_time values are:
% 0 - IDS_TIME_MODE_HETEROGENEOUS: All time-dependent quantities in the IDS may have different time coordinates.
% 1 - IDS_TIME_MODE_HOMOGENEOUS: All time-dependent quantities in this IDS use the same time coordinate, namely <ids>/time
% 2 - IDS_TIME_MODE_INDEPENDENT: The IDS stores no time-dependent data.
empty_core_profiles.ids_properties.homogeneous_time = 1;
% it is also recommended to provide basic information regarding data source
% even though this information is not required to store IDS, it is highly recommended
% to fill these fields.
% <ids>/ids_properties/comment
% <ids>/ids_properties/provider
% <ids>/ids_properties/creation_date
% when ids_properties.homogeneous_time is set to IDS_TIME_MODE_HOMOGENEOUS,
% all time-dependent fields values correspond to <ids>.time vector.
empty_core_profiles.time = [1.0, 2.0, 3.0];
% size of time dependent variables must be equal to the size of time vector
empty_core_profiles.global_quantities.ip = [1.0, 2.0, 3.0];
% IDSs can be printed using frpintf() method.
fprintf('Dumping empty_core_profiles:\n');
fprintf('\tempty_core_profiles.ids_properties.homogeneous_time: %i\n', empty_core_profiles.ids_properties.homogeneous_time);
fprintf('\tempty_core_profiles.time: %i %i %i\n', empty_core_profiles.time);
fprintf('\tempty_core_profiles.global_quantities.ip: %i %i %i\n', empty_core_profiles.global_quantities.ip);
fprintf('\n');
% some fields are automatically written by AL during 'put' procedure
% AL adds some information behind your back. This is particularly important
% in case you want later on find out what particular version of AL was used when data were stored.
% examples of this type of fields are <ids>/ids_properties/version_put and <ids>/ids_properties/plugins
% this time we do not save IDS into database entry, all we do here is deallocating the memory
% we have allocated in all previous steps.
clear empty_core_profiles;
Output
Dumping empty_core_profiles:
empty_core_profiles.ids_properties.homogeneous_time: 1
empty_core_profiles.time: 1 2 3
empty_core_profiles.global_quantities.ip: 1 2 3