prg_profiles_merge_bt()
Abstract
Creates a new profile by merging two existing profiles.
Syntax
prg_profiles_merge_bt (merge_op, profile_a, profile_b, options)
| Argument | Type | Description |
|---|---|---|
merge_op |
PrgT_Profile_Merge_Op |
Merge operation to perform (see merge_op Argument in Details). |
profile_a |
PrgT_Profile_Handle |
Handle to the first source profile. |
profile_b |
PrgT_Profile_Handle |
Handle to the second source profile. |
options |
int |
Data options (see options Argument in Details). |
Return Type
PrgT_Profile_Handle
Handle to the new, merged profile.
Header
prg_profile_funcs.h
Details
This function takes two profiles and creates a new, unattached profile based on the x-y data from both source profiles. (String data in the profile is not merged.) The source profiles are unchanged. You must attach the new profile to a profile library before using it.
The source profiles must have the same x and y units. The start times of the profiles are compared to ensure proper alignment of the data. The resulting profile will have the earlier of the two start times.
Only y values that overlap and are both defined are merged; undefined values in the profiles being merged are ignored.
merge_op Argument
The new profile contains one entry for each unique x value in the source profiles. The y values in the new profile are determined according to the value of merge_op.
PrgC_Profile_Merge_Add—Each new y value is the sum of the corresponding y values in the source profiles.PrgC_Profile_Merge_Min—Each new y value is the smaller of the corresponding y values in the source profiles.PrgC_Profile_Merge_Max—Each new y value is the larger of the corresponding y values in the source profiles.PrgC_Profile_Merge_Avg—Each new y value is the average of the corresponding y values in the source profiles.
options Argument
The options argument is a bit-OR'ed combination of the following:
-
PRGC_PROFILE_MERGE_OPT_NONE -
PRGC_PROFILE_MERGE_OPT_USE_START_TIME—Consider profile start times when merging. Either both profiles or neither must specify a start time. -
PRGC_PROFILE_MERGE_OPT_START_TIME_FORCED—Use in conjunction withPRGC_PROFILE_MERGE_OPT_USE_START_TIMEto consider profile start times even if only one profile specifies a start time. -
PRGC_PROFILE_MERGE_OPT_NO_MERGE_LAST—Do not merge the last data point of a profile with any later data points in the other profile.By default, the y value of the last entry of a profile is assumed to extend indefinitely. This can cause unexpected results when two unrelated profiles are merged, because the last entry in one profile will be merged with all later entries in the other profile. When you specify this option, the last entry of a profile will extend only until the first subsequent entry in the other profile.
Figure 4 shows the results of merging two profiles in both default mode and with the
PRGC_PROFILE_MERGE_OPT_NO_MERGE_LASToption (merge_opis set toPrgC_Profile_Merge_Add).
Figure 4: Profile Merge Example
Merged Profile Merged Profile
Profile A Profile B (Default) (With option)
--------- --------- -------------- --------------
0 100 0 100 0 100
100 400 100 400 100 400
150 200 150 600 150 600
200 600 200 500 200 1100 200 1100
300 300 300 900 300 300
400 100 400 700 400 100
To get the functionality of the deprecated function prg_profiles_merge(), call this function with options set to PRGC_PROFILE_MERGE_OPT_NONE.
Symbolic Constants
Table 3: Profile Package/Data Sub-Package Symbolic Constants
| Description | Type | Symbolic Constant |
|---|---|---|
| Invalid profile handle | PrgT_Profile_Handle |
PRGC_NIL_PROFILE_HANDLE |
| Data options | int |
PRGC_PROFILE_DATA_OPT_NONEPRGC_PROFILE_DATA_OPT_TIME_ABSPRGC_PROFILE_DATA_OPT_INCLUDE_INITIALPRGC_PROFILE_DATA_OPT_INCLUDE_UNDEFINED |
| Merge operations | PrgT_Profile_Merge_Op |
PrgC_Profile_Merge_AddPrgC_Profile_Merge_MinPrgC_Profile_Merge_MaxPrgC_Profile_Merge_Avg |
| Merge options | int |
PRGC_PROFILE_MERGE_OPT_NONEPRGC_PROFILE_MERGE_OPT_USE_START_TIMEPRGC_PROFILE_MERGE_OPT_START_TIME_FORCEDPRGC_PROFILE_MERGE_OPT_NO_MERGE_LAST |
| Scaling operation | PrgT_Profile_Scale_Op |
PrgC_Profile_Scale_Op_AddPrgC_Profile_Scale_Op_Multiply |