169 REAL(DP),
INTENT(OUT) :: ABSOLUTE_TOLERANCE
170 INTEGER(INTG),
INTENT(OUT) :: ERR
174 enters(
"DATA_PROJECTION_ABSOLUTE_TOLERANCE_GET",err,error,*999)
176 IF(
ASSOCIATED(data_projection))
THEN 177 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 178 absolute_tolerance=data_projection%ABSOLUTE_TOLERANCE
180 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
183 CALL flag_error(
"Data projection is not associated.",err,error,*999)
186 exits(
"DATA_PROJECTION_ABSOLUTE_TOLERANCE_GET")
188 999 errorsexits(
"DATA_PROJECTION_ABSOLUTE_TOLERANCE_GET",err,error)
202 REAL(DP),
INTENT(IN) :: ABSOLUTE_TOLERANCE
203 INTEGER(INTG),
INTENT(OUT) :: ERR
207 enters(
"DATA_PROJECTION_ABSOLUTE_TOLERANCE_SET",err,error,*999)
209 IF(
ASSOCIATED(data_projection))
THEN 210 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 211 CALL flag_error(
"Data projection have been finished.",err,error,*999)
213 IF(absolute_tolerance>=0)
THEN 214 data_projection%ABSOLUTE_TOLERANCE=absolute_tolerance
216 CALL flag_error(
"Data projection absolute tolerance must be a positive real number.",err,error,*999)
220 CALL flag_error(
"Data projection is not associated.",err,error,*999)
223 exits(
"DATA_PROJECTION_ABSOLUTE_TOLERANCE_SET")
225 999 errorsexits(
"DATA_PROJECTION_ABSOLUTE_TOLERANCE_SET",err,error)
236 & candidate_elements,number_of_candidates,closest_elements,closest_distances,err,error,*)
241 REAL(DP),
INTENT(IN) :: POINT_VALUES(:)
242 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENTS(:)
243 INTEGER(INTG),
INTENT(IN) :: NUMBER_OF_CANDIDATES
244 INTEGER(INTG),
INTENT(OUT) :: CLOSEST_ELEMENTS(:)
245 REAL(DP),
INTENT(OUT) :: CLOSEST_DISTANCES(:)
246 INTEGER(INTG),
INTENT(OUT) :: ERR
250 INTEGER(INTG) :: REGION_DIMENSIONS
251 INTEGER(INTG) :: NUMBER_OF_CLOSEST_CANDIDATES
252 REAL(DP) :: DISTANCE_VECTOR(3)
253 REAL(DP) :: DISTANCE2
255 INTEGER(INTG) :: ELEMENT_NUMBER,insert_idx
257 enters(
"DATA_PROJECTION_CLOSEST_ELEMENTS_FIND",err,error,*999)
259 IF(
ASSOCIATED(data_projection))
THEN 260 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 261 region_dimensions=data_projection%COORDINATE_SYSTEM_DIMENSIONS
262 number_of_closest_candidates=
SIZE(closest_elements,1)
264 DO nce=1,number_of_closest_candidates
265 element_number=candidate_elements(nce)
266 CALL field_interpolation_parameters_element_get(field_values_set_type,element_number, &
267 & interpolated_point%INTERPOLATION_PARAMETERS,err,error,*999,field_geometric_components_type)
268 CALL field_interpolate_xi(
no_part_deriv,data_projection%STARTING_XI,interpolated_point,err,error,*999, &
269 & field_geometric_components_type)
270 distance_vector(1:region_dimensions) = point_values-interpolated_point%VALUES(:,1)
271 distance2 = dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
272 DO insert_idx=nce,1,-1
273 IF(insert_idx>1)
THEN 274 IF(distance2<closest_distances(insert_idx-1)) cycle
277 IF(insert_idx<nce)
THEN 278 closest_distances(insert_idx+1:nce)=closest_distances(insert_idx:nce-1)
279 closest_elements(insert_idx+1:nce)=closest_elements(insert_idx:nce-1)
281 closest_distances(insert_idx)=distance2
282 closest_elements(insert_idx)=element_number
287 DO nce=number_of_closest_candidates+1,number_of_candidates
288 element_number=candidate_elements(nce)
289 CALL field_interpolation_parameters_element_get(field_values_set_type,element_number, &
290 & interpolated_point%INTERPOLATION_PARAMETERS,err,error,*999,field_geometric_components_type)
291 CALL field_interpolate_xi(
no_part_deriv,data_projection%STARTING_XI,interpolated_point,err,error,*999, &
292 & field_geometric_components_type)
293 distance_vector(1:region_dimensions)=point_values - interpolated_point%VALUES(:,1)
294 distance2 = dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
295 IF(distance2<closest_distances(number_of_closest_candidates))
THEN 296 DO insert_idx=number_of_closest_candidates,1,-1
297 IF(insert_idx>1)
THEN 298 IF(distance2<closest_distances(insert_idx-1)) cycle
301 IF(insert_idx<number_of_closest_candidates)
THEN 302 closest_distances(insert_idx+1:number_of_closest_candidates)=closest_distances(insert_idx: &
303 & number_of_closest_candidates-1)
304 closest_elements(insert_idx+1:number_of_closest_candidates)=closest_elements(insert_idx: &
305 & number_of_closest_candidates-1)
307 closest_distances(insert_idx)=distance2
308 closest_elements(insert_idx)=element_number
315 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
318 CALL flag_error(
"Data projection is not associated.",err,error,*999)
321 exits(
"DATA_PROJECTION_CLOSEST_ELEMENTS_FIND")
323 999 errorsexits(
"DATA_PROJECTION_CLOSEST_ELEMENTS_FIND",err,error)
334 & candidate_element_faces,number_of_candidates,closest_elements,closest_element_faces,closest_distances,err,error,*)
339 REAL(DP),
INTENT(IN) :: POINT_VALUES(:)
340 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENTS(:)
341 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENT_FACES(:)
342 INTEGER(INTG),
INTENT(IN) :: NUMBER_OF_CANDIDATES
343 INTEGER(INTG),
INTENT(OUT) :: CLOSEST_ELEMENTS(:)
344 INTEGER(INTG),
INTENT(OUT) :: CLOSEST_ELEMENT_FACES(:)
345 REAL(DP),
INTENT(OUT) :: CLOSEST_DISTANCES(:)
346 INTEGER(INTG),
INTENT(OUT) :: ERR
349 INTEGER(INTG) :: REGION_DIMENSIONS
350 INTEGER(INTG) :: NUMBER_OF_CLOSEST_CANDIDATES
351 REAL(DP) :: DISTANCE_VECTOR(3)
352 REAL(DP) :: DISTANCE2
354 INTEGER(INTG) :: ELEMENT_NUMBER,ELEMENT_FACE_NUMBER,FACE_NUMBER,insert_idx
356 enters(
"DATA_PROJECTION_CLOSEST_FACES_FIND",err,error,*999)
357 IF(
ASSOCIATED(data_projection))
THEN 358 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 359 region_dimensions=data_projection%COORDINATE_SYSTEM_DIMENSIONS
360 number_of_closest_candidates=
SIZE(closest_elements,1)
362 DO nce=1,number_of_closest_candidates
363 element_number=candidate_elements(nce)
364 element_face_number=candidate_element_faces(nce)
365 face_number=interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%TOPOLOGY%ELEMENTS%ELEMENTS( &
366 & element_number)%ELEMENT_FACES(element_face_number)
367 CALL field_interpolation_parameters_face_get(field_values_set_type,face_number, &
368 & interpolated_point%INTERPOLATION_PARAMETERS,err,error,*999,field_geometric_components_type)
369 CALL field_interpolate_xi(
no_part_deriv,data_projection%STARTING_XI,interpolated_point,err,error,*999, &
370 & field_geometric_components_type)
371 distance_vector(1:region_dimensions) = point_values-interpolated_point%VALUES(:,1)
372 distance2 = dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
373 DO insert_idx=nce,1,-1
374 IF(insert_idx>1)
THEN 375 IF(distance2<closest_distances(insert_idx-1)) cycle
378 IF(insert_idx<nce)
THEN 379 closest_distances(insert_idx+1:nce)=closest_distances(insert_idx:nce-1)
380 closest_elements(insert_idx+1:nce)=closest_elements(insert_idx:nce-1)
381 closest_element_faces(insert_idx+1:nce)=closest_element_faces(insert_idx:nce-1)
383 closest_distances(insert_idx)=distance2
384 closest_elements(insert_idx)=element_number
385 closest_element_faces(insert_idx)=element_face_number
390 DO nce=number_of_closest_candidates+1,number_of_candidates
391 element_number=candidate_elements(nce)
392 element_face_number=candidate_element_faces(nce)
393 face_number=interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%TOPOLOGY%ELEMENTS%ELEMENTS( &
394 & element_number)%ELEMENT_FACES(element_face_number)
395 CALL field_interpolation_parameters_face_get(field_values_set_type,face_number, &
396 & interpolated_point%INTERPOLATION_PARAMETERS,err,error,*999,field_geometric_components_type)
397 CALL field_interpolate_xi(
no_part_deriv,data_projection%STARTING_XI,interpolated_point,err,error,*999, &
398 & field_geometric_components_type)
399 distance_vector(1:region_dimensions)=point_values - interpolated_point%VALUES(:,1)
400 distance2 = dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
401 IF(distance2<closest_distances(number_of_closest_candidates))
THEN 402 DO insert_idx=number_of_closest_candidates,1,-1
403 IF(insert_idx>1)
THEN 404 IF(distance2<closest_distances(insert_idx-1)) cycle
407 IF(insert_idx<number_of_closest_candidates)
THEN 408 closest_distances(insert_idx+1:number_of_closest_candidates)=closest_distances(insert_idx: &
409 & number_of_closest_candidates-1)
410 closest_elements(insert_idx+1:number_of_closest_candidates)=closest_elements(insert_idx: &
411 & number_of_closest_candidates-1)
412 closest_element_faces(insert_idx+1:number_of_closest_candidates)=closest_element_faces(insert_idx: &
413 & number_of_closest_candidates-1)
415 closest_distances(insert_idx)=distance2
416 closest_elements(insert_idx)=element_number
417 closest_element_faces(insert_idx)=element_face_number
424 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
427 CALL flag_error(
"Data projection is not associated.",err,error,*999)
430 exits(
"DATA_PROJECTION_CLOSEST_FACES_FIND")
432 999 errorsexits(
"DATA_PROJECTION_CLOSEST_FACES_FIND",err,error)
443 & candidate_element_lines,number_of_candidates,closest_elements,closest_element_lines,closest_distances,err,error,*)
448 REAL(DP),
INTENT(IN) :: POINT_VALUES(:)
449 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENTS(:)
450 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENT_LINES(:)
451 INTEGER(INTG),
INTENT(IN) :: NUMBER_OF_CANDIDATES
452 INTEGER(INTG),
INTENT(OUT) :: CLOSEST_ELEMENTS(:)
453 INTEGER(INTG),
INTENT(OUT) :: CLOSEST_ELEMENT_LINES(:)
454 REAL(DP),
INTENT(OUT) :: CLOSEST_DISTANCES(:)
455 INTEGER(INTG),
INTENT(OUT) :: ERR
458 INTEGER(INTG) :: REGION_DIMENSIONS
459 INTEGER(INTG) :: NUMBER_OF_CLOSEST_CANDIDATES
460 REAL(DP) :: DISTANCE_VECTOR(3)
461 REAL(DP) :: DISTANCE2
463 INTEGER(INTG) :: ELEMENT_NUMBER,ELEMENT_LINE_NUMBER,LINE_NUMBER,insert_idx
465 enters(
"DATA_PROJECTION_CLOSEST_LINES_FIND",err,error,*999)
466 IF(
ASSOCIATED(data_projection))
THEN 467 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 468 region_dimensions=data_projection%COORDINATE_SYSTEM_DIMENSIONS
469 number_of_closest_candidates=
SIZE(closest_elements,1)
471 DO nce=1,number_of_closest_candidates
472 element_number=candidate_elements(nce)
473 element_line_number=candidate_element_lines(nce)
474 line_number=interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%TOPOLOGY%ELEMENTS%ELEMENTS( &
475 & element_number)%ELEMENT_LINES(element_line_number)
476 CALL field_interpolation_parameters_line_get(field_values_set_type,line_number, &
477 & interpolated_point%INTERPOLATION_PARAMETERS,err,error,*999,field_geometric_components_type)
478 CALL field_interpolate_xi(
no_part_deriv,data_projection%STARTING_XI,interpolated_point,err,error,*999, &
479 & field_geometric_components_type)
480 distance_vector(1:region_dimensions) = point_values-interpolated_point%VALUES(:,1)
481 distance2 = dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
482 DO insert_idx=nce,1,-1
483 IF(insert_idx>1)
THEN 484 IF(distance2<closest_distances(insert_idx-1)) cycle
487 IF(insert_idx<nce)
THEN 488 closest_distances(insert_idx+1:nce)=closest_distances(insert_idx:nce-1)
489 closest_elements(insert_idx+1:nce)=closest_elements(insert_idx:nce-1)
490 closest_element_lines(insert_idx+1:nce)=closest_element_lines(insert_idx:nce-1)
492 closest_distances(insert_idx)=distance2
493 closest_elements(insert_idx)=element_number
494 closest_element_lines(insert_idx)=element_line_number
499 DO nce=number_of_closest_candidates+1,number_of_candidates
500 element_number=candidate_elements(nce)
501 element_line_number=candidate_element_lines(nce)
502 line_number=interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%TOPOLOGY%ELEMENTS%ELEMENTS( &
503 & element_number)%ELEMENT_LINES(element_line_number)
504 CALL field_interpolation_parameters_line_get(field_values_set_type,line_number, &
505 & interpolated_point%INTERPOLATION_PARAMETERS,err,error,*999,field_geometric_components_type)
506 CALL field_interpolate_xi(
no_part_deriv,data_projection%STARTING_XI,interpolated_point,err,error,*999, &
507 & field_geometric_components_type)
508 distance_vector(1:region_dimensions)=point_values - interpolated_point%VALUES(:,1)
509 distance2 = dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
510 IF(distance2<closest_distances(number_of_closest_candidates))
THEN 511 DO insert_idx=number_of_closest_candidates,1,-1
512 IF(insert_idx>1)
THEN 513 IF(distance2<closest_distances(insert_idx-1)) cycle
516 IF(insert_idx<number_of_closest_candidates)
THEN 517 closest_distances(insert_idx+1:number_of_closest_candidates)=closest_distances(insert_idx: &
518 & number_of_closest_candidates-1)
519 closest_elements(insert_idx+1:number_of_closest_candidates)=closest_elements(insert_idx: &
520 & number_of_closest_candidates-1)
521 closest_element_lines(insert_idx+1:number_of_closest_candidates)=closest_element_lines(insert_idx: &
522 & number_of_closest_candidates-1)
524 closest_distances(insert_idx)=distance2
525 closest_elements(insert_idx)=element_number
526 closest_element_lines(insert_idx)=element_line_number
533 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
536 CALL flag_error(
"Data projection is not associated.",err,error,*999)
539 exits(
"DATA_PROJECTION_CLOSEST_LINES_FIND")
541 999 errorsexits(
"DATA_PROJECTION_CLOSEST_LINES_FIND",err,error)
555 INTEGER(INTG),
INTENT(OUT) :: ERR
559 enters(
"DATA_PROJECTION_CREATE_FINISH",err,error,*999)
561 IF(
ASSOCIATED(data_projection))
THEN 562 IF(
ASSOCIATED(data_projection%DATA_POINTS))
THEN 563 IF(data_projection%DATA_POINTS%DATA_POINTS_FINISHED)
THEN 564 IF(
ASSOCIATED(data_projection%MESH))
THEN 565 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 566 CALL flag_error(
"Data projection have already been finished.",err,error,*999)
568 data_projection%DATA_PROJECTION_FINISHED=.true.
573 CALL flag_error(
"Data projection mesh is not associated.",err,error,*999)
576 CALL flag_error(
"Data projection data points have not been finished.",err,error,*999)
579 CALL flag_error(
"Data projection data points is not associated.",err,error,*999)
582 CALL flag_error(
"Data projection is not associated.",err,error,*999)
585 exits(
"DATA_PROJECTION_CREATE_FINISH")
587 999 errorsexits(
"DATA_PROJECTION_CREATE_FINISH",err,error)
600 INTEGER(INTG),
INTENT(IN) :: DATA_PROJECTION_USER_NUMBER
604 INTEGER(INTG),
INTENT(OUT) :: ERR
608 INTEGER(INTG) :: DATA_POINTS_REGION_DIMENSIONS,MESH_REGION_DIMENSIONS,INSERT_STATUS
609 INTEGER(INTG) :: xi_idx,data_projection_idx
611 enters(
"DATA_PROJECTION_CREATE_START_DATA_POINTS",err,error,*999)
613 NULLIFY(data_projection)
614 IF(
ASSOCIATED(data_points))
THEN 615 IF(data_points%DATA_POINTS_FINISHED)
THEN 616 IF(
ASSOCIATED(mesh))
THEN 617 IF(
ASSOCIATED(data_projection))
THEN 618 CALL flag_error(
"Data projection is already associated.",err,error,*999)
620 IF(
ASSOCIATED(data_points%REGION))
THEN 621 data_points_region_dimensions=data_points%REGION%COORDINATE_SYSTEM%NUMBER_OF_DIMENSIONS
622 ELSEIF(
ASSOCIATED(data_points%INTERFACE))
THEN 623 data_points_region_dimensions=data_points%INTERFACE%COORDINATE_SYSTEM%NUMBER_OF_DIMENSIONS
625 CALL flag_error(
"Data points is not associated with a region or a interface.",err,error,*999)
627 IF(
ASSOCIATED(mesh%REGION))
THEN 628 mesh_region_dimensions=mesh%REGION%COORDINATE_SYSTEM%NUMBER_OF_DIMENSIONS
629 ELSEIF(
ASSOCIATED(mesh%INTERFACE))
THEN 630 mesh_region_dimensions=mesh%INTERFACE%COORDINATE_SYSTEM%NUMBER_OF_DIMENSIONS
632 CALL flag_error(
"Mesh is not associated with a region or a interface.",err,error,*999)
634 IF(data_points_region_dimensions==mesh_region_dimensions)
THEN 635 ALLOCATE(data_projection,stat=err)
636 IF(err/=0)
CALL flag_error(
"Could not allocate data projection.",err,error,*999)
637 data_projection%USER_NUMBER=data_projection_user_number
638 data_projection%LABEL=
"" 639 CALL tree_item_insert(data_points%DATA_PROJECTIONS_TREE,data_projection_user_number, &
640 & data_points%NUMBER_OF_DATA_PROJECTIONS+1,insert_status,err,error,*999)
641 data_projection%DATA_PROJECTION_FINISHED=.false.
642 data_projection%DATA_POINTS=>data_points
643 data_projection%MESH=>mesh
644 data_projection%COORDINATE_SYSTEM_DIMENSIONS=data_points_region_dimensions
645 data_projection%MAXIMUM_ITERATION_UPDATE=0.5_dp
646 data_projection%MAXIMUM_NUMBER_OF_ITERATIONS=25
648 IF(mesh%NUMBER_OF_DIMENSIONS<data_points_region_dimensions)
THEN 649 data_projection%NUMBER_OF_XI=mesh%NUMBER_OF_DIMENSIONS
652 SELECT CASE(mesh%NUMBER_OF_DIMENSIONS)
654 data_projection%NUMBER_OF_XI=1
657 data_projection%NUMBER_OF_XI=2
660 CALL flag_error(
"Mesh dimensions out of bond [1,3].",err,error,*999)
663 SELECT CASE(data_projection%NUMBER_OF_XI)
665 data_projection%NUMBER_OF_CLOSEST_ELEMENTS=2
667 data_projection%NUMBER_OF_CLOSEST_ELEMENTS=4
669 data_projection%NUMBER_OF_CLOSEST_ELEMENTS=8
671 CALL flag_error(
"Mesh dimensions out of bond [1,3].",err,error,*999)
673 ALLOCATE(data_projection%STARTING_XI(data_projection%NUMBER_OF_XI),stat=err)
674 IF(err/=0)
CALL flag_error(
"Could not allocate data points data projection starting xi.",err,error,*999)
675 DO xi_idx=1,data_projection%NUMBER_OF_XI
676 data_projection%STARTING_XI(xi_idx)=0.5_dp
678 data_projection%ABSOLUTE_TOLERANCE=1.0e-8_dp
679 data_projection%RELATIVE_TOLERANCE=1.0e-6_dp
680 IF(data_points%NUMBER_OF_DATA_PROJECTIONS>0)
THEN 681 ALLOCATE(new_data_projections_ptr(data_points%NUMBER_OF_DATA_PROJECTIONS+1),stat=err)
682 IF(err/=0)
CALL flag_error(
"Could not allocate new data projections.",err,error,*999)
683 DO data_projection_idx=1,data_points%NUMBER_OF_DATA_PROJECTIONS
684 new_data_projections_ptr(data_projection_idx)%PTR=>data_points%DATA_PROJECTIONS(data_projection_idx)%PTR
686 ELSE IF(data_points%NUMBER_OF_DATA_PROJECTIONS==0)
THEN 687 ALLOCATE(new_data_projections_ptr(data_points%NUMBER_OF_DATA_PROJECTIONS+1),stat=err)
688 IF(err/=0)
CALL flag_error(
"Could not allocate new data projections.",err,error,*999)
690 CALL flag_error(
"The number of data projections is < 0.",err,error,*999)
693 new_data_projections_ptr(data_points%NUMBER_OF_DATA_PROJECTIONS+1)%PTR=>data_projection
694 CALL move_alloc(new_data_projections_ptr,data_points%DATA_PROJECTIONS)
695 data_points%NUMBER_OF_DATA_PROJECTIONS=data_points%NUMBER_OF_DATA_PROJECTIONS+1
696 data_projection%GLOBAL_NUMBER=data_points%NUMBER_OF_DATA_PROJECTIONS
698 CALL flag_error(
"Dimensions bewtween the mesh region/interface and data points region/interface does not match.", &
703 CALL flag_error(
"Mesh is not associated.",err,error,*999)
706 CALL flag_error(
"Data points have not been finished.",err,error,*999)
709 CALL flag_error(
"Data points is not associated.",err,error,*999)
712 exits(
"DATA_PROJECTION_CREATE_START_DATA_POINTS")
714 999 errorsexits(
"DATA_PROJECTION_CREATE_START_DATA_POINTS",err,error)
728 INTEGER(INTG) :: dataPointUserNumber
729 LOGICAL,
INTENT(OUT) :: dataPointExist
730 INTEGER(INTG),
INTENT(OUT) :: dataPointGlobalNumber
731 INTEGER(INTG),
INTENT(OUT) :: err
737 enters(
"DataProjection_DataPointCheckExist",err,error,*999)
739 datapointexist=.false.
740 datapointglobalnumber=0
741 IF(
ASSOCIATED(dataprojection))
THEN 742 datapoints=>dataprojection%DATA_POINTS
743 IF(
ASSOCIATED(datapoints))
THEN 745 CALL tree_search(datapoints%DATA_POINTS_TREE,datapointusernumber,treenode,err,error,*999)
746 IF(
ASSOCIATED(treenode))
THEN 747 CALL tree_node_value_get(datapoints%DATA_POINTS_TREE,treenode,datapointglobalnumber,err,error,*999)
748 datapointexist=.true.
751 CALL flag_error(
"Data points is not associated.",err,error,*999)
754 CALL flag_error(
"Data projection is not associated.",err,error,*999)
757 exits(
"DataProjection_DataPointCheckExist")
759 999 errorsexits(
"DataProjection_DataPointCheckExist",err,error)
773 INTEGER(INTG),
INTENT(OUT) :: ERR
776 INTEGER(INTG) :: NUMBER_OF_DATA_POINTS
777 INTEGER(INTG) :: data_point_idx
779 enters(
"DataProjection_DataProjectionResultInitialise",err,error,*999)
782 IF(
ASSOCIATED(data_projection))
THEN 783 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 784 IF(
ASSOCIATED(data_projection%DATA_POINTS))
THEN 785 IF(data_projection%DATA_POINTS%DATA_POINTS_FINISHED)
THEN 786 number_of_data_points = data_projection%DATA_POINTS%NUMBER_OF_DATA_POINTS
787 ALLOCATE(data_projection%DATA_PROJECTION_RESULTS(number_of_data_points),stat=err)
788 IF(err/=0)
CALL flag_error(
"Could not allocate data projection data projection results.",err,error,*999)
789 DO data_point_idx=1,number_of_data_points
790 data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%USER_NUMBER=data_projection%DATA_POINTS%DATA_POINTS( &
791 & data_point_idx)%USER_NUMBER
792 data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%DISTANCE=0.0_dp
793 data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%ELEMENT_NUMBER=0
794 data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%ELEMENT_FACE_NUMBER=0
795 data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%ELEMENT_LINE_NUMBER=0
797 ALLOCATE(data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%XI(data_projection%NUMBER_OF_XI),stat=err)
798 ALLOCATE(data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%projectionVector( &
799 & data_projection%COORDINATE_SYSTEM_DIMENSIONS),stat=err)
800 IF(err/=0)
CALL flag_error(
"Could not allocate data projection data projection results "// &
802 data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%XI(1:data_projection%NUMBER_OF_XI)= &
803 & data_projection%STARTING_XI(1:data_projection%NUMBER_OF_XI)
804 data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%projectionVector( &
805 & 1:data_projection%COORDINATE_SYSTEM_DIMENSIONS)=0.0_dp
808 CALL flag_error(
"Data projection data points have not been finished.",err,error,*999)
811 CALL flag_error(
"Data projection data points is not associated.",err,error,*999)
814 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
817 CALL flag_error(
"Data projection is not associated.",err,error,*999)
820 exits(
"DataProjection_DataProjectionResultInitialise")
822 999
errors(
"DataProjection_DataProjectionResultInitialise",err,error)
823 exits(
"DataProjection_DataProjectionResultInitialise")
837 INTEGER(INTG),
INTENT(OUT) :: ERR
841 enters(
"DATA_PROJECTION_DESTROY",err,error,*999)
843 IF(
ASSOCIATED(data_projection))
THEN 846 CALL flag_error(
"Data projection is not associated.",err,error,*999)
849 exits(
"DATA_PROJECTION_DESTROY")
851 999 errorsexits(
"DATA_PROJECTION_DESTROY",err,error)
865 INTEGER(INTG),
INTENT(OUT) :: ERR
868 INTEGER(INTG) :: dataPointIdx
870 enters(
"DATA_PROJECTION_FINALISE",err,error,*999)
872 IF(
ASSOCIATED(data_projection))
THEN 873 IF(
ALLOCATED(data_projection%STARTING_XI))
THEN 874 DEALLOCATE(data_projection%STARTING_XI)
876 IF(
ALLOCATED(data_projection%DATA_PROJECTION_RESULTS))
THEN 877 DO datapointidx=1,
SIZE(data_projection%DATA_PROJECTION_RESULTS,1)
878 data_projection%DATA_PROJECTION_RESULTS(datapointidx)%USER_NUMBER=0
879 data_projection%DATA_PROJECTION_RESULTS(datapointidx)%DISTANCE=0
880 data_projection%DATA_PROJECTION_RESULTS(datapointidx)%ELEMENT_NUMBER=0
881 data_projection%DATA_PROJECTION_RESULTS(datapointidx)%ELEMENT_FACE_NUMBER=0
882 data_projection%DATA_PROJECTION_RESULTS(datapointidx)%ELEMENT_LINE_NUMBER=0
883 data_projection%DATA_PROJECTION_RESULTS(datapointidx)%EXIT_TAG=0
884 IF(
ALLOCATED(data_projection%DATA_PROJECTION_RESULTS(datapointidx)%XI))
THEN 885 DEALLOCATE(data_projection%DATA_PROJECTION_RESULTS(datapointidx)%XI)
887 IF(
ALLOCATED(data_projection%DATA_PROJECTION_RESULTS(datapointidx)%projectionVector))
THEN 888 DEALLOCATE(data_projection%DATA_PROJECTION_RESULTS(datapointidx)%projectionVector)
891 DEALLOCATE(data_projection%DATA_PROJECTION_RESULTS)
893 DEALLOCATE(data_projection)
895 CALL flag_error(
"Data projection is not associated.",err,error,*999)
898 exits(
"DATA_PROJECTION_FINALISE")
900 999 errorsexits(
"DATA_PROJECTION_FINALISE",err,error)
914 INTEGER(INTG),
INTENT(IN) :: USER_NUMBER
915 INTEGER(INTG),
INTENT(OUT) :: GLOBAL_NUMBER
916 INTEGER(INTG),
INTENT(OUT) :: ERR
923 enters(
"DataProjection_DataPointGlobalNumberGet",err,error,*999)
925 IF(
ASSOCIATED(data_projection))
THEN 926 data_points=>data_projection%DATA_POINTS
927 IF(
ASSOCIATED(data_points))
THEN 929 CALL tree_search(data_points%DATA_POINTS_TREE,user_number,tree_node,err,error,*999)
930 IF(
ASSOCIATED(tree_node))
THEN 931 CALL tree_node_value_get(data_points%DATA_POINTS_TREE,tree_node,global_number,err,error,*999)
933 local_error=
"Tree node is not associates (cannot find the user number "//
trim(
number_to_vstring(user_number,
"*",err, &
938 CALL flag_error(
"Data points is not associated.",err,error,*999)
941 CALL flag_error(
"Data projection is not associated.",err,error,*999)
944 exits(
"DataProjection_DataPointGlobalNumberGet")
946 999 errorsexits(
"DataProjection_DataPointGlobalNumberGet",err,error)
962 INTEGER(INTG),
INTENT(OUT) :: ERR
972 INTEGER(INTG) :: MY_COMPUTATIONAL_NODE,NUMBER_COMPUTATIONAL_NODES
973 INTEGER(INTG) :: MESH_COMPONENT_NUMBER,NUMBER_OF_DATA_POINTS
974 INTEGER(INTG) :: NUMBER_OF_ELEMENTS,NUMBER_OF_FACES,NUMBER_OF_LINES,NUMBER_OF_CANDIDATES
975 INTEGER(INTG) :: NUMBER_OF_CLOSEST_CANDIDATES,TOTAL_NUMBER_OF_CLOSEST_CANDIDATES,REDUCED_NUMBER_OF_CLOSEST_CANDIDATES
976 INTEGER(INTG),
ALLOCATABLE :: GLOBAL_TO_LOCAL_NUMBER_OF_CLOSEST_CANDIDATES(:)
977 INTEGER(INTG),
ALLOCATABLE :: CANDIDATE_ELEMENTS(:),CLOSEST_ELEMENTS(:,:),CANDIDATE_FACES(:),CLOSEST_FACES(:,:)
979 REAL(DP),
ALLOCATABLE :: CLOSEST_DISTANCES(:,:),GLOBAL_CLOSEST_DISTANCES(:,:)
980 INTEGER(INTG),
ALLOCATABLE :: GLOBAL_NUMBER_OF_CLOSEST_CANDIDATES(:)
981 INTEGER(INTG),
ALLOCATABLE :: GLOBAL_MPI_DISPLACEMENTS(:),SORTING_IND_1(:),SORTING_IND_2(:)
982 INTEGER(INTG),
ALLOCATABLE :: GLOBAL_NUMBER_OF_PROJECTED_POINTS(:)
983 INTEGER(INTG) :: MPI_CLOSEST_DISTANCES,DATA_PROJECTION_GLOBAL_NUMBER
984 INTEGER(INTG) :: MPI_IERROR
987 INTEGER(INTG),
ALLOCATABLE :: PROJECTED_ELEMENT(:),PROJECTED_FACE(:),PROJECTION_EXIT_TAG(:)
988 REAL(DP),
ALLOCATABLE :: PROJECTED_DISTANCE(:,:),PROJECTED_XI(:,:), PROJECTION_VECTORS(:,:)
990 INTEGER(INTG) :: ne,nse,ncn,ni,localElementNumber
991 INTEGER(INTG) :: temp_number,start_idx,finish_idx,data_point_idx
993 LOGICAL :: BOUNDARY_PROJECTION,elementExists,ghostElement
997 enters(
"DataProjection_DataPointsProjectionEvaluate",err,error,*999)
999 NULLIFY(interpolation_parameters)
1000 NULLIFY(interpolated_points)
1001 IF(
ASSOCIATED(data_projection))
THEN 1002 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 1003 IF(
ASSOCIATED(projection_field))
THEN 1004 IF(projection_field%FIELD_FINISHED)
THEN 1005 IF(
ASSOCIATED(data_projection%MESH,projection_field%DECOMPOSITION%MESH))
THEN 1006 data_projection%PROJECTION_FIELD=>projection_field
1007 data_projection_global_number=data_projection%GLOBAL_NUMBER
1008 data_points=>data_projection%DATA_POINTS
1009 CALL field_interpolation_parameters_initialise(projection_field,interpolation_parameters,err,error,*998, &
1010 & field_geometric_components_type)
1011 CALL field_interpolated_points_initialise(interpolation_parameters,interpolated_points,err,error,*998, &
1012 & field_geometric_components_type)
1013 interpolated_point=>interpolated_points(field_u_variable_type)%PTR
1014 decomposition=>projection_field%DECOMPOSITION
1015 mesh_component_number=projection_field%DECOMPOSITION%MESH_COMPONENT_NUMBER
1016 domain=>projection_field%DECOMPOSITION%DOMAIN(mesh_component_number)%PTR
1017 number_of_data_points=data_points%NUMBER_OF_DATA_POINTS
1026 number_of_elements=domain%TOPOLOGY%ELEMENTS%NUMBER_OF_ELEMENTS
1027 number_of_faces=domain%TOPOLOGY%FACES%NUMBER_OF_FACES
1028 number_of_lines=domain%TOPOLOGY%LINES%NUMBER_OF_LINES
1029 number_of_candidates=0
1030 IF(
ALLOCATED(data_projection%candidateElementNumbers) .AND.
ALLOCATED(data_projection%localFaceLineNumbers))
THEN 1031 SELECT CASE(data_projection%PROJECTION_TYPE)
1033 ALLOCATE(candidate_elements(number_of_lines),stat=err)
1034 IF(err/=0)
CALL flag_error(
"Could not allocate candidate elements.",err,error,*999)
1035 ALLOCATE(candidate_faces(number_of_lines),stat=err)
1036 IF(err/=0)
CALL flag_error(
"Could not allocate candidate lines.",err,error,*999)
1037 DO ne=1,
SIZE(data_projection%candidateElementNumbers,1)
1038 CALL decomposition_topology_element_check_exists(decomposition%TOPOLOGY,data_projection% &
1039 & candidateelementnumbers(ne),elementexists,localelementnumber,ghostelement,err,error,*999)
1040 IF((elementexists) .AND. (.NOT.ghostelement))
THEN 1041 number_of_candidates=number_of_candidates+1
1042 candidate_elements(number_of_candidates)=localelementnumber
1043 candidate_faces(number_of_candidates)=data_projection%localFaceLineNumbers(ne)
1047 IF(decomposition%MESH%NUMBER_OF_DIMENSIONS>=2)
THEN 1048 ALLOCATE(candidate_elements(number_of_faces),stat=err)
1049 IF(err/=0)
CALL flag_error(
"Could not allocate candidate elements.",err,error,*999)
1050 ALLOCATE(candidate_faces(number_of_faces),stat=err)
1051 IF(err/=0)
CALL flag_error(
"Could not allocate candidate faces.",err,error,*999)
1052 DO ne=1,
SIZE(data_projection%candidateElementNumbers,1)
1053 CALL decomposition_topology_element_check_exists(decomposition%TOPOLOGY,data_projection% &
1054 & candidateelementnumbers(ne),elementexists,localelementnumber,ghostelement,err,error,*999)
1055 IF((elementexists) .AND. (.NOT.ghostelement))
THEN 1056 number_of_candidates=number_of_candidates+1
1057 candidate_elements(number_of_candidates)=localelementnumber
1058 candidate_faces(number_of_candidates)=data_projection%localFaceLineNumbers(ne)
1062 CALL flag_error(
"Decomposition mesh number of dimensions has to be 2 or greater.",err,error,*999)
1065 IF(data_projection%NUMBER_OF_XI==decomposition%MESH%NUMBER_OF_DIMENSIONS)
THEN 1066 ALLOCATE(candidate_elements(number_of_elements),stat=err)
1067 IF(err/=0)
CALL flag_error(
"Could not allocate candidate elements.",err,error,*999)
1068 DO ne=1,
SIZE(data_projection%candidateElementNumbers,1)
1069 CALL decomposition_topology_element_check_exists(decomposition%TOPOLOGY,data_projection% &
1070 & candidateelementnumbers(ne),elementexists,localelementnumber,ghostelement,err,error,*999)
1071 IF((elementexists) .AND. (.NOT.ghostelement))
THEN 1072 number_of_candidates=number_of_candidates+1
1073 candidate_elements(number_of_candidates)=localelementnumber
1077 CALL flag_error(
"Data projection number of xi has to equal to decomposition mesh number of dimensions",err, &
1081 CALL flag_error(
"No match for data projection type found",err,error,*999)
1084 SELECT CASE(data_projection%PROJECTION_TYPE)
1086 ALLOCATE(candidate_elements(number_of_lines),stat=err)
1087 IF(err/=0)
CALL flag_error(
"Could not allocate candidate elements.",err,error,*999)
1088 ALLOCATE(candidate_faces(number_of_lines),stat=err)
1089 IF(err/=0)
CALL flag_error(
"Could not allocate candidate lines.",err,error,*999)
1090 DO ne=1,domain%MAPPINGS%ELEMENTS%NUMBER_OF_LOCAL
1091 IF(decomposition%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%BOUNDARY_ELEMENT)
THEN 1092 DO nse=1,
SIZE(decomposition%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%ELEMENT_LINES,1)
1093 temp_number=decomposition%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%ELEMENT_LINES(nse)
1094 IF(decomposition%TOPOLOGY%LINES%LINES(temp_number)%BOUNDARY_LINE)
THEN 1095 number_of_candidates=number_of_candidates+1
1096 candidate_faces(number_of_candidates)=nse
1097 candidate_elements(number_of_candidates)=ne
1103 IF(decomposition%MESH%NUMBER_OF_DIMENSIONS>=2)
THEN 1104 ALLOCATE(candidate_elements(number_of_faces),stat=err)
1105 IF(err/=0)
CALL flag_error(
"Could not allocate candidate elements.",err,error,*999)
1106 ALLOCATE(candidate_faces(number_of_faces),stat=err)
1107 IF(err/=0)
CALL flag_error(
"Could not allocate candidate faces.",err,error,*999)
1108 DO ne=1,domain%MAPPINGS%ELEMENTS%NUMBER_OF_LOCAL
1109 IF(decomposition%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%BOUNDARY_ELEMENT)
THEN 1110 DO nse=1,
SIZE(decomposition%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%ELEMENT_FACES,1)
1111 temp_number=decomposition%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%ELEMENT_FACES(nse)
1112 IF(decomposition%TOPOLOGY%FACES%FACES(temp_number)%BOUNDARY_FACE)
THEN 1113 number_of_candidates=number_of_candidates+1
1114 candidate_faces(number_of_candidates)=nse
1115 candidate_elements(number_of_candidates)=ne
1121 CALL flag_error(
"Decomposition mesh number of dimensions has to be 2 or greater.",err,error,*999)
1124 IF(data_projection%NUMBER_OF_XI==decomposition%MESH%NUMBER_OF_DIMENSIONS)
THEN 1125 ALLOCATE(candidate_elements(number_of_elements),stat=err)
1126 IF(err/=0)
CALL flag_error(
"Could not allocate candidate elements.",err,error,*999)
1127 DO ne=1,domain%MAPPINGS%ELEMENTS%NUMBER_OF_LOCAL
1128 number_of_candidates=number_of_candidates+1
1129 candidate_elements(number_of_candidates)=ne
1132 CALL flag_error(
"Data projection number of xi has to equal to decomposition mesh number of dimensions",err, &
1136 CALL flag_error(
"No match for data projection type found",err,error,*999)
1142 number_of_closest_candidates=min(data_projection%NUMBER_OF_CLOSEST_ELEMENTS,number_of_candidates)
1143 ALLOCATE(closest_elements(number_of_data_points,number_of_closest_candidates),stat=err)
1144 IF(err/=0)
CALL flag_error(
"Could not allocate closest elements.",err,error,*999)
1145 IF(boundary_projection)
THEN 1146 ALLOCATE(closest_faces(number_of_data_points,number_of_closest_candidates),stat=err)
1147 IF(err/=0)
CALL flag_error(
"Could not allocate closest sub element.",err,error,*999)
1149 ALLOCATE(closest_distances(number_of_data_points,number_of_closest_candidates),stat=err)
1150 IF(err/=0)
CALL flag_error(
"Could not allocate closest distances.",err,error,*999)
1151 SELECT CASE(data_projection%PROJECTION_TYPE)
1153 DO data_point_idx=1,number_of_data_points
1155 & data_points%DATA_POINTS(data_point_idx)%position,candidate_elements, &
1156 & candidate_faces,number_of_candidates,closest_elements(data_point_idx,:),closest_faces( &
1157 & data_point_idx,:),closest_distances(data_point_idx,:),err,error,*999)
1160 DO data_point_idx=1,number_of_data_points
1162 & data_points%DATA_POINTS(data_point_idx)%position,candidate_elements, &
1163 & candidate_faces,number_of_candidates,closest_elements(data_point_idx,:),closest_faces( &
1164 & data_point_idx,:),closest_distances(data_point_idx,:),err,error,*999)
1167 DO data_point_idx=1,number_of_data_points
1169 & data_point_idx)%position,candidate_elements,number_of_candidates,closest_elements(data_point_idx,:), &
1170 & closest_distances(data_point_idx,:),err,error,*999)
1174 CALL flag_error(
"No match for data projection type found",err,error,*999)
1179 IF(number_computational_nodes>1)
THEN 1181 ALLOCATE(global_to_local_number_of_closest_candidates(number_of_data_points),stat=err)
1182 IF(err/=0)
CALL flag_error(
"Could not allocate global to local number of closest elements.",err,error,*999)
1183 ALLOCATE(global_number_of_closest_candidates(number_computational_nodes),stat=err)
1184 IF(err/=0)
CALL flag_error(
"Could not allocate all number of closest candidates.",err,error,*999)
1185 ALLOCATE(global_mpi_displacements(number_computational_nodes),stat=err)
1186 IF(err/=0)
CALL flag_error(
"Could not allocate all displacements.",err,error,*999)
1187 ALLOCATE(global_number_of_projected_points(number_computational_nodes),stat=err)
1188 IF(err/=0)
CALL flag_error(
"Could not allocate all number of projected points.",err,error,*999)
1189 ALLOCATE(projection_exit_tag(number_of_data_points),stat=err)
1190 IF(err/=0)
CALL flag_error(
"Could not allocate projected.",err,error,*999)
1191 ALLOCATE(projected_element(number_of_data_points),stat=err)
1192 IF(err/=0)
CALL flag_error(
"Could not allocate projected element.",err,error,*999)
1193 IF(boundary_projection)
THEN 1194 ALLOCATE(projected_face(number_of_data_points),stat=err)
1195 IF(err/=0)
CALL flag_error(
"Could not allocate projected sub element.",err,error,*999)
1197 ALLOCATE(projected_distance(2,number_of_data_points),stat=err)
1198 IF(err/=0)
CALL flag_error(
"Could not allocate projected distance.",err,error,*999)
1199 ALLOCATE(projected_xi(data_projection%NUMBER_OF_XI,number_of_data_points),stat=err)
1200 ALLOCATE(projection_vectors(data_projection%COORDINATE_SYSTEM_DIMENSIONS, number_of_data_points), stat=err)
1201 IF(err/=0)
CALL flag_error(
"Could not allocate projected.",err,error,*999)
1202 ALLOCATE(sorting_ind_2(number_of_data_points),stat=err)
1203 IF(err/=0)
CALL flag_error(
"Could not allocate sorting ind 2.",err,error,*999)
1205 CALL mpi_allgather(number_of_closest_candidates,1,mpi_integer,global_number_of_closest_candidates,1,mpi_integer, &
1208 total_number_of_closest_candidates=sum(global_number_of_closest_candidates,1)
1210 ALLOCATE(global_closest_distances(number_of_data_points,total_number_of_closest_candidates),stat=err)
1211 IF(err/=0)
CALL flag_error(
"Could not allocate all closest distances.",err,error,*999)
1212 ALLOCATE(sorting_ind_1(total_number_of_closest_candidates),stat=err)
1213 IF(err/=0)
CALL flag_error(
"Could not allocate sorting ind 1.",err,error,*999)
1215 CALL mpi_type_contiguous(number_of_data_points,mpi_double_precision,mpi_closest_distances,mpi_ierror)
1217 CALL mpi_type_commit(mpi_closest_distances,mpi_ierror)
1220 global_mpi_displacements(1)=0
1221 DO ncn=1,(number_computational_nodes-1)
1222 global_mpi_displacements(ncn+1)=global_mpi_displacements(ncn)+global_number_of_closest_candidates(ncn)
1225 CALL mpi_allgatherv(closest_distances(1,1),number_of_closest_candidates,mpi_closest_distances, &
1226 & global_closest_distances,global_number_of_closest_candidates,global_mpi_displacements,mpi_closest_distances, &
1229 reduced_number_of_closest_candidates=min(data_projection%NUMBER_OF_CLOSEST_ELEMENTS, &
1230 & total_number_of_closest_candidates)
1231 projected_distance(2,:)=my_computational_node
1233 DO data_point_idx=1,number_of_data_points
1234 CALL bubble_isort(global_closest_distances(data_point_idx,:),sorting_ind_1,err,error,*999)
1235 sorting_ind_1(1:total_number_of_closest_candidates)=sorting_ind_1(1:total_number_of_closest_candidates)- &
1236 & global_mpi_displacements(my_computational_node+1)
1237 global_to_local_number_of_closest_candidates(data_point_idx)=0
1238 DO ne=1,reduced_number_of_closest_candidates
1240 IF((sorting_ind_1(ne)>=1).AND.(sorting_ind_1(ne)<=global_number_of_closest_candidates(my_computational_node &
1241 & +1)))global_to_local_number_of_closest_candidates(data_point_idx)= &
1242 & global_to_local_number_of_closest_candidates(data_point_idx)+1
1244 projected_distance(1,data_point_idx)=global_closest_distances(data_point_idx,total_number_of_closest_candidates)
1246 SELECT CASE(data_projection%PROJECTION_TYPE)
1248 DO data_point_idx=1,number_of_data_points
1249 number_of_closest_candidates=global_to_local_number_of_closest_candidates(data_point_idx)
1250 IF(number_of_closest_candidates>0)
THEN 1252 & data_points%DATA_POINTS(data_point_idx)%position,closest_elements( &
1253 & data_point_idx,1:number_of_closest_candidates),closest_faces(data_point_idx,1: &
1254 & number_of_closest_candidates),projection_exit_tag(data_point_idx),projected_element(data_point_idx), &
1255 & projected_face(data_point_idx),projected_distance(1,data_point_idx),projected_xi(:,data_point_idx), &
1256 & projection_vectors(:, data_point_idx),err,error,*999)
1257 projected_element(data_point_idx)=domain%MAPPINGS%ELEMENTS%LOCAL_TO_GLOBAL_MAP(projected_element( &
1262 DO data_point_idx=1,number_of_data_points
1263 number_of_closest_candidates=global_to_local_number_of_closest_candidates(data_point_idx)
1264 IF(number_of_closest_candidates>0)
THEN 1266 & data_points%DATA_POINTS(data_point_idx)%position,closest_elements( &
1267 & data_point_idx,1:number_of_closest_candidates),closest_faces(data_point_idx, &
1268 & 1:number_of_closest_candidates),projection_exit_tag(data_point_idx),projected_element(data_point_idx), &
1269 & projected_face(data_point_idx),projected_distance(1,data_point_idx),projected_xi(:,data_point_idx), &
1270 & projection_vectors(:, data_point_idx),err,error,*999)
1271 projected_element(data_point_idx)=domain%MAPPINGS%ELEMENTS%LOCAL_TO_GLOBAL_MAP(projected_element( &
1276 SELECT CASE(data_projection%NUMBER_OF_XI)
1278 DO data_point_idx=1,number_of_data_points
1279 number_of_closest_candidates=global_to_local_number_of_closest_candidates(data_point_idx)
1280 IF(number_of_closest_candidates>0)
THEN 1282 & data_points(data_point_idx)%position,closest_elements(data_point_idx, &
1283 & 1:number_of_closest_candidates),projection_exit_tag(data_point_idx), &
1284 & projected_element(data_point_idx),projected_distance(1,data_point_idx), &
1285 & projected_xi(:,data_point_idx),projection_vectors(:, data_point_idx),err,error,*999)
1286 projected_element(data_point_idx)=domain%MAPPINGS%ELEMENTS%LOCAL_TO_GLOBAL_MAP(projected_element( &
1292 DO data_point_idx=1,number_of_data_points
1293 number_of_closest_candidates=global_to_local_number_of_closest_candidates(data_point_idx)
1294 IF(number_of_closest_candidates>0)
THEN 1296 & data_points(data_point_idx)%position,closest_elements(data_point_idx, &
1297 & 1:number_of_closest_candidates),projection_exit_tag(data_point_idx), &
1298 & projected_element(data_point_idx),projected_distance(1,data_point_idx), &
1299 & projected_xi(:,data_point_idx),projection_vectors(:, data_point_idx), &
1301 projected_element(data_point_idx)=domain%MAPPINGS%ELEMENTS%LOCAL_TO_GLOBAL_MAP(projected_element( &
1306 DO data_point_idx=1,number_of_data_points
1307 number_of_closest_candidates=global_to_local_number_of_closest_candidates(data_point_idx)
1308 IF(number_of_closest_candidates>0)
THEN 1310 & data_points(data_point_idx)%position,closest_elements(data_point_idx, &
1311 & 1:number_of_closest_candidates),projection_exit_tag(data_point_idx), &
1312 & projected_element(data_point_idx),projected_distance(1,data_point_idx), &
1313 & projected_xi(:,data_point_idx),projection_vectors(:, data_point_idx),err,error,*999)
1314 projected_element(data_point_idx)=domain%MAPPINGS%ELEMENTS%LOCAL_TO_GLOBAL_MAP(projected_element( &
1319 CALL flag_error(
"Data projection number of xi is invalid",err,error,*999)
1322 CALL flag_error(
"No match for data projection type found",err,error,*999)
1325 CALL mpi_allreduce(mpi_in_place,projected_distance,number_of_data_points,mpi_2double_precision,mpi_minloc, &
1329 CALL bubble_isort(projected_distance(2,:),sorting_ind_2,err,error,*999)
1330 DO ncn=0,(number_computational_nodes-1)
1331 global_number_of_projected_points(ncn+1)=count(abs(projected_distance(2,:)-
REAL(ncn))<
zero_tolerance)
1333 start_idx=sum(global_number_of_projected_points(1:my_computational_node))+1
1334 finish_idx=start_idx+global_number_of_projected_points(my_computational_node+1)-1
1336 DO ncn=1,(number_computational_nodes-1)
1337 global_mpi_displacements(ncn+1)=global_mpi_displacements(ncn)+global_number_of_projected_points(ncn)
1340 CALL mpi_allgatherv(projected_element(sorting_ind_2(start_idx:finish_idx)),global_number_of_projected_points( &
1341 & my_computational_node+1),mpi_integer,projected_element,global_number_of_projected_points, &
1344 IF(boundary_projection)
THEN 1345 CALL mpi_allgatherv(projected_face(sorting_ind_2(start_idx:finish_idx)),global_number_of_projected_points( &
1346 & my_computational_node+1),mpi_integer,projected_face,global_number_of_projected_points, &
1350 DO ni=1,data_projection%NUMBER_OF_XI
1351 CALL mpi_allgatherv(projected_xi(ni,sorting_ind_2(start_idx:finish_idx)),global_number_of_projected_points( &
1352 & my_computational_node+1),mpi_double_precision,projected_xi(ni,:),global_number_of_projected_points, &
1356 CALL mpi_allgatherv(projection_exit_tag(sorting_ind_2(start_idx:finish_idx)),global_number_of_projected_points( &
1357 & my_computational_node+1),mpi_integer,projection_exit_tag,global_number_of_projected_points, &
1360 DO ni=1,data_projection%COORDINATE_SYSTEM_DIMENSIONS
1361 CALL mpi_allgatherv(projection_vectors(ni, sorting_ind_2(start_idx:finish_idx)),global_number_of_projected_points( &
1362 & my_computational_node+1),mpi_double_precision,projection_vectors(ni,:),global_number_of_projected_points, &
1367 DO data_point_idx=1,number_of_data_points
1368 data_projection%DATA_PROJECTION_RESULTS(sorting_ind_2(data_point_idx))%EXIT_TAG=projection_exit_tag( &
1370 data_projection%DATA_PROJECTION_RESULTS(sorting_ind_2(data_point_idx))%ELEMENT_NUMBER=projected_element( &
1372 data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%DISTANCE=projected_distance(1,data_point_idx)
1373 data_projection%DATA_PROJECTION_RESULTS(sorting_ind_2(data_point_idx))%XI(1:data_projection%NUMBER_OF_XI)= &
1374 & projected_xi(1:data_projection%NUMBER_OF_XI,data_point_idx)
1375 data_projection%DATA_PROJECTION_RESULTS(sorting_ind_2(data_point_idx))%projectionVector( &
1376 & 1:data_projection%COORDINATE_SYSTEM_DIMENSIONS)=projection_vectors( &
1377 & 1:data_projection%COORDINATE_SYSTEM_DIMENSIONS,data_point_idx)
1379 projected_xi(:,sorting_ind_2)=projected_xi
1380 projection_vectors(:, sorting_ind_2)=projection_vectors
1381 projected_element(sorting_ind_2)=projected_element
1383 DO data_point_idx=1,number_of_data_points
1384 data_projection%DATA_PROJECTION_RESULTS(sorting_ind_2(data_point_idx))%ELEMENT_LINE_NUMBER=projected_face( &
1388 DO data_point_idx=1,number_of_data_points
1389 data_projection%DATA_PROJECTION_RESULTS(sorting_ind_2(data_point_idx))%ELEMENT_FACE_NUMBER=projected_face( &
1394 SELECT CASE(data_projection%PROJECTION_TYPE)
1396 DO data_point_idx=1,number_of_data_points
1398 & data_point_idx)%position,closest_elements(data_point_idx,:),closest_faces(data_point_idx,:), &
1399 & data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%EXIT_TAG,data_projection% &
1400 & data_projection_results(data_point_idx)%ELEMENT_NUMBER,data_projection% &
1401 & data_projection_results(data_point_idx)%ELEMENT_LINE_NUMBER,data_projection%DATA_PROJECTION_RESULTS( &
1402 & data_point_idx)%DISTANCE,data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%XI, &
1403 & data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%projectionVector,err,error,*999)
1406 DO data_point_idx=1,number_of_data_points
1408 & data_point_idx)%position,closest_elements(data_point_idx,:),closest_faces(data_point_idx,:), &
1409 & data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%EXIT_TAG,data_projection% &
1410 & data_projection_results(data_point_idx)%ELEMENT_NUMBER,data_projection% &
1411 & data_projection_results(data_point_idx)%ELEMENT_FACE_NUMBER,data_projection%DATA_PROJECTION_RESULTS( &
1412 & data_point_idx)%DISTANCE,data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%XI, &
1413 & data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%projectionVector,err,error,*999)
1416 SELECT CASE(data_projection%NUMBER_OF_XI)
1418 DO data_point_idx=1,number_of_data_points
1420 & data_points(data_point_idx)%position,closest_elements(data_point_idx,:),data_projection% &
1421 & data_projection_results(data_point_idx)%EXIT_TAG,data_projection%DATA_PROJECTION_RESULTS( &
1422 & data_point_idx)%ELEMENT_NUMBER, data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%DISTANCE, &
1423 & data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%XI, &
1424 & data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%projectionVector,&
1428 DO data_point_idx=1,number_of_data_points
1430 & data_points(data_point_idx)%position,closest_elements(data_point_idx,:),data_projection% &
1431 & data_projection_results(data_point_idx)%EXIT_TAG,data_projection%DATA_PROJECTION_RESULTS( &
1432 & data_point_idx)%ELEMENT_NUMBER,data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%DISTANCE, &
1433 & data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%XI, &
1434 & data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%projectionVector, &
1438 DO data_point_idx=1,number_of_data_points
1440 & data_points(data_point_idx)%position,closest_elements(data_point_idx,:),data_projection% &
1441 & data_projection_results(data_point_idx)%EXIT_TAG,data_projection%DATA_PROJECTION_RESULTS( &
1442 & data_point_idx)%ELEMENT_NUMBER,data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%DISTANCE, &
1443 & data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%XI, &
1444 & data_projection%DATA_PROJECTION_RESULTS(data_point_idx)%projectionVector, &
1448 CALL flag_error(
"Data projection number of xi is invalid",err,error,*999)
1451 CALL flag_error(
"No match for data projection type found",err,error,*999)
1454 data_projection%DATA_PROJECTION_PROJECTED=.true.
1456 CALL flag_error(
"Data projection and projection field are not sharing the same mesh.",err,error,*999)
1459 CALL flag_error(
"Projection field have not been finished.",err,error,*999)
1462 CALL flag_error(
"Projection field is not associated.",err,error,*999)
1465 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
1468 CALL flag_error(
"Data projection is not associated.",err,error,*999)
1472 IF(
ALLOCATED(candidate_elements))
DEALLOCATE(candidate_elements)
1473 IF(
ALLOCATED(candidate_faces))
DEALLOCATE(candidate_faces)
1474 IF(
ALLOCATED(closest_elements))
DEALLOCATE(closest_elements)
1475 IF(
ALLOCATED(closest_faces))
DEALLOCATE(closest_faces)
1476 IF(
ALLOCATED(closest_distances))
DEALLOCATE(closest_distances)
1477 IF(
ALLOCATED(global_to_local_number_of_closest_candidates))
DEALLOCATE(global_to_local_number_of_closest_candidates)
1478 IF(
ALLOCATED(global_number_of_closest_candidates))
DEALLOCATE(global_number_of_closest_candidates)
1479 IF(
ALLOCATED(global_mpi_displacements))
DEALLOCATE(global_mpi_displacements)
1480 IF(
ALLOCATED(global_number_of_projected_points))
DEALLOCATE(global_number_of_projected_points)
1481 IF(
ALLOCATED(projection_exit_tag))
DEALLOCATE(projection_exit_tag)
1482 IF(
ALLOCATED(projected_element))
DEALLOCATE(projected_element)
1483 IF(
ALLOCATED(projected_face))
DEALLOCATE(projected_face)
1484 IF(
ALLOCATED(projected_distance))
DEALLOCATE(projected_distance)
1485 IF(
ALLOCATED(projected_xi))
DEALLOCATE(projected_xi)
1486 IF(
ALLOCATED(projection_vectors))
DEALLOCATE(projection_vectors)
1487 IF(
ALLOCATED(sorting_ind_2))
DEALLOCATE(sorting_ind_2)
1488 IF(
ALLOCATED(global_closest_distances))
DEALLOCATE(global_closest_distances)
1489 IF(
ALLOCATED(sorting_ind_1))
DEALLOCATE(sorting_ind_1)
1491 exits(
"DataProjection_DataPointsProjectionEvaluate")
1493 999
IF(
ALLOCATED(candidate_elements))
DEALLOCATE(candidate_elements)
1494 IF(
ALLOCATED(candidate_faces))
DEALLOCATE(candidate_faces)
1495 IF(
ALLOCATED(closest_elements))
DEALLOCATE(closest_elements)
1496 IF(
ALLOCATED(closest_faces))
DEALLOCATE(closest_faces)
1497 IF(
ALLOCATED(closest_distances))
DEALLOCATE(closest_distances)
1498 IF(
ALLOCATED(global_to_local_number_of_closest_candidates))
DEALLOCATE(global_to_local_number_of_closest_candidates)
1499 IF(
ALLOCATED(global_number_of_closest_candidates))
DEALLOCATE(global_number_of_closest_candidates)
1500 IF(
ALLOCATED(global_mpi_displacements))
DEALLOCATE(global_mpi_displacements)
1501 IF(
ALLOCATED(global_number_of_projected_points))
DEALLOCATE(global_number_of_projected_points)
1502 IF(
ALLOCATED(projection_exit_tag))
DEALLOCATE(projection_exit_tag)
1503 IF(
ALLOCATED(projected_element))
DEALLOCATE(projected_element)
1504 IF(
ALLOCATED(projected_face))
DEALLOCATE(projected_face)
1505 IF(
ALLOCATED(projected_distance))
DEALLOCATE(projected_distance)
1506 IF(
ALLOCATED(projected_xi))
DEALLOCATE(projected_xi)
1507 IF(
ALLOCATED(projection_vectors))
DEALLOCATE(projection_vectors)
1508 IF(
ALLOCATED(sorting_ind_2))
DEALLOCATE(sorting_ind_2)
1509 IF(
ALLOCATED(global_closest_distances))
DEALLOCATE(global_closest_distances)
1510 IF(
ALLOCATED(sorting_ind_1))
DEALLOCATE(sorting_ind_1)
1511 998 errorsexits(
"DataProjection_DataPointsProjectionEvaluate",err,error)
1526 INTEGER(INTG),
INTENT(IN) :: fieldVariableType
1527 INTEGER(INTG),
INTENT(OUT) :: ERR
1530 INTEGER(INTG) :: dataPointIdx,elementNumber,coordIdx
1536 enters(
"DataProjection_DataPointsPositionEvaluate",err,error,*999)
1538 IF(
ASSOCIATED(field))
THEN 1539 IF (field%TYPE==field_geometric_type.OR.field%TYPE==field_geometric_general_type)
THEN 1540 IF(
ASSOCIATED(dataprojection))
THEN 1541 datapoints=>dataprojection%DATA_POINTS
1542 IF(
ASSOCIATED(datapoints))
THEN 1543 NULLIFY(interpolatedpoints)
1544 NULLIFY(interpolationparameters)
1545 CALL field_interpolation_parameters_initialise(field,interpolationparameters,err,error,*999, &
1546 & field_geometric_components_type)
1547 CALL field_interpolated_points_initialise(interpolationparameters,interpolatedpoints,err,error,*999, &
1548 & field_geometric_components_type)
1549 interpolatedpoint=>interpolatedpoints(fieldvariabletype)%PTR
1551 DO datapointidx=1,datapoints%NUMBER_OF_DATA_POINTS
1552 elementnumber=dataprojection%DATA_PROJECTION_RESULTS(datapointidx)%ELEMENT_NUMBER
1553 CALL field_interpolation_parameters_element_get(field_values_set_type,elementnumber, &
1554 & interpolationparameters(fieldvariabletype)%PTR,err,error,*999,field_geometric_components_type)
1555 CALL field_interpolate_xi(
no_part_deriv,dataprojection%DATA_PROJECTION_RESULTS(datapointidx)%XI, &
1556 & interpolatedpoint,err,error,*999,field_geometric_components_type)
1557 DO coordidx=1,
SIZE(datapoints%DATA_POINTS(datapointidx)%position)
1558 datapoints%DATA_POINTS(datapointidx)%position(coordidx)=interpolatedpoint%VALUES(coordidx,
no_part_deriv)
1562 CALL flag_error(
"Data points is not associated.",err,error,*999)
1565 CALL flag_error(
"Data projection is not associated.",err,error,*999)
1568 CALL flag_error(
"Cannot evaluate data points position on field other than geometric or geometric general type.", &
1572 CALL flag_error(
"Field is not associated.",err,error,*999)
1575 exits(
"DataProjection_DataPointsPositionEvaluate")
1577 999 errorsexits(
"DataProjection_DataPointsPositionEvaluate",err,error)
1591 REAL(DP),
INTENT(OUT) :: MAXIMUM_ITERATION_UPDATE
1592 INTEGER(INTG),
INTENT(OUT) :: ERR
1595 enters(
"DataProjection_MaximumInterationUpdateGet",err,error,*999)
1597 IF(
ASSOCIATED(data_projection))
THEN 1598 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 1599 maximum_iteration_update=data_projection%MAXIMUM_ITERATION_UPDATE
1601 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
1604 CALL flag_error(
"Data projection is not associated.",err,error,*999)
1607 exits(
"DataProjection_MaximumInterationUpdateGet")
1609 999 errorsexits(
"DataProjection_MaximumInterationUpdateGet",err,error)
1623 REAL(DP),
INTENT(IN) :: MAXIMUM_ITERATION_UPDATE
1624 INTEGER(INTG),
INTENT(OUT) :: ERR
1628 enters(
"DataProjection_MaximumInterationUpdateSet",err,error,*999)
1630 IF(
ASSOCIATED(data_projection))
THEN 1631 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 1632 CALL flag_error(
"Data projection have been finished.",err,error,*999)
1634 IF((maximum_iteration_update>=0.1).AND.(maximum_iteration_update<=1))
THEN 1635 data_projection%MAXIMUM_ITERATION_UPDATE=maximum_iteration_update
1637 CALL flag_error(
"Data projection maximum iteration update must be between 0.1 and 1.",err,error,*999)
1641 CALL flag_error(
"Data projection is not associated.",err,error,*999)
1644 exits(
"DataProjection_MaximumInterationUpdateSet")
1646 999 errorsexits(
"DataProjection_MaximumInterationUpdateSet",err,error)
1661 INTEGER(INTG),
INTENT(OUT) :: MAXIMUM_NUMBER_OF_ITERATIONS
1662 INTEGER(INTG),
INTENT(OUT) :: ERR
1666 enters(
"DataProjection_MaximumNumberOfIterationsGet",err,error,*999)
1668 IF(
ASSOCIATED(data_projection))
THEN 1669 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 1670 maximum_number_of_iterations=data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
1672 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
1675 CALL flag_error(
"Data projection is not associated.",err,error,*999)
1678 exits(
"DataProjection_MaximumNumberOfIterationsGet")
1680 999 errorsexits(
"DataProjection_MaximumNumberOfIterationsGet",err,error)
1694 INTEGER(INTG),
INTENT(IN) :: MAXIMUM_NUMBER_OF_ITERATIONS
1695 INTEGER(INTG),
INTENT(OUT) :: ERR
1699 enters(
"DataProjection_MaximumNumberOfIterationsSet",err,error,*999)
1701 IF(
ASSOCIATED(data_projection))
THEN 1702 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 1703 CALL flag_error(
"Data projection have been finished.",err,error,*999)
1705 IF(maximum_number_of_iterations>=1)
THEN 1706 data_projection%MAXIMUM_NUMBER_OF_ITERATIONS=maximum_number_of_iterations
1708 CALL flag_error(
"Data projection maximum number of iterations must be at least 1.",err,error,*999)
1712 CALL flag_error(
"Data projection is not associated.",err,error,*999)
1715 exits(
"DataProjection_MaximumNumberOfIterationsSet")
1717 999 errorsexits(
"DataProjection_MaximumNumberOfIterationsSet",err,error)
1728 & projection_exit_tag,projection_element_number,projection_distance,projection_xi,projection_vector,err,error,*)
1732 REAL(DP),
INTENT(IN) :: POINT_VALUES(:)
1733 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENTS(:)
1734 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_EXIT_TAG
1735 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_ELEMENT_NUMBER
1736 REAL(DP),
INTENT(OUT) :: PROJECTION_DISTANCE
1737 REAL(DP),
INTENT(OUT) :: PROJECTION_XI(1)
1738 REAL(DP),
INTENT(OUT) :: PROJECTION_VECTOR(3)
1739 INTEGER(INTG),
INTENT(OUT) :: ERR
1743 LOGICAL :: INSIDE_REGION,CONVERGED
1744 INTEGER(INTG) :: ELEMENT_NUMBER
1745 INTEGER(INTG) :: REGION_DIMENSIONS
1746 INTEGER(INTG) :: BOUND,EXIT_TAG
1747 REAL(DP) :: XI(1),XI_NEW(1),XI_UPDATE(1),XI_UPDATE_NORM
1748 REAL(DP) :: DISTANCE_VECTOR(3),RELATIVE_TOLERANCE,ABSOLUTE_TOLERANCE
1749 REAL(DP) :: FUNCTION_VALUE,FUNCTION_VALUE_NEW
1750 REAL(DP) :: FUNCTION_GRADIENT,FUNCTION_HESSIAN
1751 REAL(DP) :: MAXIMUM_DELTA,MINIMUM_DELTA,DELTA
1752 REAL(DP) :: PREDICTED_REDUCTION,PREDICTION_ACCURACY
1754 INTEGER(INTG) :: ne,itr1,itr2
1756 enters(
"DATA_PROJECTION_NEWTON_ELEMENTS_EVALUATE_1",err,error,*999)
1758 IF(
ASSOCIATED(data_projection))
THEN 1759 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 1761 region_dimensions=data_projection%COORDINATE_SYSTEM_DIMENSIONS
1762 relative_tolerance=data_projection%RELATIVE_TOLERANCE
1763 absolute_tolerance=data_projection%ABSOLUTE_TOLERANCE
1764 maximum_delta=data_projection%MAXIMUM_ITERATION_UPDATE
1765 minimum_delta=0.025_dp*maximum_delta
1766 DO ne=1,
SIZE(candidate_elements,1)
1767 element_number=candidate_elements(ne)
1770 delta=0.5_dp*maximum_delta
1771 CALL field_interpolation_parameters_element_get(field_values_set_type,element_number,interpolated_point% &
1772 & interpolation_parameters,err,error,*999,field_geometric_components_type)
1773 xi=data_projection%STARTING_XI
1774 CALL field_interpolate_xi(
second_part_deriv,xi,interpolated_point,err,error,*999,field_geometric_components_type)
1775 distance_vector(1:region_dimensions)=point_values-interpolated_point%VALUES(:,
no_part_deriv)
1776 function_value=dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
1777 main_loop:
DO itr1=1,data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
1787 function_gradient=-2.0_dp* &
1788 & (dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
first_part_deriv)))
1790 function_hessian=-2.0_dp*(&
1791 & dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
second_part_deriv))- &
1795 DO itr2=1,data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
1796 inside_region=.false.
1797 IF(function_hessian>absolute_tolerance)
THEN 1798 xi_update(1)=-function_gradient/function_hessian
1799 xi_update_norm=dabs(xi_update(1))
1800 inside_region=xi_update_norm<=delta
1802 IF(.NOT.inside_region)
THEN 1803 xi_update(1)=-dsign(delta,function_gradient)
1804 xi_update_norm=delta
1806 IF((bound/=0).AND.(bound>0.EQV.xi_update(1)>0.0_dp))
THEN 1810 converged=xi_update_norm<absolute_tolerance
1812 IF(xi_new(1)<0.0_dp)
THEN 1814 ELSEIF(xi_new(1)>1.0_dp)
THEN 1817 CALL field_interpolate_xi(
second_part_deriv,xi_new,interpolated_point,err,error,*999,field_geometric_components_type)
1818 distance_vector=point_values-interpolated_point%VALUES(:,
no_part_deriv)
1819 function_value_new=dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
1820 converged=converged.AND.(dabs(function_value_new-function_value)/(1.0_dp+function_value)<relative_tolerance)
1822 IF((function_value_new-function_value)>absolute_tolerance)
THEN 1823 IF(delta<=minimum_delta)
THEN 1827 delta=dmax1(minimum_delta,0.25_dp*delta)
1829 predicted_reduction=xi_update(1)*(function_gradient+0.5_dp*function_hessian*xi_update(1))
1830 prediction_accuracy=(function_value_new-function_value)/predicted_reduction
1831 IF(prediction_accuracy<0.01_dp)
THEN 1832 IF(delta<=minimum_delta)
THEN 1836 delta=dmax1(minimum_delta,0.5_dp*delta)
1837 ELSEIF(prediction_accuracy>0.9_dp.AND.prediction_accuracy<1.1_dp)
THEN 1838 delta=dmin1(maximum_delta,2.0_dp*delta)
1845 function_value=function_value_new
1855 projection_exit_tag=exit_tag
1856 projection_element_number=element_number
1857 projection_distance=dsqrt(function_value)
1859 projection_vector=distance_vector
1863 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
1866 CALL flag_error(
"Data projection is not associated.",err,error,*999)
1869 exits(
"DATA_PROJECTION_NEWTON_ELEMENTS_EVALUATE_1")
1871 999 errorsexits(
"DATA_PROJECTION_NEWTON_ELEMENTS_EVALUATE_1",err,error)
1882 & projection_exit_tag,projection_element_number,projection_distance,projection_xi,projection_vector,err,error,*)
1886 REAL(DP),
INTENT(IN) :: POINT_VALUES(:)
1887 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENTS(:)
1888 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_EXIT_TAG
1889 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_ELEMENT_NUMBER
1890 REAL(DP),
INTENT(OUT) :: PROJECTION_DISTANCE
1891 REAL(DP),
INTENT(OUT) :: PROJECTION_XI(2)
1892 REAL(DP),
INTENT(OUT) :: PROJECTION_VECTOR(3)
1893 INTEGER(INTG),
INTENT(OUT) :: ERR
1898 LOGICAL :: FREE,CONVERGED,INSIDE_REGION
1899 INTEGER(INTG) :: ELEMENT_NUMBER
1900 INTEGER(INTG) :: MESH_COMPONENT_NUMBER,REGION_DIMENSIONS
1901 INTEGER(INTG) :: BOUND(2),EXIT_TAG
1902 REAL(DP) :: XI(2),XI_NEW(2),XI_UPDATE(2),XI_UPDATE_NORM
1903 REAL(DP) :: DISTANCE_VECTOR(3),RELATIVE_TOLERANCE,ABSOLUTE_TOLERANCE
1904 REAL(DP) :: FUNCTION_VALUE,FUNCTION_VALUE_NEW
1905 REAL(DP) :: FUNCTION_GRADIENT(2),FUNCTION_GRADIENT_NORM
1906 REAL(DP) :: FUNCTION_HESSIAN(2,2),HESSIAN_DIAGONAL(2)
1907 REAL(DP) :: TEMP1,TEMP2,DET,EIGEN_MIN,EIGEN_MAX,EIGEN_SHIFT
1908 REAL(DP) :: MAXIMUM_DELTA,MINIMUM_DELTA,DELTA
1909 REAL(DP) :: PREDICTED_REDUCTION,PREDICTION_ACCURACY
1912 INTEGER(INTG) :: ne,ni,nifix,itr1,itr2
1914 enters(
"DATA_PROJECTION_NEWTON_ELEMENTS_EVALUATE_2",err,error,*999)
1916 IF(
ASSOCIATED(data_projection))
THEN 1917 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 1919 mesh_component_number=interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%MESH_COMPONENT_NUMBER
1920 domain_mapping=>interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%DOMAIN(mesh_component_number)% &
1921 &
ptr%MAPPINGS%ELEMENTS
1922 region_dimensions=data_projection%COORDINATE_SYSTEM_DIMENSIONS
1923 relative_tolerance=data_projection%RELATIVE_TOLERANCE
1924 absolute_tolerance=data_projection%ABSOLUTE_TOLERANCE
1925 maximum_delta=data_projection%MAXIMUM_ITERATION_UPDATE
1926 minimum_delta=0.025_dp*maximum_delta
1927 DO ne=1,
SIZE(candidate_elements,1)
1928 element_number=candidate_elements(ne)
1931 delta=0.5_dp*maximum_delta
1932 CALL field_interpolation_parameters_element_get(field_values_set_type,element_number, &
1933 & interpolated_point%INTERPOLATION_PARAMETERS,err,error,*999,field_geometric_components_type)
1934 xi=data_projection%STARTING_XI
1935 CALL field_interpolate_xi(
second_part_deriv,xi,interpolated_point,err,error,*999,field_geometric_components_type)
1936 distance_vector(1:region_dimensions)=point_values-interpolated_point%VALUES(:,
no_part_deriv)
1937 function_value=dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
1938 main_loop:
DO itr1=1,data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
1950 function_gradient(1)= &
1951 & -2.0_dp*(dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
part_deriv_s1)))
1952 function_gradient(2)= &
1953 & -2.0_dp*(dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
part_deriv_s2)))
1955 function_hessian(1,1)= -2.0_dp*(&
1956 & dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
part_deriv_s1_s1))- &
1958 function_hessian(1,2)= -2.0_dp*(&
1959 & dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
part_deriv_s1_s2))- &
1961 function_hessian(2,2)= -2.0_dp*(&
1962 & dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
part_deriv_s2_s2))- &
1965 temp1=0.5_dp*(function_hessian(1,1)+function_hessian(2,2))
1966 temp2=dsqrt((0.5_dp*(function_hessian(1,1)-function_hessian(2,2)))**2+function_hessian(1,2)**2)
1967 eigen_min=temp1-temp2
1968 eigen_max=temp1+temp2
1969 function_gradient_norm=dsqrt(dot_product(function_gradient,function_gradient))
1970 DO itr2=1,data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
1971 temp1=function_gradient_norm/delta
1972 inside_region=(eigen_min>=temp1).AND.(eigen_min>absolute_tolerance)
1973 IF(inside_region)
THEN 1974 det=eigen_min*eigen_max
1975 hessian_diagonal(1)=function_hessian(1,1)
1976 hessian_diagonal(2)=function_hessian(2,2)
1978 eigen_shift=max(temp1-eigen_min,absolute_tolerance)
1979 det=temp1*(eigen_max+eigen_shift)
1980 hessian_diagonal(1)=function_hessian(1,1)+eigen_shift
1981 hessian_diagonal(2)=function_hessian(2,2)+eigen_shift
1983 xi_update(1)=-(hessian_diagonal(2)*function_gradient(1)-function_hessian(1,2)*function_gradient(2))/det
1984 xi_update(2)=(function_hessian(1,2)*function_gradient(1)-hessian_diagonal(1)*function_gradient(2))/det
1985 xi_update_norm=dsqrt(dot_product(xi_update,xi_update))
1988 IF((bound(ni)/=0).AND.(bound(ni)>0.EQV.xi_update(ni)>0.0_dp))
THEN 1998 IF(.NOT.inside_region)
THEN 1999 IF(xi_update_norm>0.0_dp)
THEN 2000 xi_update=delta/xi_update_norm*xi_update
2004 xi_update(nifix)=0.0_dp
2006 inside_region=.false.
2007 IF(function_hessian(ni,ni)>0.0_dp)
THEN 2008 xi_update(ni)=-function_gradient(ni)/function_hessian(ni,ni)
2009 xi_update_norm=dabs(xi_update(ni))
2010 inside_region=xi_update_norm<=delta
2012 IF(.NOT.inside_region)
THEN 2013 xi_update(ni)=-dsign(delta,function_gradient(ni))
2014 xi_update_norm=delta
2017 converged=xi_update_norm<absolute_tolerance
2020 IF(xi_new(ni)<0.0_dp)
THEN 2022 xi_new(3-ni)=xi(3-ni)-xi_update(3-ni)*xi(ni)/xi_update(ni)
2023 ELSEIF(xi_new(ni)>1.0_dp)
THEN 2025 xi_new(3-ni)=xi(3-ni)+xi_update(3-ni)*(1.0_dp-xi(ni))/xi_update(ni)
2028 CALL field_interpolate_xi(
second_part_deriv,xi_new,interpolated_point,err,error,*999,field_geometric_components_type)
2029 distance_vector(1:region_dimensions)=point_values-interpolated_point%VALUES(:,
no_part_deriv)
2030 function_value_new=dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
2031 converged=converged.AND.(dabs(function_value_new-function_value)/(1.0_dp+function_value)<relative_tolerance)
2033 IF((function_value_new-function_value)>absolute_tolerance)
THEN 2034 IF(delta<=minimum_delta)
THEN 2038 delta=dmax1(minimum_delta,0.25_dp*delta)
2040 predicted_reduction=dot_product(function_gradient,xi_update)+ &
2041 & 0.5_dp*(xi_update(1)*(xi_update(1)*function_hessian(1,1)+2.0_dp*xi_update(2)*function_hessian(1,2))+ &
2042 & xi_update(2)**2*function_hessian(2,2))
2043 prediction_accuracy=(function_value_new-function_value)/predicted_reduction
2044 IF(prediction_accuracy<0.01_dp)
THEN 2045 IF(delta<=minimum_delta)
THEN 2049 delta=dmax1(minimum_delta,0.5_dp*delta)
2050 ELSEIF(prediction_accuracy>0.9_dp.AND.prediction_accuracy<1.1_dp)
THEN 2051 delta=dmin1(maximum_delta,2.0_dp*delta)
2058 function_value=function_value_new
2069 projection_exit_tag=exit_tag
2070 projection_element_number=element_number
2071 projection_distance=dsqrt(function_value)
2073 projection_vector=distance_vector
2077 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
2080 CALL flag_error(
"Data projection is not associated.",err,error,*999)
2083 exits(
"DATA_PROJECTION_NEWTON_ELEMENTS_EVALUATE_2")
2085 999 errorsexits(
"DATA_PROJECTION_NEWTON_ELEMENTS_EVALUATE_2",err,error)
2096 & projection_exit_tag,projection_element_number,projection_distance,projection_xi,projection_vector,err,error,*)
2100 REAL(DP),
INTENT(IN) :: POINT_VALUES(:)
2101 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENTS(:)
2102 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_EXIT_TAG
2103 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_ELEMENT_NUMBER
2104 REAL(DP),
INTENT(OUT) :: PROJECTION_DISTANCE
2105 REAL(DP),
INTENT(OUT) :: PROJECTION_XI(3)
2106 REAL(DP),
INTENT(OUT) :: PROJECTION_VECTOR(3)
2107 INTEGER(INTG),
INTENT(OUT) :: ERR
2112 LOGICAL :: FREE,CONVERGED,INSIDE_REGION
2113 INTEGER(INTG) :: ELEMENT_NUMBER
2114 INTEGER(INTG) :: MESH_COMPONENT_NUMBER
2115 INTEGER(INTG) :: NBOUND,BOUND(3),EXIT_TAG
2116 REAL(DP) :: XI(3),XI_NEW(3),XI_UPDATE(3),XI_UPDATE_NORM
2117 REAL(DP) :: DISTANCE_VECTOR(3),RELATIVE_TOLERANCE,ABSOLUTE_TOLERANCE
2118 REAL(DP) :: FUNCTION_VALUE,FUNCTION_VALUE_NEW
2119 REAL(DP) :: FUNCTION_GRADIENT(3),FUNCTION_GRADIENT_NORM,FUNCTION_GRADIENT2(2)
2120 REAL(DP) :: FUNCTION_HESSIAN(3,3),HESSIAN_DIAGONAL(3),FUNCTION_HESSIAN2(2,2),HESSIAN_DIAGONAL2(2)
2121 REAL(DP) :: TEMP1,TEMP2,TEMP3,TEMP4,DET,TRACE,TRACE2,EIGEN_MIN,EIGEN_MAX,EIGEN_SHIFT
2122 REAL(DP) :: MAXIMUM_DELTA,MINIMUM_DELTA,DELTA
2123 REAL(DP) :: PREDICTED_REDUCTION,PREDICTION_ACCURACY
2126 INTEGER(INTG) :: ne,ni,ni2(2),nb,nifix,nifix2(2),itr1,itr2,nbfix,mi
2128 enters(
"DATA_PROJECTION_NEWTON_ELEMENTS_EVALUATE_3",err,error,*999)
2130 IF(
ASSOCIATED(data_projection))
THEN 2131 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 2133 mesh_component_number=interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%MESH_COMPONENT_NUMBER
2134 domain_mapping=>interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%DOMAIN(mesh_component_number)% &
2135 &
ptr%MAPPINGS%ELEMENTS
2137 relative_tolerance=data_projection%RELATIVE_TOLERANCE
2138 absolute_tolerance=data_projection%ABSOLUTE_TOLERANCE
2139 maximum_delta=data_projection%MAXIMUM_ITERATION_UPDATE
2140 minimum_delta=0.025_dp*maximum_delta
2141 DO ne=1,
SIZE(candidate_elements,1)
2142 element_number=candidate_elements(ne)
2145 delta=0.5_dp*maximum_delta
2146 CALL field_interpolation_parameters_element_get(field_values_set_type,element_number, &
2147 & interpolated_point%INTERPOLATION_PARAMETERS,err,error,*999,field_geometric_components_type)
2148 xi=data_projection%STARTING_XI
2149 CALL field_interpolate_xi(
second_part_deriv,xi,interpolated_point,err,error,*999,field_geometric_components_type)
2150 distance_vector=point_values-interpolated_point%VALUES(:,
no_part_deriv)
2151 function_value=dot_product(distance_vector,distance_vector)
2152 main_loop:
DO itr1=1,data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
2164 function_gradient(1)=-2.0_dp*(dot_product(distance_vector,interpolated_point%VALUES(:,
part_deriv_s1)))
2165 function_gradient(2)=-2.0_dp*(dot_product(distance_vector,interpolated_point%VALUES(:,
part_deriv_s2)))
2166 function_gradient(3)=-2.0_dp*(dot_product(distance_vector,interpolated_point%VALUES(:,
part_deriv_s3)))
2168 function_hessian(1,1)= -2.0_dp*(dot_product(distance_vector,interpolated_point%VALUES(:,
part_deriv_s1_s1))- &
2170 function_hessian(1,2)= -2.0_dp*(dot_product(distance_vector,interpolated_point%VALUES(:,
part_deriv_s1_s2))- &
2172 function_hessian(1,3)= -2.0_dp*(dot_product(distance_vector,interpolated_point%VALUES(:,
part_deriv_s1_s3))- &
2174 function_hessian(2,2)= -2.0_dp*(dot_product(distance_vector,interpolated_point%VALUES(:,
part_deriv_s2_s2))- &
2176 function_hessian(2,3)= -2.0_dp*(dot_product(distance_vector,interpolated_point%VALUES(:,
part_deriv_s2_s3))- &
2178 function_hessian(3,3)= -2.0_dp*(dot_product(distance_vector,interpolated_point%VALUES(:,
part_deriv_s3_s3))- &
2181 trace=function_hessian(1,1)+function_hessian(2,2)+function_hessian(3,3)
2182 trace2=function_hessian(1,1)*function_hessian(2,2)+function_hessian(1,1)*function_hessian(3,3)+ &
2183 & function_hessian(2,2)*function_hessian(3,3)-function_hessian(1,2)**2-function_hessian(1,3)**2- &
2184 & function_hessian(2,3)**2
2185 det=function_hessian(1,1)*function_hessian(2,2)*function_hessian(3,3)- &
2186 & function_hessian(1,1)*function_hessian(2,3)**2-function_hessian(2,2)*function_hessian(1,3)**2- &
2187 & function_hessian(3,3)*function_hessian(1,2)**2+ &
2188 & 2.0_dp*function_hessian(1,2)*function_hessian(1,3)*function_hessian(2,3)
2191 temp3=temp2-temp1**2
2192 IF(temp3>-1.0e-5_dp)
THEN 2196 temp4=(det+3.0_dp*(temp1*temp2)-2.0_dp*temp1**3)/(2.0_dp*temp3**3)
2197 eigen_min=2.0_dp*temp3*dcos((dacos(temp4)+
twopi)/3.0_dp)-temp1
2199 function_gradient_norm=dsqrt(dot_product(function_gradient,function_gradient))
2200 DO itr2=1,data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
2201 temp1=function_gradient_norm/delta
2202 inside_region=(eigen_min>=temp1).AND.(eigen_min>absolute_tolerance)
2203 IF(inside_region)
THEN 2204 hessian_diagonal(1)=function_hessian(1,1)
2205 hessian_diagonal(2)=function_hessian(2,2)
2206 hessian_diagonal(3)=function_hessian(3,3)
2208 eigen_shift=max(temp1-eigen_min,absolute_tolerance)
2209 det=det+eigen_shift*(trace2+eigen_shift*(trace+eigen_shift))
2210 hessian_diagonal(1)=function_hessian(1,1)+eigen_shift
2211 hessian_diagonal(2)=function_hessian(2,2)+eigen_shift
2212 hessian_diagonal(3)=function_hessian(3,3)+eigen_shift
2214 temp2=function_hessian(1,3)*function_hessian(2,3)-function_hessian(1,2)*hessian_diagonal(3)
2215 temp3=function_hessian(1,2)*function_hessian(2,3)-function_hessian(1,3)*hessian_diagonal(2)
2216 temp4=function_hessian(1,2)*function_hessian(1,3)-function_hessian(2,3)*hessian_diagonal(1)
2217 xi_update(1)=((function_hessian(2,3)**2-hessian_diagonal(2)*hessian_diagonal(3))*function_gradient(1)- &
2218 & temp2*function_gradient(2)-temp3*function_gradient(3))/det
2219 xi_update(2)=((function_hessian(1,3)**2-hessian_diagonal(1)*hessian_diagonal(3))*function_gradient(2)- &
2220 & temp2*function_gradient(1)-temp4*function_gradient(3))/det
2221 xi_update(3)=((function_hessian(1,2)**2-hessian_diagonal(1)*hessian_diagonal(2))*function_gradient(3)- &
2222 & temp3*function_gradient(1)-temp4*function_gradient(2))/det
2223 xi_update_norm=dsqrt(dot_product(xi_update,xi_update))
2227 IF((bound(ni)/=0).AND.(bound(ni)>0.EQV.xi_update(ni)>0.0_dp))
THEN 2239 IF(.NOT.inside_region)
THEN 2240 IF(xi_update_norm>0.0_dp)
THEN 2241 xi_update=delta/xi_update_norm*xi_update
2249 IF(xi_update(nifix2(2))>xi_update(nifix2(1))) nifix=nifix2(2)
2251 xi_update(nifix)=0.0_dp
2252 ni2(1)=1+mod(nifix,3)
2253 ni2(2)=1+mod(nifix+1,3)
2255 function_gradient2(1)=function_gradient(ni2(1))
2256 function_gradient2(2)=function_gradient(ni2(2))
2258 function_hessian2(1,1)=function_hessian(ni2(1),ni2(1))
2259 function_hessian2(1,2)=function_hessian(ni2(1),ni2(2))
2260 function_hessian2(2,2)=function_hessian(ni2(2),ni2(2))
2262 temp1=0.5_dp*(function_hessian2(1,1)+function_hessian2(2,2))
2263 temp2=dsqrt((0.5_dp*(function_hessian2(1,1)-function_hessian2(2,2)))**2+function_hessian2(1,2)**2)
2264 eigen_min=temp1-temp2
2265 eigen_max=temp1+temp2
2266 temp3=dsqrt(dot_product(function_gradient2,function_gradient2))/delta
2267 inside_region=(eigen_min>=temp3).AND.(eigen_min>absolute_tolerance)
2268 IF(inside_region)
THEN 2269 det=eigen_min*eigen_max
2270 hessian_diagonal2(1)=function_hessian2(1,1)
2271 hessian_diagonal2(2)=function_hessian2(2,2)
2273 eigen_shift=max(temp3-eigen_min,absolute_tolerance)
2274 det=temp3*(eigen_max+eigen_shift)
2275 hessian_diagonal2(1)=function_hessian2(1,1)+eigen_shift
2276 hessian_diagonal2(2)=function_hessian2(2,2)+eigen_shift
2278 xi_update(ni2(1))=-(hessian_diagonal2(2)*function_gradient2(1)-function_hessian2(1,2)*function_gradient2(2))/det
2279 xi_update(ni2(2))=(function_hessian2(1,2)*function_gradient2(1)-hessian_diagonal2(1)*function_gradient2(2))/det
2280 xi_update_norm=dsqrt(dot_product(xi_update,xi_update))
2283 IF((bound(ni2(nb))/=0).AND.(bound(ni2(nb))>0.EQV.xi_update(ni2(nb))>0.0_dp))
THEN 2293 IF(.NOT.inside_region)
THEN 2294 IF(xi_update_norm>0.0_dp)
THEN 2295 xi_update=delta/xi_update_norm*xi_update
2299 xi_update(ni2(nbfix))=0.0_dp
2301 inside_region=.false.
2302 IF(function_hessian(ni,ni)>0.0_dp)
THEN 2303 xi_update(ni)=-function_gradient(ni)/function_hessian(ni,ni)
2304 xi_update_norm=dabs(xi_update(ni))
2305 inside_region=xi_update_norm<=delta
2307 IF(.NOT.inside_region)
THEN 2308 xi_update(ni)=-dsign(delta,function_gradient(ni))
2309 xi_update_norm=delta
2313 converged=xi_update_norm<absolute_tolerance
2317 IF(xi_new(ni)<0.0_dp)
THEN 2321 xi_new(mi)=xi(mi)-xi_update(mi)
2324 ELSEIF(xi_new(ni)>1.0_dp)
THEN 2328 xi_new(mi)=xi(mi)+xi_update(mi)
2332 ELSEIF(xi_new(ni)<0.0_dp)
THEN 2334 xi_new=xi-xi_update*xi(ni)/xi_update(ni)
2335 ELSEIF(xi_new(ni)>1.0_dp)
THEN 2337 xi_new=xi+xi_update*(1.0_dp-xi(ni))/xi_update(ni)
2340 CALL field_interpolate_xi(
second_part_deriv,xi_new,interpolated_point,err,error,*999,field_geometric_components_type)
2341 distance_vector=point_values-interpolated_point%VALUES(:,
no_part_deriv)
2342 function_value_new=dot_product(distance_vector,distance_vector)
2343 converged=converged.AND.(dabs(function_value_new-function_value)/(1.0_dp+function_value)<relative_tolerance)
2345 IF((function_value_new-function_value)>absolute_tolerance)
THEN 2346 IF(delta<=minimum_delta)
THEN 2350 delta=dmax1(minimum_delta,0.25_dp*delta)
2352 predicted_reduction=dot_product(function_gradient,xi_update)+ &
2353 & 0.5_dp*(xi_update(1)*(xi_update(1)*function_hessian(1,1)+2.0_dp*xi_update(2)*function_hessian(1,2)+ &
2354 & 2.0_dp*xi_update(3)*function_hessian(1,3))+xi_update(2)*(xi_update(2)*function_hessian(2,2)+ &
2355 & 2.0_dp*xi_update(3)*function_hessian(2,3))+xi_update(2)**2*function_hessian(2,2))
2360 prediction_accuracy=(function_value_new-function_value)/predicted_reduction
2361 IF(prediction_accuracy<0.01_dp)
THEN 2362 IF(delta<=minimum_delta)
THEN 2366 delta=dmax1(minimum_delta,0.5_dp*delta)
2367 ELSEIF(prediction_accuracy>0.9_dp.AND.prediction_accuracy<1.1_dp)
THEN 2368 delta=dmin1(maximum_delta,2.0_dp*delta)
2375 function_value=function_value_new
2386 projection_exit_tag=exit_tag
2387 projection_element_number=element_number
2388 projection_distance=dsqrt(function_value)
2390 projection_vector=distance_vector
2394 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
2397 CALL flag_error(
"Data projection is not associated.",err,error,*999)
2400 exits(
"DATA_PROJECTION_NEWTON_ELEMENTS_EVALUATE_3")
2402 999 errorsexits(
"DATA_PROJECTION_NEWTON_ELEMENTS_EVALUATE_3",err,error)
2413 & candidate_element_faces,projection_exit_tag,projection_element_number,projection_element_face_number,projection_distance, &
2414 & projection_xi,projection_vector,err,error,*)
2418 REAL(DP),
INTENT(IN) :: POINT_VALUES(:)
2419 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENTS(:)
2420 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENT_FACES(:)
2421 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_EXIT_TAG
2422 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_ELEMENT_NUMBER
2423 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_ELEMENT_FACE_NUMBER
2424 REAL(DP),
INTENT(OUT) :: PROJECTION_DISTANCE
2425 REAL(DP),
INTENT(OUT) :: PROJECTION_XI(2)
2426 REAL(DP),
INTENT(OUT) :: PROJECTION_VECTOR(3)
2427 INTEGER(INTG),
INTENT(OUT) :: ERR
2432 LOGICAL :: FREE,CONVERGED,INSIDE_REGION
2433 INTEGER(INTG) :: ELEMENT_NUMBER,ELEMENT_FACE_NUMBER,FACE_NUMBER
2434 INTEGER(INTG) :: MESH_COMPONENT_NUMBER,REGION_DIMENSIONS
2435 INTEGER(INTG) :: BOUND(2),EXIT_TAG
2436 REAL(DP) :: XI(2),XI_NEW(2),XI_UPDATE(2),XI_UPDATE_NORM
2437 REAL(DP) :: DISTANCE_VECTOR(3),RELATIVE_TOLERANCE,ABSOLUTE_TOLERANCE
2438 REAL(DP) :: FUNCTION_VALUE,FUNCTION_VALUE_NEW
2439 REAL(DP) :: FUNCTION_GRADIENT(2),FUNCTION_GRADIENT_NORM
2440 REAL(DP) :: FUNCTION_HESSIAN(2,2),HESSIAN_DIAGONAL(2)
2441 REAL(DP) :: TEMP1,TEMP2,DET,EIGEN_MIN,EIGEN_MAX,EIGEN_SHIFT
2442 REAL(DP) :: MAXIMUM_DELTA,MINIMUM_DELTA,DELTA
2443 REAL(DP) :: PREDICTED_REDUCTION,PREDICTION_ACCURACY
2446 INTEGER(INTG) :: ne,ni,nifix,itr1,itr2
2448 enters(
"DATA_PROJECTION_NEWTON_FACES_EVALUATE",err,error,*999)
2450 IF(
ASSOCIATED(data_projection))
THEN 2451 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 2453 mesh_component_number=interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%MESH_COMPONENT_NUMBER
2454 domain_mapping=>interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%DOMAIN(mesh_component_number)% &
2455 &
ptr%MAPPINGS%ELEMENTS
2456 region_dimensions=data_projection%COORDINATE_SYSTEM_DIMENSIONS
2457 relative_tolerance=data_projection%RELATIVE_TOLERANCE
2458 absolute_tolerance=data_projection%ABSOLUTE_TOLERANCE
2459 maximum_delta=data_projection%MAXIMUM_ITERATION_UPDATE
2460 minimum_delta=0.025_dp*maximum_delta
2461 DO ne=1,
SIZE(candidate_elements,1)
2462 element_number=candidate_elements(ne)
2463 element_face_number=candidate_element_faces(ne)
2464 face_number=interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%TOPOLOGY%ELEMENTS%ELEMENTS( &
2465 & element_number)%ELEMENT_FACES(element_face_number)
2468 delta=0.5_dp*maximum_delta
2469 CALL field_interpolation_parameters_face_get(field_values_set_type,face_number, &
2470 & interpolated_point%INTERPOLATION_PARAMETERS,err,error,*999,field_geometric_components_type)
2471 xi=data_projection%STARTING_XI
2472 CALL field_interpolate_xi(
second_part_deriv,xi,interpolated_point,err,error,*999,field_geometric_components_type)
2473 distance_vector(1:region_dimensions)=point_values-interpolated_point%VALUES(:,
no_part_deriv)
2474 function_value=dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
2475 main_loop:
DO itr1=1,data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
2487 function_gradient(1)= &
2488 & -2.0_dp*(dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
part_deriv_s1)))
2489 function_gradient(2)= &
2490 & -2.0_dp*(dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
part_deriv_s2)))
2492 function_hessian(1,1)= -2.0_dp*(&
2493 & dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
part_deriv_s1_s1))- &
2495 function_hessian(1,2)= -2.0_dp*(&
2496 & dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
part_deriv_s1_s2))- &
2498 function_hessian(2,2)= -2.0_dp*(&
2499 & dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
part_deriv_s2_s2))- &
2502 temp1=0.5_dp*(function_hessian(1,1)+function_hessian(2,2))
2503 temp2=dsqrt((0.5_dp*(function_hessian(1,1)-function_hessian(2,2)))**2+function_hessian(1,2)**2)
2504 eigen_min=temp1-temp2
2505 eigen_max=temp1+temp2
2506 function_gradient_norm=dsqrt(dot_product(function_gradient,function_gradient))
2507 DO itr2=1,data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
2508 temp1=function_gradient_norm/delta
2509 inside_region=(eigen_min>=temp1).AND.(eigen_min>absolute_tolerance)
2510 IF(inside_region)
THEN 2511 det=eigen_min*eigen_max
2512 hessian_diagonal(1)=function_hessian(1,1)
2513 hessian_diagonal(2)=function_hessian(2,2)
2515 eigen_shift=max(temp1-eigen_min,absolute_tolerance)
2516 det=temp1*(eigen_max+eigen_shift)
2517 hessian_diagonal(1)=function_hessian(1,1)+eigen_shift
2518 hessian_diagonal(2)=function_hessian(2,2)+eigen_shift
2520 xi_update(1)=-(hessian_diagonal(2)*function_gradient(1)-function_hessian(1,2)*function_gradient(2))/det
2521 xi_update(2)=(function_hessian(1,2)*function_gradient(1)-hessian_diagonal(1)*function_gradient(2))/det
2522 xi_update_norm=dsqrt(dot_product(xi_update,xi_update))
2525 IF((bound(ni)/=0).AND.(bound(ni)>0.EQV.xi_update(ni)>0.0_dp))
THEN 2535 IF(.NOT.inside_region)
THEN 2536 IF(xi_update_norm>0.0_dp)
THEN 2537 xi_update=delta/xi_update_norm*xi_update
2541 xi_update(nifix)=0.0_dp
2543 inside_region=.false.
2544 IF(function_hessian(ni,ni)>0.0_dp)
THEN 2545 xi_update(ni)=-function_gradient(ni)/function_hessian(ni,ni)
2546 xi_update_norm=dabs(xi_update(ni))
2547 inside_region=xi_update_norm<=delta
2549 IF(.NOT.inside_region)
THEN 2550 xi_update(ni)=-dsign(delta,function_gradient(ni))
2551 xi_update_norm=delta
2554 converged=xi_update_norm<absolute_tolerance
2557 IF(xi_new(ni)<0.0_dp)
THEN 2559 xi_new(3-ni)=xi(3-ni)-xi_update(3-ni)*xi(ni)/xi_update(ni)
2560 ELSEIF(xi_new(ni)>1.0_dp)
THEN 2562 xi_new(3-ni)=xi(3-ni)+xi_update(3-ni)*(1.0_dp-xi(ni))/xi_update(ni)
2565 CALL field_interpolate_xi(
second_part_deriv,xi_new,interpolated_point,err,error,*999,field_geometric_components_type)
2566 distance_vector=point_values-interpolated_point%VALUES(:,
no_part_deriv)
2567 function_value_new=dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
2568 converged=converged.AND.(dabs(function_value_new-function_value)/(1.0_dp+function_value)<relative_tolerance)
2570 function_value=function_value_new
2573 IF((function_value_new-function_value)>absolute_tolerance)
THEN 2574 IF(delta<=minimum_delta)
THEN 2576 function_value=function_value_new
2579 delta=dmax1(minimum_delta,0.25_dp*delta)
2581 predicted_reduction=dot_product(function_gradient,xi_update)+ &
2582 & 0.5_dp*(xi_update(1)*(xi_update(1)*function_hessian(1,1)+2.0_dp*xi_update(2)*function_hessian(1,2))+ &
2583 & xi_update(2)**2*function_hessian(2,2))
2584 prediction_accuracy=(function_value_new-function_value)/predicted_reduction
2585 IF(prediction_accuracy<0.01_dp)
THEN 2586 IF(delta<=minimum_delta)
THEN 2588 function_value=function_value_new
2591 delta=dmax1(minimum_delta,0.5_dp*delta)
2592 ELSEIF(prediction_accuracy>0.9_dp.AND.prediction_accuracy<1.1_dp)
THEN 2593 delta=dmin1(maximum_delta,2.0_dp*delta)
2594 function_value=function_value_new
2597 function_value=function_value_new
2602 function_value=function_value_new
2613 projection_exit_tag=exit_tag
2614 projection_element_number=element_number
2615 projection_element_face_number=element_face_number
2616 projection_distance=dsqrt(function_value)
2618 projection_vector=distance_vector
2622 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
2625 CALL flag_error(
"Data projection is not associated.",err,error,*999)
2628 exits(
"DATA_PROJECTION_NEWTON_FACES_EVALUATE")
2630 999 errorsexits(
"DATA_PROJECTION_NEWTON_FACES_EVALUATE",err,error)
2641 & candidate_element_lines,projection_exit_tag,projection_element_number,projection_element_line_number,projection_distance, &
2642 & projection_xi,projection_vector,err,error,*)
2646 REAL(DP),
INTENT(IN) :: POINT_VALUES(:)
2647 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENTS(:)
2648 INTEGER(INTG),
INTENT(IN) :: CANDIDATE_ELEMENT_LINES(:)
2649 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_EXIT_TAG
2650 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_ELEMENT_NUMBER
2651 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_ELEMENT_LINE_NUMBER
2652 REAL(DP),
INTENT(OUT) :: PROJECTION_DISTANCE
2653 REAL(DP),
INTENT(OUT) :: PROJECTION_XI(1)
2654 REAL(DP),
INTENT(OUT) :: PROJECTION_VECTOR(3)
2655 INTEGER(INTG),
INTENT(OUT) :: ERR
2659 LOGICAL :: INSIDE_REGION,CONVERGED
2660 INTEGER(INTG) :: ELEMENT_NUMBER,ELEMENT_LINE_NUMBER,LINE_NUMBER
2661 INTEGER(INTG) :: REGION_DIMENSIONS
2662 INTEGER(INTG) :: BOUND,EXIT_TAG
2663 REAL(DP) :: XI(1),XI_NEW(1),XI_UPDATE(1),XI_UPDATE_NORM
2664 REAL(DP) :: DISTANCE_VECTOR(3),RELATIVE_TOLERANCE,ABSOLUTE_TOLERANCE
2665 REAL(DP) :: FUNCTION_VALUE,FUNCTION_VALUE_NEW
2666 REAL(DP) :: FUNCTION_GRADIENT,FUNCTION_HESSIAN
2667 REAL(DP) :: MAXIMUM_DELTA,MINIMUM_DELTA,DELTA
2668 REAL(DP) :: PREDICTED_REDUCTION,PREDICTION_ACCURACY
2670 INTEGER(INTG) :: ne,itr1,itr2
2672 enters(
"DATA_PROJECTION_NEWTON_LINES_EVALUATE",err,error,*999)
2674 IF(
ASSOCIATED(data_projection))
THEN 2675 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 2677 region_dimensions=data_projection%COORDINATE_SYSTEM_DIMENSIONS
2678 relative_tolerance=data_projection%RELATIVE_TOLERANCE
2679 absolute_tolerance=data_projection%ABSOLUTE_TOLERANCE
2680 maximum_delta=data_projection%MAXIMUM_ITERATION_UPDATE
2681 minimum_delta=0.025_dp*maximum_delta
2682 DO ne=1,
SIZE(candidate_elements,1)
2683 element_number=candidate_elements(ne)
2684 element_line_number=candidate_element_lines(ne)
2685 line_number=interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%TOPOLOGY%ELEMENTS%ELEMENTS( &
2686 & element_number)%ELEMENT_LINES(element_line_number)
2689 delta=0.5_dp*maximum_delta
2690 CALL field_interpolation_parameters_line_get(field_values_set_type,line_number,interpolated_point% &
2691 & interpolation_parameters,err,error,*999,field_geometric_components_type)
2692 xi=data_projection%STARTING_XI
2693 CALL field_interpolate_xi(
second_part_deriv,xi,interpolated_point,err,error,*999,field_geometric_components_type)
2694 distance_vector(1:region_dimensions)=point_values-interpolated_point%VALUES(:,
no_part_deriv)
2695 function_value=dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
2696 main_loop:
DO itr1=1,data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
2706 function_gradient=-2.0_dp* &
2707 & (dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
first_part_deriv)))
2709 function_hessian=-2.0_dp*(&
2710 & dot_product(distance_vector(1:region_dimensions),interpolated_point%VALUES(:,
second_part_deriv))- &
2714 DO itr2=1,data_projection%MAXIMUM_NUMBER_OF_ITERATIONS
2715 inside_region=.false.
2716 IF(function_hessian>absolute_tolerance)
THEN 2717 xi_update(1)=-function_gradient/function_hessian
2718 xi_update_norm=dabs(xi_update(1))
2719 inside_region=xi_update_norm<=delta
2721 IF(.NOT.inside_region)
THEN 2722 xi_update(1)=-dsign(delta,function_gradient)
2723 xi_update_norm=delta
2725 IF((bound/=0).AND.(bound>0.EQV.xi_update(1)>0.0_dp))
THEN 2729 converged=xi_update_norm<absolute_tolerance
2731 IF(xi_new(1)<0.0_dp)
THEN 2733 ELSEIF(xi_new(1)>1.0_dp)
THEN 2736 CALL field_interpolate_xi(
second_part_deriv,xi_new,interpolated_point,err,error,*999,field_geometric_components_type)
2737 distance_vector=point_values-interpolated_point%VALUES(:,
no_part_deriv)
2738 function_value_new=dot_product(distance_vector(1:region_dimensions),distance_vector(1:region_dimensions))
2739 converged=converged.AND.(dabs(function_value_new-function_value)/(1.0_dp+function_value)<relative_tolerance)
2741 IF((function_value_new-function_value)>absolute_tolerance)
THEN 2742 IF(delta<=minimum_delta)
THEN 2746 delta=dmax1(minimum_delta,0.25_dp*delta)
2748 predicted_reduction=xi_update(1)*(function_gradient+0.5_dp*function_hessian*xi_update(1))
2749 prediction_accuracy=(function_value_new-function_value)/predicted_reduction
2750 IF(prediction_accuracy<0.01_dp)
THEN 2751 IF(delta<=minimum_delta)
THEN 2755 delta=dmax1(minimum_delta,0.5_dp*delta)
2756 ELSEIF(prediction_accuracy>0.9_dp.AND.prediction_accuracy<1.1_dp)
THEN 2757 delta=dmin1(maximum_delta,2.0_dp*delta)
2764 function_value=function_value_new
2774 projection_exit_tag=exit_tag
2775 projection_element_number=element_number
2776 projection_element_line_number=element_line_number
2777 projection_distance=dsqrt(function_value)
2779 projection_vector=distance_vector
2783 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
2786 CALL flag_error(
"Data projection is not associated.",err,error,*999)
2789 exits(
"DATA_PROJECTION_NEWTON_LINES_EVALUATE")
2791 999 errorsexits(
"DATA_PROJECTION_NEWTON_LINES_EVALUATE",err,error)
2805 INTEGER(INTG),
INTENT(OUT) :: NUMBER_OF_CLOSEST_ELEMENTS
2806 INTEGER(INTG),
INTENT(OUT) :: ERR
2810 enters(
"DataProjection_NumberOfClosestElementsGet",err,error,*999)
2812 IF(
ASSOCIATED(data_projection))
THEN 2813 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 2814 number_of_closest_elements=data_projection%NUMBER_OF_CLOSEST_ELEMENTS
2816 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
2819 CALL flag_error(
"Data projection is not associated.",err,error,*999)
2822 exits(
"DataProjection_NumberOfClosestElementsGet")
2824 999 errorsexits(
"DataProjection_NumberOfClosestElementsGet",err,error)
2838 INTEGER(INTG),
INTENT(IN) :: NUMBER_OF_CLOSEST_ELEMENTS
2839 INTEGER(INTG),
INTENT(OUT) :: ERR
2843 enters(
"DataProjection_NumberOfClosestElementsSet",err,error,*999)
2845 IF(
ASSOCIATED(data_projection))
THEN 2846 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 2847 CALL flag_error(
"Data projection have been finished.",err,error,*999)
2849 IF(number_of_closest_elements>=1)
THEN 2850 data_projection%NUMBER_OF_CLOSEST_ELEMENTS=number_of_closest_elements
2852 CALL flag_error(
"Data projection number of closest elements must be at least 1.",err,error,*999)
2856 CALL flag_error(
"Data projection is not associated.",err,error,*999)
2859 exits(
"DataProjection_NumberOfClosestElementsSet")
2861 999 errorsexits(
"DataProjection_NumberOfClosestElementsSet",err,error)
2875 INTEGER(INTG),
INTENT(IN) :: elementUserNumber(:)
2876 INTEGER(INTG),
INTENT(IN) :: localFaceLineNumbers(:)
2877 INTEGER(INTG),
INTENT(OUT) :: err
2880 INTEGER(INTG) :: elementIdx,elementMeshNumber
2881 INTEGER(INTG) :: meshComponentNumber=1
2882 LOGICAL :: elementExists
2884 enters(
"DataProjection_ProjectionCandidatesSet",err,error,*999)
2886 IF(
ASSOCIATED(dataprojection))
THEN 2887 IF(
SIZE(elementusernumber,1)==
SIZE(localfacelinenumbers,1))
THEN 2888 ALLOCATE(dataprojection%candidateElementNumbers(
SIZE(elementusernumber,1)),stat=err)
2889 IF(err/=0)
CALL flag_error(
"Could not allocate candidiate element numbers.",err,error,*998)
2890 ALLOCATE(dataprojection%localFaceLineNumbers(
SIZE(localfacelinenumbers,1)),stat=err)
2891 IF(err/=0)
CALL flag_error(
"Could not allocate candidiate local face/line numbers.",err,error,*999)
2892 DO elementidx=1,
SIZE(elementusernumber,1)
2893 CALL meshtopologyelementcheckexists(dataprojection%MESH,meshcomponentnumber,elementusernumber(elementidx), &
2894 & elementexists,elementmeshnumber,err,error,*999)
2895 IF(elementexists)
THEN 2896 dataprojection%candidateElementNumbers(elementidx)=elementusernumber(elementidx)
2897 dataprojection%localFaceLineNumbers(elementidx)=localfacelinenumbers(elementidx)
2900 & (elementusernumber(elementidx),
"*",err,error))//
") does not exist.",err,error,*999)
2904 CALL flag_error(
"Input user element numbers and face numbers sizes do not match.",err,error,*999)
2907 CALL flag_error(
"Data projection is not associated.",err,error,*999)
2910 exits(
"DataProjection_ProjectionCandidatesSet")
2912 999
IF(
ALLOCATED(dataprojection%candidateElementNumbers))
THEN 2913 DEALLOCATE(dataprojection%candidateElementNumbers)
2915 IF(
ALLOCATED(dataprojection%localFaceLineNumbers))
THEN 2916 DEALLOCATE(dataprojection%localFaceLineNumbers)
2918 998 errorsexits(
"DataProjection_ProjectionCandidatesSet",err,error)
2932 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_TYPE
2933 INTEGER(INTG),
INTENT(OUT) :: ERR
2937 enters(
"DATA_PROJECTION_PROJECTION_TYPE_GET",err,error,*999)
2939 IF(
ASSOCIATED(data_projection))
THEN 2940 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 2941 projection_type=data_projection%PROJECTION_TYPE
2943 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
2946 CALL flag_error(
"Data projection is not associated.",err,error,*999)
2949 exits(
"DATA_PROJECTION_PROJECTION_TYPE_GET")
2951 999 errorsexits(
"DATA_PROJECTION_PROJECTION_TYPE_GET",err,error)
2965 INTEGER(INTG),
INTENT(IN) :: PROJECTION_TYPE
2966 INTEGER(INTG),
INTENT(OUT) :: ERR
2969 REAL(DP),
ALLOCATABLE :: STARTING_XI(:)
2971 enters(
"DATA_PROJECTION_PROJECTION_TYPE_SET",err,error,*999)
2973 IF(
ASSOCIATED(data_projection))
THEN 2974 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 2975 CALL flag_error(
"Data projection have been finished.",err,error,*999)
2977 data_projection%PROJECTION_TYPE=projection_type
2978 SELECT CASE(projection_type)
2980 data_projection%NUMBER_OF_XI=1
2982 data_projection%NUMBER_OF_XI=2
2984 data_projection%NUMBER_OF_XI=data_projection%MESH%NUMBER_OF_DIMENSIONS
2986 CALL flag_error(
"Input projection type is undefined.",err,error,*999)
2988 IF(data_projection%NUMBER_OF_XI/=
SIZE(data_projection%STARTING_XI,1))
THEN 2989 ALLOCATE(starting_xi(data_projection%NUMBER_OF_XI),stat=err)
2990 IF(err/=0)
CALL flag_error(
"Could not allocate starting xi.",err,error,*999)
2991 IF(data_projection%NUMBER_OF_XI>
SIZE(data_projection%STARTING_XI,1))
THEN 2992 starting_xi(1:
SIZE(data_projection%STARTING_XI,1))=data_projection%STARTING_XI(1:
SIZE(data_projection%STARTING_XI,1))
2993 starting_xi(
SIZE(data_projection%STARTING_XI,1):data_projection%NUMBER_OF_XI)=0.5_dp
2995 starting_xi(1:
SIZE(data_projection%STARTING_XI,1))=data_projection%STARTING_XI(1:data_projection%NUMBER_OF_XI)
2997 DEALLOCATE(data_projection%STARTING_XI)
2998 ALLOCATE(data_projection%STARTING_XI(data_projection%NUMBER_OF_XI),stat=err)
2999 IF(err/=0)
CALL flag_error(
"Could not allocate data projection starting xi.",err,error,*999)
3000 data_projection%STARTING_XI(1:data_projection%NUMBER_OF_XI)=starting_xi(1:data_projection%NUMBER_OF_XI)
3004 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3007 exits(
"DATA_PROJECTION_PROJECTION_TYPE_SET")
3009 999 errorsexits(
"DATA_PROJECTION_PROJECTION_TYPE_SET",err,error)
3023 REAL(DP),
INTENT(OUT) :: RELATIVE_TOLERANCE
3024 INTEGER(INTG),
INTENT(OUT) :: ERR
3028 enters(
"DATA_PROJECTION_RELATIVE_TOLERANCE_GET",err,error,*999)
3030 IF(
ASSOCIATED(data_projection))
THEN 3031 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3032 relative_tolerance=data_projection%RELATIVE_TOLERANCE
3034 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
3037 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3040 exits(
"DATA_PROJECTION_RELATIVE_TOLERANCE_GET")
3042 999 errorsexits(
"DATA_PROJECTION_RELATIVE_TOLERANCE_GET",err,error)
3056 REAL(DP),
INTENT(IN) :: RELATIVE_TOLERANCE
3057 INTEGER(INTG),
INTENT(OUT) :: ERR
3060 enters(
"DATA_PROJECTION_RELATIVE_TOLERANCE_SET",err,error,*999)
3062 IF(
ASSOCIATED(data_projection))
THEN 3063 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3064 CALL flag_error(
"Data projection have been finished.",err,error,*999)
3066 IF(relative_tolerance>=0)
THEN 3067 data_projection%RELATIVE_TOLERANCE=relative_tolerance
3069 CALL flag_error(
"Data projection relative tolerance must be a positive real number.",err,error,*999)
3073 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3076 exits(
"DATA_PROJECTION_RELATIVE_TOLERANCE_SET")
3078 999 errorsexits(
"DATA_PROJECTION_RELATIVE_TOLERANCE_SET",err,error)
3093 REAL(DP),
INTENT(OUT) :: STARTING_XI(:)
3094 INTEGER(INTG),
INTENT(OUT) :: ERR
3097 CHARACTER(LEN=MAXSTRLEN) :: LOCAL_ERROR
3099 enters(
"DATA_PROJECTION_STARTING_XI_GET",err,error,*999)
3101 IF(
ASSOCIATED(data_projection))
THEN 3102 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3103 IF(
SIZE(starting_xi,1)>=
SIZE(data_projection%STARTING_XI,1))
THEN 3104 starting_xi(1:
SIZE(data_projection%STARTING_XI,1))=data_projection%STARTING_XI(1:
SIZE(data_projection%STARTING_XI,1))
3106 WRITE(local_error,
'("The size of the supplied starting xi array of ",I2," is too small. The size must be >= ",I2,".")' &
3107 & )
SIZE(starting_xi,1),
SIZE(data_projection%STARTING_XI,1)
3111 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
3114 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3117 exits(
"DATA_PROJECTION_STARTING_XI_GET")
3119 999 errorsexits(
"DATA_PROJECTION_STARTING_XI_GET",err,error)
3133 REAL(DP),
INTENT(IN) :: STARTING_XI(:)
3134 INTEGER(INTG),
INTENT(OUT) :: ERR
3138 LOGICAL :: VALID_INPUT
3140 enters(
"DATA_PROJECTION_STARTING_XI_SET",err,error,*999)
3142 IF(
ASSOCIATED(data_projection))
THEN 3143 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3144 CALL flag_error(
"Data projection have been finished.",err,error,*999)
3146 IF(
SIZE(starting_xi,1)==
SIZE(data_projection%STARTING_XI,1))
THEN 3148 DO ni=1,
SIZE(starting_xi,1)
3149 IF((starting_xi(ni)<0).OR.(starting_xi(ni)>1))
THEN 3154 IF(valid_input)
THEN 3155 data_projection%STARTING_XI(1:
SIZE(starting_xi))=starting_xi(1:
SIZE(starting_xi))
3157 CALL flag_error(
"Data projection starting xi must be between 0 and 1.",err,error,*999)
3160 CALL flag_error(
"Data projection starting xi dimension mismatch.",err,error,*999)
3164 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3167 exits(
"DATA_PROJECTION_STARTING_XI_SET")
3169 999 errorsexits(
"DATA_PROJECTION_STARTING_XI_SET",err,error)
3183 INTEGER(INTG),
INTENT(IN) :: DATA_POINT_USER_NUMBER
3184 INTEGER(INTG),
INTENT(IN) :: ELEMENT_USER_NUMBER
3185 INTEGER(INTG),
INTENT(OUT) :: ERR
3188 INTEGER(INTG) :: DATA_POINT_GLOBAL_NUMBER
3189 LOGICAL :: DATA_POINT_EXISTS
3191 enters(
"DATA_PROJECTION_ELEMENT_SET",err,error,*999)
3193 IF(
ASSOCIATED(data_projection))
THEN 3195 & data_point_global_number,err,error,*999)
3196 IF(data_point_exists)
THEN 3197 data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%ELEMENT_NUMBER=element_user_number
3200 & (data_point_user_number,
"*",err,error))//
") does not exist.",err,error,*999)
3203 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3206 exits(
"DATA_PROJECTION_ELEMENT_SET")
3208 999 errorsexits(
"DATA_PROJECTION_ELEMENT_SET",err,error)
3222 INTEGER(INTG),
INTENT(IN) :: DATA_POINT_USER_NUMBER
3223 REAL(DP),
INTENT(OUT) :: PROJECTION_DISTANCE
3224 INTEGER(INTG),
INTENT(OUT) :: ERR
3227 INTEGER(INTG) :: DATA_POINT_GLOBAL_NUMBER
3229 enters(
"DATA_PROJECTION_RESULT_DISTANCE_GET",err,error,*999)
3231 IF(
ASSOCIATED(data_projection))
THEN 3232 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3233 IF(data_projection%DATA_PROJECTION_PROJECTED)
THEN 3235 & data_point_global_number,err,error,*999)
3236 projection_distance=data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%DISTANCE
3238 CALL flag_error(
"Data projection have not been projected.",err,error,*999)
3241 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
3244 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3247 exits(
"DATA_PROJECTION_RESULT_DISTANCE_GET")
3249 999 errorsexits(
"DATA_PROJECTION_RESULT_DISTANCE_GET",err,error)
3264 INTEGER(INTG),
INTENT(OUT) :: ERR
3268 enters(
"DATA_PROJECTION_LABEL_GET_VS",err,error,*999)
3270 IF(
ASSOCIATED(data_projection))
THEN 3271 label=data_projection%LABEL
3273 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3276 exits(
"DATA_PROJECTION_LABEL_GET_VS")
3278 999 errorsexits(
"DATA_PROJECTION_LABEL_GET_VS",err,error)
3292 CHARACTER(LEN=*),
INTENT(OUT) :: LABEL
3293 INTEGER(INTG),
INTENT(OUT) :: ERR
3296 INTEGER(INTG) :: C_LENGTH,VS_LENGTH
3298 enters(
"DATA_PROJECTION_LABEL_GET_C",err,error,*999)
3300 IF(
ASSOCIATED(data_projection))
THEN 3302 vs_length=
len_trim(data_projection%LABEL)
3303 IF(c_length>vs_length)
THEN 3306 label=
char(data_projection%LABEL,c_length)
3309 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3312 exits(
"DATA_PROJECTION_LABEL_GET_C")
3314 999 errorsexits(
"DATA_PROJECTION_LABEL_GET_C",err,error)
3328 CHARACTER(LEN=*),
INTENT(IN) :: LABEL
3329 INTEGER(INTG),
INTENT(OUT) :: ERR
3333 enters(
"DATA_PROJECTION_LABEL_SET_C",err,error,*999)
3335 IF(
ASSOCIATED(data_projection))
THEN 3336 data_projection%LABEL=label
3338 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3341 exits(
"DATA_PROJECTION_LABEL_SET_C")
3343 999 errorsexits(
"DATA_PROJECTION_LABEL_SET_C",err,error)
3358 INTEGER(INTG),
INTENT(OUT) :: ERR
3362 enters(
"DATA_PROJECTION_LABEL_SET_VS",err,error,*999)
3364 IF(
ASSOCIATED(data_projection))
THEN 3365 data_projection%LABEL=label
3367 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3370 exits(
"DATA_PROJECTION_LABEL_SET_VS")
3372 999 errorsexits(
"DATA_PROJECTION_LABEL_SET_VS",err,error)
3387 INTEGER(INTG),
INTENT(IN) :: DATA_POINT_USER_NUMBER
3388 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_ELEMENT_NUMBER
3389 INTEGER(INTG),
INTENT(OUT) :: ERR
3392 INTEGER(INTG) :: DATA_POINT_GLOBAL_NUMBER
3394 enters(
"DATA_PROJECTION_RESULT_ELEMENT_NUMBER_GET",err,error,*999)
3396 IF(
ASSOCIATED(data_projection))
THEN 3397 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3398 IF(data_projection%DATA_PROJECTION_PROJECTED)
THEN 3400 & data_point_global_number,err,error,*999)
3401 projection_element_number=data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%ELEMENT_NUMBER
3403 CALL flag_error(
"Data projection have not been projected.",err,error,*999)
3406 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
3409 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3412 exits(
"DATA_PROJECTION_RESULT_ELEMENT_NUMBER_GET")
3414 999 errorsexits(
"DATA_PROJECTION_RESULT_ELEMENT_NUMBER_GET",err,error)
3429 INTEGER(INTG),
INTENT(IN) :: DATA_POINT_USER_NUMBER
3430 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_ELEMENT_FACE_NUMBER
3431 INTEGER(INTG),
INTENT(OUT) :: ERR
3434 INTEGER(INTG) :: DATA_POINT_GLOBAL_NUMBER
3436 enters(
"DataProjection_ResultElementFaceNumberGet",err,error,*999)
3438 IF(
ASSOCIATED(data_projection))
THEN 3439 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3440 IF(data_projection%DATA_PROJECTION_PROJECTED)
THEN 3444 & data_point_global_number,err,error,*999)
3445 projection_element_face_number=data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%ELEMENT_FACE_NUMBER
3447 CALL flag_error(
"Data projection data projection projection type is not set to boundary faces projection type.", &
3451 CALL flag_error(
"Data projection have not been projected.",err,error,*999)
3454 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
3457 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3460 exits(
"DataProjection_ResultElementFaceNumberGet")
3462 999 errorsexits(
"DataProjection_ResultElementFaceNumberGet",err,error)
3477 INTEGER(INTG),
INTENT(IN) :: DATA_POINT_USER_NUMBER
3478 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_ELEMENT_LINE_NUMBER
3479 INTEGER(INTG),
INTENT(OUT) :: ERR
3482 INTEGER(INTG) :: DATA_POINT_GLOBAL_NUMBER
3484 enters(
"DataProjection_ResultElementLineNumberGet",err,error,*999)
3486 IF(
ASSOCIATED(data_projection))
THEN 3487 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3488 IF(data_projection%DATA_PROJECTION_PROJECTED)
THEN 3492 & data_point_global_number,err,error,*999)
3493 projection_element_line_number=data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%ELEMENT_LINE_NUMBER
3495 CALL flag_error(
"Data projection data projection projection type is not set to boundary lines projection type.", &
3499 CALL flag_error(
"Data projection have not been projected.",err,error,*999)
3502 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
3505 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3508 exits(
"DataProjection_ResultElementLineNumberGet")
3510 999 errorsexits(
"DataProjection_ResultElementLineNumberGet",err,error)
3524 INTEGER(INTG),
INTENT(IN) :: DATA_POINT_USER_NUMBER
3525 INTEGER(INTG),
INTENT(OUT) :: PROJECTION_EXIT_TAG
3526 INTEGER(INTG),
INTENT(OUT) :: ERR
3529 INTEGER(INTG) :: DATA_POINT_GLOBAL_NUMBER
3531 enters(
"DATA_PROJECTION_RESULT_EXIT_TAG_GET",err,error,*999)
3533 IF(
ASSOCIATED(data_projection))
THEN 3534 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3535 IF(data_projection%DATA_PROJECTION_PROJECTED)
THEN 3537 & data_point_global_number,err,error,*999)
3538 projection_exit_tag=data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%EXIT_TAG
3540 CALL flag_error(
"Data projection have not been projected.",err,error,*999)
3543 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
3546 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3549 exits(
"DATA_PROJECTION_RESULT_EXIT_TAG_GET")
3551 999 errorsexits(
"DATA_PROJECTION_RESULT_EXIT_TAG_GET",err,error)
3565 INTEGER(INTG),
INTENT(IN) :: DATA_POINT_USER_NUMBER
3566 REAL(DP),
INTENT(OUT) :: PROJECTION_XI(:)
3567 INTEGER(INTG),
INTENT(OUT) :: ERR
3570 INTEGER(INTG) :: DATA_POINT_GLOBAL_NUMBER
3572 enters(
"DATA_PROJECTION_RESULT_XI_GET",err,error,*999)
3574 IF(
ASSOCIATED(data_projection))
THEN 3575 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3576 IF(data_projection%DATA_PROJECTION_PROJECTED)
THEN 3578 & data_point_global_number,err,error,*999)
3579 IF(
SIZE(projection_xi,1)==
SIZE(data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%XI,1))
THEN 3580 projection_xi=data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%XI
3583 &
"but it needs to have size of "// &
3585 & (data_point_global_number)%XI,1),
"*",err,error))// &
3586 &
"." ,err,error,*999)
3589 CALL flag_error(
"Data projection have not been projected.",err,error,*999)
3592 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
3595 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3598 exits(
"DATA_PROJECTION_RESULT_XI_GET")
3600 999 errorsexits(
"DATA_PROJECTION_RESULT_XI_GET",err,error)
3614 INTEGER(INTG),
INTENT(IN) :: DATA_POINT_USER_NUMBER
3615 REAL(DP),
INTENT(IN) :: PROJECTION_XI(:)
3616 INTEGER(INTG),
INTENT(OUT) :: ERR
3619 INTEGER(INTG) :: DATA_POINT_GLOBAL_NUMBER
3621 enters(
"DATA_PROJECTION_RESULT_XI_SET",err,error,*999)
3623 IF(
ASSOCIATED(data_projection))
THEN 3624 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3625 IF(data_projection%DATA_PROJECTION_PROJECTED)
THEN 3627 & data_point_global_number,err,error,*999)
3628 IF(
SIZE(projection_xi,1)==
SIZE(data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%XI,1))
THEN 3629 data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%XI(1:
SIZE(projection_xi,1))= &
3630 & projection_xi(1:
SIZE(projection_xi,1))
3633 &
"but it needs to have size of "// &
3635 & (data_point_global_number)%XI,1),
"*",err,error))// &
3636 &
"." ,err,error,*999)
3639 CALL flag_error(
"Data projection have not been projected.",err,error,*999)
3642 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
3645 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3648 exits(
"DATA_PROJECTION_RESULT_XI_SET")
3650 999 errorsexits(
"DATA_PROJECTION_RESULT_XI_SET",err,error)
3664 INTEGER(INTG),
INTENT(IN) :: DATA_POINT_USER_NUMBER
3665 REAL(DP),
INTENT(OUT) :: projectionVector(:)
3666 INTEGER(INTG),
INTENT(OUT) :: ERR
3669 INTEGER(INTG) :: DATA_POINT_GLOBAL_NUMBER
3671 enters(
"DataProjection_ResultProjectionVectorGet",err,error,*999)
3673 IF(
ASSOCIATED(data_projection))
THEN 3674 IF(data_projection%DATA_PROJECTION_FINISHED)
THEN 3675 IF(data_projection%DATA_PROJECTION_PROJECTED)
THEN 3677 & data_point_global_number,err,error,*999)
3678 IF(
SIZE(projectionvector,1)>=
SIZE(data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)%projectionVector, &
3680 projectionvector=data_projection%DATA_PROJECTION_RESULTS(data_point_global_number)% &
3681 & projectionvector(1:data_projection%COORDINATE_SYSTEM_DIMENSIONS)
3684 &
"but it needs to have size of "// &
3686 & (data_point_global_number)%projectionVector,1),
"*",err,error))// &
3687 &
"." ,err,error,*999)
3690 CALL flag_error(
"Data projection have not been projected.",err,error,*999)
3693 CALL flag_error(
"Data projection have not been finished.",err,error,*999)
3696 CALL flag_error(
"Data projection is not associated.",err,error,*999)
3699 exits(
"DataProjection_ResultProjectionVectorGet")
3701 999 errorsexits(
"DataProjection_ResultProjectionVectorGet",err,error)
subroutine data_projection_label_set_c(DATA_PROJECTION, LABEL, ERR, ERROR,)
Sets the label for a data projection for varying string labels.
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
subroutine, public data_projection_create_start_data_points(DATA_PROJECTION_USER_NUMBER, DATA_POINTS, MESH, DATA_PROJECTION, ERR, ERROR,)
Starts the process of creating data projection.
integer, parameter ptr
Pointer integer kind.
subroutine dataprojection_datapointcheckexist(DataProjection, dataPointUserNumber, dataPointExist, dataPointGlobalNumber, err, error,)
Checks that a user data point number is defined for a specific data projection.
integer(intg), parameter second_part_deriv
Second partial derivative i.e., d^2u/ds^2.
subroutine, public data_projection_result_xi_get(DATA_PROJECTION, DATA_POINT_USER_NUMBER, PROJECTION_XI, ERR, ERROR,)
Gets the projection xi for a data point identified by a given global number.
Converts a number to its equivalent varying string representation.
Implements trees of base types.
subroutine, public dataprojection_numberofclosestelementsget(DATA_PROJECTION, NUMBER_OF_CLOSEST_ELEMENTS, ERR, ERROR,)
Gets the number of closest elements for a data projection.
Contains information on the mesh decomposition.
subroutine, public data_projection_element_set(DATA_PROJECTION, DATA_POINT_USER_NUMBER, ELEMENT_USER_NUMBER, ERR, ERROR,)
Sets the element for a data projection.
subroutine, public data_projection_projection_type_set(DATA_PROJECTION, PROJECTION_TYPE, ERR, ERROR,)
Sets the projection type for a data projection.
subroutine, public dataprojection_resultprojectionvectorget(DATA_PROJECTION, DATA_POINT_USER_NUMBER, projectionVector, ERR, ERROR,)
Gets the projection vector for a data point identified by a given global number.
subroutine, public data_projection_result_distance_get(DATA_PROJECTION, DATA_POINT_USER_NUMBER, PROJECTION_DISTANCE, ERR, ERROR,)
Gets the projection distance for a data point identified by a given global number.
subroutine, public dataprojection_maximumnumberofiterationsset(DATA_PROJECTION, MAXIMUM_NUMBER_OF_ITERATIONS, ERR, ERROR,)
Sets the maximum number of iterations for a data projection.
integer(intg), parameter no_part_deriv
No partial derivative i.e., u.
Sets/changes the label for a data projection.
subroutine, public dataprojection_maximuminterationupdateset(DATA_PROJECTION, MAXIMUM_ITERATION_UPDATE, ERR, ERROR,)
Sets the maximum iteration update for a data projection.
Contains information on the data points defined on a region.
Gets the label for a data projection.
subroutine, public tree_search(TREE, KEY, X, ERR, ERROR,)
Searches a tree to see if it contains a key.
This module contains all string manipulation and transformation routines.
subroutine, public data_projection_projection_type_get(DATA_PROJECTION, PROJECTION_TYPE, ERR, ERROR,)
Gets the projection type for a data projection.
subroutine, public dataprojection_datapointsprojectionevaluate(DATA_PROJECTION, PROJECTION_FIELD, ERR, ERROR,)
Evaluates data projection.
integer(intg), parameter first_part_deriv
First partial derivative i.e., du/ds.
subroutine data_projection_newton_lines_evaluate(DATA_PROJECTION, INTERPOLATED_POINT, POINT_VALUES, CANDIDATE_ELEMENTS, CANDIDATE_ELEMENT_LINES, PROJECTION_EXIT_TAG, PROJECTION_ELEMENT_NUMBER, PROJECTION_ELEMENT_LINE_NUMBER, PROJECTION_DISTANCE, PROJECTION_XI, PROJECTION_VECTOR, ERR, ERROR,)
Find the projection of a data point onto element lines (slight difference to DATA_PROJECTION_NEWTON_E...
A buffer type to allow for an array of pointers to a DATA_PROJECTION_TYPE.
integer(intg), parameter part_deriv_s2
First partial derivative in the s2 direction i.e., du/ds2.
subroutine data_projection_label_get_vs(DATA_PROJECTION, LABEL, ERR, ERROR,)
Gets the label for a data projection for varying string labels.
Contains information for a field defined on a region.
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
subroutine data_projection_newton_elements_evaluate_1(DATA_PROJECTION, INTERPOLATED_POINT, POINT_VALUES, CANDIDATE_ELEMENTS, PROJECTION_EXIT_TAG, PROJECTION_ELEMENT_NUMBER, PROJECTION_DISTANCE, PROJECTION_XI, PROJECTION_VECTOR, ERR, ERROR,)
Find the projection of a data point onto 1D elements.
This module contains all program wide constants.
subroutine data_projection_closest_elements_find(DATA_PROJECTION, INTERPOLATED_POINT, POINT_VALUES, CANDIDATE_ELEMENTS, NUMBER_OF_CANDIDATES, CLOSEST_ELEMENTS, CLOSEST_DISTANCES, ERR, ERROR,)
Find the closest elements to a data point based on starting xi guess.
integer(intg), parameter part_deriv_s1
First partial derivative in the s1 direction i.e., du/ds1.
subroutine, public data_projection_relative_tolerance_set(DATA_PROJECTION, RELATIVE_TOLERANCE, ERR, ERROR,)
Sets the relative tolerance for a data projection.
integer(intg), parameter, public data_projection_boundary_faces_projection_type
The boundary face projection type for data projection, only projects to boundary faces of the mesh...
subroutine, public dataprojection_maximumnumberofiterationsget(DATA_PROJECTION, MAXIMUM_NUMBER_OF_ITERATIONS, ERR, ERROR,)
Gets the maximum number of iterations for a data projection.
subroutine, public dataprojection_projectioncandidatesset(dataProjection, elementUserNumber, localFaceLineNumbers, err, error,)
Sets the candidates element numbers and local line/face numbers for a data projection.
integer(intg), parameter, public data_projection_boundary_lines_projection_type
The boundary line projection type for data projection, only projects to boundary lines of the mesh...
subroutine, public exits(NAME)
Records the exit out of the named procedure.
This module contains all type definitions in order to avoid cyclic module references.
subroutine, public dataprojection_numberofclosestelementsset(DATA_PROJECTION, NUMBER_OF_CLOSEST_ELEMENTS, ERR, ERROR,)
Sets the number of closest elements for a data projection.
subroutine dataprojection_datapointglobalnumberget(DATA_PROJECTION, USER_NUMBER, GLOBAL_NUMBER, ERR, ERROR,)
Gets the user number for a data point identified by a given global number.
subroutine data_projection_label_get_c(DATA_PROJECTION, LABEL, ERR, ERROR,)
Gets the label for a data projection for character labels.
This module handles all data projection routines.
integer(intg), parameter part_deriv_s3
First partial derivative in the s3 direction i.e., du/ds3.
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
integer(intg), parameter part_deriv_s1_s1
Second partial derivative in the s1 direction i.e., d^2u/ds1ds1.
subroutine data_projection_closest_faces_find(DATA_PROJECTION, INTERPOLATED_POINT, POINT_VALUES, CANDIDATE_ELEMENTS, CANDIDATE_ELEMENT_FACES, NUMBER_OF_CANDIDATES, CLOSEST_ELEMENTS, CLOSEST_ELEMENT_FACES, CLOSEST_DISTANCES, ERR, ERROR,)
Find the closest faces to a data point base on starting xi guess.
integer(intg), parameter part_deriv_s2_s3
Cross derivative in the s2 and s3 direction i.e., d^2u/ds2ds3.
subroutine, public data_projection_starting_xi_set(DATA_PROJECTION, STARTING_XI, ERR, ERROR,)
Sets the starting xi for a data projection.
integer(intg), parameter part_deriv_s1_s3
Cross derivative in the s1 and s3 direction i.e., d^2u/ds1ds3.
This module contains all computational environment variables.
This module contains CMISS MPI routines.
This module handles all domain mappings routines.
This module contains all procedures for sorting. NOTE: THE ROUTINES IN THIS MODULE HAVE NOT BEEN TEST...
subroutine data_projection_newton_faces_evaluate(DATA_PROJECTION, INTERPOLATED_POINT, POINT_VALUES, CANDIDATE_ELEMENTS, CANDIDATE_ELEMENT_FACES, PROJECTION_EXIT_TAG, PROJECTION_ELEMENT_NUMBER, PROJECTION_ELEMENT_FACE_NUMBER, PROJECTION_DISTANCE, PROJECTION_XI, PROJECTION_VECTOR, ERR, ERROR,)
Find the projection of a data point onto element faces (slight difference to DATA_PROJECTION_NEWTON_E...
type(computational_environment_type), target, public computational_environment
The computational environment the program is running in.
Contains information on a mesh defined on a region.
subroutine, public data_projection_result_exit_tag_get(DATA_PROJECTION, DATA_POINT_USER_NUMBER, PROJECTION_EXIT_TAG, ERR, ERROR,)
Gets the projection exit tag for a data point identified by a given global number.
subroutine, public dataprojection_maximuminterationupdateget(DATA_PROJECTION, MAXIMUM_ITERATION_UPDATE, ERR, ERROR,)
Gets the maximum iteration update for a data projection.
subroutine data_projection_newton_elements_evaluate_2(DATA_PROJECTION, INTERPOLATED_POINT, POINT_VALUES, CANDIDATE_ELEMENTS, PROJECTION_EXIT_TAG, PROJECTION_ELEMENT_NUMBER, PROJECTION_DISTANCE, PROJECTION_XI, PROJECTION_VECTOR, ERR, ERROR,)
Find the projection of a data point onto 2D elements.
subroutine, public data_projection_result_element_number_get(DATA_PROJECTION, DATA_POINT_USER_NUMBER, PROJECTION_ELEMENT_NUMBER, ERR, ERROR,)
Gets the projection element number for a data point identified by a given global number.
Contains the interpolated value (and the derivatives wrt xi) of a field at a point. Old CMISS name XG.
subroutine, public data_projection_starting_xi_get(DATA_PROJECTION, STARTING_XI, ERR, ERROR,)
Gets the starting xi for a data projection.
subroutine data_projection_newton_elements_evaluate_3(DATA_PROJECTION, INTERPOLATED_POINT, POINT_VALUES, CANDIDATE_ELEMENTS, PROJECTION_EXIT_TAG, PROJECTION_ELEMENT_NUMBER, PROJECTION_DISTANCE, PROJECTION_XI, PROJECTION_VECTOR, ERR, ERROR,)
Find the projection of a data point onto 3D elements.
subroutine, public data_projection_absolute_tolerance_get(DATA_PROJECTION, ABSOLUTE_TOLERANCE, ERR, ERROR,)
Gets the absolute tolerance for a data projection.
real(dp), parameter twopi
The double value of 2pi.
subroutine, public data_projection_relative_tolerance_get(DATA_PROJECTION, RELATIVE_TOLERANCE, ERR, ERROR,)
Gets the relative tolerance for a data projection.
integer(intg), parameter part_deriv_s1_s2
Cross derivative in the s1 and s2 direction i.e., d^2u/ds1ds2.
integer(intg), parameter part_deriv_s2_s2
Second partial derivative in the s2 direction i.e., d^2u/ds2ds2.
subroutine, public data_projection_absolute_tolerance_set(DATA_PROJECTION, ABSOLUTE_TOLERANCE, ERR, ERROR,)
Sets the absolute tolerance for a data projection.
integer(intg), parameter part_deriv_s3_s3
Second partial derivative in the s3 direction i.e., d^2u/ds3ds3.
Contains information on the domain mappings (i.e., local and global numberings).
A pointer to the domain decomposition for this domain.
subroutine, public tree_item_insert(TREE, KEY, VALUE, INSERT_STATUS, ERR, ERROR,)
Inserts a tree node into a red-black tree.
subroutine, public errors(NAME, ERR, ERROR)
Records the exiting error of the subroutine.
subroutine data_projection_finalise(DATA_PROJECTION, ERR, ERROR,)
Finalise a data projection.
subroutine, public tree_node_value_get(TREE, TREE_NODE, VALUE, ERR, ERROR,)
Gets the value at a specified tree node.
subroutine, public data_projection_result_xi_set(DATA_PROJECTION, DATA_POINT_USER_NUMBER, PROJECTION_XI, ERR, ERROR,)
Sets the projection xi for a data point identified by a given global number.
subroutine data_projection_closest_lines_find(DATA_PROJECTION, INTERPOLATED_POINT, POINT_VALUES, CANDIDATE_ELEMENTS, CANDIDATE_ELEMENT_LINES, NUMBER_OF_CANDIDATES, CLOSEST_ELEMENTS, CLOSEST_ELEMENT_LINES, CLOSEST_DISTANCES, ERR, ERROR,)
Find the closest lines to a data point base on starting xi guess.
subroutine, public data_projection_create_finish(DATA_PROJECTION, ERR, ERROR,)
Finishes the process of creating data projection.
Flags an error condition.
subroutine dataprojection_dataprojectionresultinitialise(DATA_PROJECTION, ERR, ERROR,)
Initialises the data projection part in a given data points. %%%%% THIS NEED TO BE CHANGED!!! TIM...
subroutine, public dataprojection_resultelementfacenumberget(DATA_PROJECTION, DATA_POINT_USER_NUMBER, PROJECTION_ELEMENT_FACE_NUMBER, ERR, ERROR,)
Gets the projection element face number for a data point identified by a given global number...
integer(intg) function, public computational_node_number_get(ERR, ERROR)
Returns the number/rank of the computational nodes.
integer(intg), parameter, public data_projection_all_elements_projection_type
The element projection type for data projection, projects to all elements in mesh.
subroutine data_projection_label_set_vs(DATA_PROJECTION, LABEL, ERR, ERROR,)
Sets the label for a data projection for varying string labels.
subroutine, public dataprojection_datapointspositionevaluate(dataProjection, field, fieldVariableType, err, error,)
Evaluate the data points position in a field based on data projection.
subroutine, public dataprojection_resultelementlinenumberget(DATA_PROJECTION, DATA_POINT_USER_NUMBER, PROJECTION_ELEMENT_LINE_NUMBER, ERR, ERROR,)
Gets the projection element line number for a data point identified by a given global number...
subroutine, public data_projection_destroy(DATA_PROJECTION, ERR, ERROR,)
Destroys a data projection.
real(dp), parameter zero_tolerance
This module contains all kind definitions.
subroutine, public mpi_error_check(ROUTINE, MPI_ERR_CODE, ERR, ERROR,)
Checks to see if an MPI error has occured during an MPI call and flags a CMISS error it if it has...