48 #define max(a,b) ( (a) > (b) ? (a) : (b) )
49 #define min(a,b) ( (a) < (b) ? (a) : (b) )
71 if( num_vecs != 2 || vecs == NULL )
73 if( num_targ_vecs != 1 || targ_vecs == NULL )
75 if( targ_vecs[0].sub_dim != vecs[0].sub_dim
76 || targ_vecs[0].sub_dim != vecs[1].sub_dim )
85 x_val = targ_vecs[0].
values;
98 if( x_val_s == 1 && xl_val_s == 1 && xu_val_s == 1 ) {
100 for( k = 0; k < sub_dim; ++k, ++x_val, ++xl_val, ++xu_val ) {
101 if( *x_val < *xl_val )
103 else if( *x_val > *xu_val )
109 for( k = 0; k < sub_dim; ++k, x_val+=x_val_s, xl_val+=xl_val_s, xu_val+=xu_val_s ) {
110 if( *x_val < *xl_val )
112 else if( *x_val > *xu_val )
125 ,
"TOp_force_in_bounds"
185 if( num_vecs != 2 || ( num_vecs && vecs == NULL ) )
187 if( num_targ_vecs != 1 || ( num_targ_vecs && targ_vecs == NULL ) )
190 vecs[1].sub_dim != vecs[0].sub_dim
191 || targ_vecs[0].sub_dim != vecs[0].sub_dim
202 z0_val = targ_vecs[0].
values;
215 for( k = 0; k < sub_dim; ++k, v0_val += v0_val_s, v1_val += v1_val_s, z0_val += z0_val_s )
218 xl_sb =
min((*v0_val) + (*rel_push)*((*v1_val)-(*v0_val)), (*v0_val) + (*abs_push));
219 xu_sb =
max((*v1_val) - (*rel_push)*((*v1_val)-(*v0_val)), (*v1_val) - (*abs_push));
222 (*z0_val) = (*v0_val) + ((*v1_val)-(*v0_val))/2.0;
224 else if ((*z0_val) < xl_sb)
225 { (*z0_val) = xl_sb; }
226 else if ((*z0_val) > xu_sb)
227 { (*z0_val) = xu_sb; }
239 ,
"TOp_force_in_bounds_buffer"
272 *ptr_rel_push = rel_push;
273 *ptr_abs_push = abs_push;
static int RTOp_TOp_force_in_bounds_apply_op(const struct RTOp_RTOp_vtbl_t *vtbl, const void *obj_data, const int num_vecs, const struct RTOp_SubVector vecs[], const int num_targ_vecs, const struct RTOp_MutableSubVector targ_vecs[], RTOp_ReductTarget targ_obj)
int(* obj_create)(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj)
const struct RTOp_obj_type_vtbl_t RTOp_obj_value_value_vtbl
const struct RTOp_obj_type_vtbl_t * obj_data_vtbl
int RTOp_TOp_force_in_bounds_buffer_init(RTOp_value_type rel_push, RTOp_value_type abs_push, struct RTOp_RTOp *op)
const struct RTOp_RTOp_vtbl_t RTOp_TOp_force_in_bounds_buffer_vtbl
#define RTOp_ERR_INCOMPATIBLE_VECS
const struct RTOp_RTOp_vtbl_t RTOp_TOp_force_in_bounds_vtbl
const RTOp_value_type * values
#define RTOp_ERR_INVALID_NUM_VECS
int(* obj_free)(const struct RTOp_obj_type_vtbl_t *vtbl, const void *instance_data, void **obj)
int RTOp_TOp_force_in_bounds_destroy(struct RTOp_RTOp *op)
const struct RTOp_obj_type_vtbl_t RTOp_obj_null_vtbl
const struct RTOp_RTOp_vtbl_t * vtbl
static int RTOp_TOp_force_in_bounds_buffer_apply_op(const struct RTOp_RTOp_vtbl_t *vtbl, const void *obj_data, const int num_vecs, const struct RTOp_SubVector vecs[], const int num_targ_vecs, const struct RTOp_MutableSubVector targ_vecs[], RTOp_ReductTarget reduct_obj)
int RTOp_TOp_force_in_bounds_buffer_construct(RTOp_value_type rel_push, RTOp_value_type abs_push, struct RTOp_RTOp *op)
#define RTOp_ERR_INVALID_NUM_TARG_VECS
int RTOp_TOp_force_in_bounds_buffer_destroy(struct RTOp_RTOp *op)
int RTOp_TOp_force_in_bounds_construct(struct RTOp_RTOp *op)
Teuchos_Ordinal RTOp_index_type