OpenCMISS-Iron Internal API Documentation
field_routines.f90
Go to the documentation of this file.
1 
43 
45 MODULE field_routines
46 
47  USE base_routines
48  USE basis_routines
51  USE cmiss_mpi
53  USE domain_mappings
54  USE kinds
55  USE input_output
57  USE lists
58  USE maths
59 #ifndef NOMPIMOD
60  USE mpi
61 #endif
62  USE mesh_routines
63  USE node_routines
64  USE strings
65  USE types
66 
67 #include "macros.h"
68 
69  IMPLICIT NONE
70 
71 #ifdef NOMPIMOD
72 #include "mpif.h"
73 #endif
74 
75  PRIVATE
76 
77  !Module parameters
78 
83  INTEGER(INTG), PARAMETER :: field_independent_type=1
84  INTEGER(INTG), PARAMETER :: field_dependent_type=2
86 
91  INTEGER(INTG), PARAMETER :: field_scalar_dimension_type=1
92  INTEGER(INTG), PARAMETER :: field_vector_dimension_type=2
93  INTEGER(INTG), PARAMETER :: field_tensor_dimension_type=3
95 
100  INTEGER(INTG), PARAMETER :: field_geometric_type=1
101  INTEGER(INTG), PARAMETER :: field_fibre_type=2
102  INTEGER(INTG), PARAMETER :: field_general_type=3
103  INTEGER(INTG), PARAMETER :: field_material_type=4
104  INTEGER(INTG), PARAMETER :: field_geometric_general_type=5
106 
111  INTEGER(INTG), PARAMETER :: field_constant_interpolation=1
112  INTEGER(INTG), PARAMETER :: field_element_based_interpolation=2
113  INTEGER(INTG), PARAMETER :: field_node_based_interpolation=3
114  INTEGER(INTG), PARAMETER :: field_grid_point_based_interpolation=4
115  INTEGER(INTG), PARAMETER :: field_gauss_point_based_interpolation=5
116  INTEGER(INTG), PARAMETER :: field_data_point_based_interpolation=6
118 
124  INTEGER(INTG), PARAMETER :: field_number_of_variable_types=48
125  INTEGER(INTG), PARAMETER :: field_number_of_variable_subtypes=4
126  INTEGER(INTG), PARAMETER :: field_u_variable_type=1
127  INTEGER(INTG), PARAMETER :: field_deludeln_variable_type=2
128  INTEGER(INTG), PARAMETER :: field_deludelt_variable_type=3
129  INTEGER(INTG), PARAMETER :: field_del2udelt2_variable_type=4
130  INTEGER(INTG), PARAMETER :: field_v_variable_type=5
131  INTEGER(INTG), PARAMETER :: field_delvdeln_variable_type=6
132  INTEGER(INTG), PARAMETER :: field_delvdelt_variable_type=7
133  INTEGER(INTG), PARAMETER :: field_del2vdelt2_variable_type=8
134  INTEGER(INTG), PARAMETER :: field_u1_variable_type=9
135  INTEGER(INTG), PARAMETER :: field_delu1deln_variable_type=10
136  INTEGER(INTG), PARAMETER :: field_delu1delt_variable_type=11
137  INTEGER(INTG), PARAMETER :: field_del2u1delt2_variable_type=12
138  INTEGER(INTG), PARAMETER :: field_u2_variable_type=13
139  INTEGER(INTG), PARAMETER :: field_delu2deln_variable_type=14
140  INTEGER(INTG), PARAMETER :: field_delu2delt_variable_type=15
141  INTEGER(INTG), PARAMETER :: field_del2u2delt2_variable_type=16
142  INTEGER(INTG), PARAMETER :: field_u3_variable_type=17
143  INTEGER(INTG), PARAMETER :: field_delu3deln_variable_type=18
144  INTEGER(INTG), PARAMETER :: field_delu3delt_variable_type=19
145  INTEGER(INTG), PARAMETER :: field_del2u3delt2_variable_type=20
146  INTEGER(INTG), PARAMETER :: field_u4_variable_type=21
147  INTEGER(INTG), PARAMETER :: field_delu4deln_variable_type=22
148  INTEGER(INTG), PARAMETER :: field_delu4delt_variable_type=23
149  INTEGER(INTG), PARAMETER :: field_del2u4delt2_variable_type=24
150  INTEGER(INTG), PARAMETER :: field_u5_variable_type=25
151  INTEGER(INTG), PARAMETER :: field_delu5deln_variable_type=26
152  INTEGER(INTG), PARAMETER :: field_delu5delt_variable_type=27
153  INTEGER(INTG), PARAMETER :: field_del2u5delt2_variable_type=28
154  INTEGER(INTG), PARAMETER :: field_u6_variable_type=29
155  INTEGER(INTG), PARAMETER :: field_delu6deln_variable_type=30
156  INTEGER(INTG), PARAMETER :: field_delu6delt_variable_type=31
157  INTEGER(INTG), PARAMETER :: field_del2u6delt2_variable_type=32
158  INTEGER(INTG), PARAMETER :: field_u7_variable_type=33
159  INTEGER(INTG), PARAMETER :: field_delu7deln_variable_type=34
160  INTEGER(INTG), PARAMETER :: field_delu7delt_variable_type=35
161  INTEGER(INTG), PARAMETER :: field_del2u7delt2_variable_type=36
162  INTEGER(INTG), PARAMETER :: field_u8_variable_type=37
163  INTEGER(INTG), PARAMETER :: field_delu8deln_variable_type=38
164  INTEGER(INTG), PARAMETER :: field_delu8delt_variable_type=39
165  INTEGER(INTG), PARAMETER :: field_del2u8delt2_variable_type=40
166  INTEGER(INTG), PARAMETER :: field_u9_variable_type=41
167  INTEGER(INTG), PARAMETER :: field_delu9deln_variable_type=42
168  INTEGER(INTG), PARAMETER :: field_delu9delt_variable_type=43
169  INTEGER(INTG), PARAMETER :: field_del2u9delt2_variable_type=44
170  INTEGER(INTG), PARAMETER :: field_u10_variable_type=45
171  INTEGER(INTG), PARAMETER :: field_delu10deln_variable_type=46
172  INTEGER(INTG), PARAMETER :: field_delu10delt_variable_type=47
173  INTEGER(INTG), PARAMETER :: field_del2u10delt2_variable_type=48
175 
180  INTEGER(INTG), PARAMETER :: field_constant_dof_type=1
181  INTEGER(INTG), PARAMETER :: field_element_dof_type=2
182  INTEGER(INTG), PARAMETER :: field_node_dof_type=3
183  INTEGER(INTG), PARAMETER :: field_grid_point_dof_type=4
184  INTEGER(INTG), PARAMETER :: field_gauss_point_dof_type=5
185  INTEGER(INTG), PARAMETER :: field_data_point_dof_type=6
187 
192  INTEGER(INTG), PARAMETER :: field_intg_type=1
193  INTEGER(INTG), PARAMETER :: field_sp_type=2
194  INTEGER(INTG), PARAMETER :: field_dp_type=3
195  INTEGER(INTG), PARAMETER :: field_l_type=4
197 
202  INTEGER(INTG), PARAMETER :: field_separated_component_dof_order=1
203  INTEGER(INTG), PARAMETER :: field_contiguous_component_dof_order=2
205 
210  INTEGER(INTG), PARAMETER :: field_number_of_set_types=99
211  INTEGER(INTG), PARAMETER :: field_values_set_type=1
212  INTEGER(INTG), PARAMETER :: field_boundary_conditions_set_type=2
213  INTEGER(INTG), PARAMETER :: field_initial_values_set_type=3
214  INTEGER(INTG), PARAMETER :: field_incremental_values_set_type=4
215  INTEGER(INTG), PARAMETER :: field_analytic_values_set_type=5
216  INTEGER(INTG), PARAMETER :: field_previous_values_set_type=6
217  INTEGER(INTG), PARAMETER :: field_mean_predicted_displacement_set_type=7
218  INTEGER(INTG), PARAMETER :: field_velocity_values_set_type=8
219  INTEGER(INTG), PARAMETER :: field_initial_velocity_set_type=9
220  INTEGER(INTG), PARAMETER :: field_previous_velocity_set_type=9
221  INTEGER(INTG), PARAMETER :: field_mean_predicted_velocity_set_type=10
222  INTEGER(INTG), PARAMETER :: field_acceleration_values_set_type=11
223  INTEGER(INTG), PARAMETER :: field_initial_acceleration_set_type=12
224  INTEGER(INTG), PARAMETER :: field_previous_acceleration_set_type=12
225  INTEGER(INTG), PARAMETER :: field_mean_predicted_acceleration_set_type=13
226  INTEGER(INTG), PARAMETER :: field_predicted_displacement_set_type=14
227  INTEGER(INTG), PARAMETER :: field_predicted_velocity_set_type=15
228  INTEGER(INTG), PARAMETER :: field_predicted_acceleration_set_type=16
229  INTEGER(INTG), PARAMETER :: field_residual_set_type=17
230  INTEGER(INTG), PARAMETER :: field_previous_residual_set_type=18
231  INTEGER(INTG), PARAMETER :: field_mesh_displacement_set_type=19
232  INTEGER(INTG), PARAMETER :: field_mesh_velocity_set_type=20
233  INTEGER(INTG), PARAMETER :: field_boundary_set_type=21
234  INTEGER(INTG), PARAMETER :: field_input_data1_set_type=22
235  INTEGER(INTG), PARAMETER :: field_input_data2_set_type=23
236  INTEGER(INTG), PARAMETER :: field_input_data3_set_type=24
237  INTEGER(INTG), PARAMETER :: field_input_vel1_set_type=25
238  INTEGER(INTG), PARAMETER :: field_input_vel2_set_type=26
239  INTEGER(INTG), PARAMETER :: field_input_vel3_set_type=27
240  INTEGER(INTG), PARAMETER :: field_input_label_set_type=28
241  INTEGER(INTG), PARAMETER :: field_pressure_values_set_type=29
242  INTEGER(INTG), PARAMETER :: field_previous_pressure_set_type=30
243  INTEGER(INTG), PARAMETER :: field_relative_velocity_set_type=31
244  INTEGER(INTG), PARAMETER :: field_negative_mesh_velocity_set_type=32
245  INTEGER(INTG), PARAMETER :: field_previous_iteration_values_set_type=33
246  INTEGER(INTG), PARAMETER :: field_impermeable_flag_values_set_type=34
247  INTEGER(INTG), PARAMETER :: field_integrated_neumann_set_type=35
248  INTEGER(INTG), PARAMETER :: field_upwind_values_set_type=36
249  INTEGER(INTG), PARAMETER :: field_previous_upwind_values_set_type=37
251 
256  INTEGER(INTG), PARAMETER :: field_no_scaling=0
257  INTEGER(INTG), PARAMETER :: field_unit_scaling=1
258  INTEGER(INTG), PARAMETER :: field_arc_length_scaling=2
259  INTEGER(INTG), PARAMETER :: field_arithmetic_mean_scaling=3
260  INTEGER(INTG), PARAMETER :: field_geometric_mean_scaling=4
261  INTEGER(INTG), PARAMETER :: field_harmonic_mean_scaling=5
263 
268  INTEGER(INTG), PARAMETER :: field_all_components_type=1
269  INTEGER(INTG), PARAMETER :: field_geometric_components_type=2
270  INTEGER(INTG), PARAMETER :: field_nongeometric_components_type=3
272 
273  !Module types
274 
275  !Module variables
276 
277  !Interfaces
278 
279  INTERFACE field_componentinterpolationcheck
280  MODULE PROCEDURE field_component_interpolation_check
281  END INTERFACE field_componentinterpolationcheck
282 
283  INTERFACE field_componentinterpolationget
284  MODULE PROCEDURE field_component_interpolation_get
285  END INTERFACE field_componentinterpolationget
286 
287  INTERFACE field_componentinterpolationset
288  MODULE PROCEDURE field_component_interpolation_set
289  END INTERFACE field_componentinterpolationset
290 
291  INTERFACE field_componentinterpolationsetandlock
292  MODULE PROCEDURE field_component_interpolation_set_and_lock
293  END INTERFACE field_componentinterpolationsetandlock
294 
296  INTERFACE field_component_label_get
297  MODULE PROCEDURE field_component_label_get_c
298  MODULE PROCEDURE field_component_label_get_vs
299  END INTERFACE field_component_label_get
300 
302  INTERFACE field_componentlabelget
303  MODULE PROCEDURE field_component_label_get_c
304  MODULE PROCEDURE field_component_label_get_vs
305  END INTERFACE field_componentlabelget
306 
308  INTERFACE field_component_label_set
309  MODULE PROCEDURE field_component_label_set_c
310  MODULE PROCEDURE field_component_label_set_vs
311  END INTERFACE field_component_label_set
312 
314  INTERFACE field_componentlabelset
315  MODULE PROCEDURE field_component_label_set_c
316  MODULE PROCEDURE field_component_label_set_vs
317  END INTERFACE field_componentlabelset
318 
320  INTERFACE field_component_label_set_and_lock
321  MODULE PROCEDURE field_component_label_set_and_lock_c
322  MODULE PROCEDURE field_component_label_set_and_lock_vs
323  END INTERFACE field_component_label_set_and_lock
324 
326  INTERFACE field_componentlabelsetandlock
327  MODULE PROCEDURE field_component_label_set_and_lock_c
328  MODULE PROCEDURE field_component_label_set_and_lock_vs
329  END INTERFACE field_componentlabelsetandlock
330 
331  INTERFACE field_componentmeshcomponentcheck
332  MODULE PROCEDURE field_component_mesh_component_check
333  END INTERFACE field_componentmeshcomponentcheck
334 
335  INTERFACE field_componentmeshcomponentget
336  MODULE PROCEDURE field_component_mesh_component_get
337  END INTERFACE field_componentmeshcomponentget
338 
339  INTERFACE field_componentmeshcomponentset
340  MODULE PROCEDURE field_component_mesh_component_set
341  END INTERFACE field_componentmeshcomponentset
342 
343  INTERFACE field_componentmeshcomponentsetandlock
344  MODULE PROCEDURE field_component_mesh_component_set_and_lock
345  END INTERFACE field_componentmeshcomponentsetandlock
346 
348  INTERFACE field_component_values_initialise
349  MODULE PROCEDURE field_component_values_initialise_intg
350  MODULE PROCEDURE field_component_values_initialise_sp
351  MODULE PROCEDURE field_component_values_initialise_dp
352  MODULE PROCEDURE field_component_values_initialise_l
353  END INTERFACE field_component_values_initialise
354 
356  INTERFACE field_componentvaluesinitialise
357  MODULE PROCEDURE field_component_values_initialise_intg
358  MODULE PROCEDURE field_component_values_initialise_sp
359  MODULE PROCEDURE field_component_values_initialise_dp
360  MODULE PROCEDURE field_component_values_initialise_l
361  END INTERFACE field_componentvaluesinitialise
362 
363  INTERFACE field_coordinatesystemget
364  MODULE PROCEDURE field_coordinate_system_get
365  END INTERFACE field_coordinatesystemget
366 
367  INTERFACE field_createfinish
368  MODULE PROCEDURE field_create_finish
369  END INTERFACE field_createfinish
370 
372  INTERFACE field_create_start
373  MODULE PROCEDURE field_create_start_interface
374  MODULE PROCEDURE field_create_start_region
375  END INTERFACE field_create_start
376 
378  INTERFACE field_createstart
379  MODULE PROCEDURE field_create_start_interface
380  MODULE PROCEDURE field_create_start_region
381  END INTERFACE field_createstart
382 
383  INTERFACE field_destroy
384  MODULE PROCEDURE field_destroy
385  END INTERFACE field_destroy
386 
387  INTERFACE field_datatypecheck
388  MODULE PROCEDURE field_data_type_check
389  END INTERFACE field_datatypecheck
390 
391  INTERFACE field_datatypeget
392  MODULE PROCEDURE field_data_type_get
393  END INTERFACE field_datatypeget
394 
395  INTERFACE field_datatypeset
396  MODULE PROCEDURE field_data_type_set
397  END INTERFACE field_datatypeset
398 
399  INTERFACE field_datatypesetandlock
400  MODULE PROCEDURE field_data_type_set_and_lock
401  END INTERFACE field_datatypesetandlock
402 
403  INTERFACE field_dependenttypecheck
404  MODULE PROCEDURE field_dependent_type_check
405  END INTERFACE field_dependenttypecheck
406 
407  INTERFACE field_dependenttypeget
408  MODULE PROCEDURE field_dependent_type_get
409  END INTERFACE field_dependenttypeget
410 
411  INTERFACE field_dependenttypeset
412  MODULE PROCEDURE field_dependent_type_set
413  END INTERFACE field_dependenttypeset
414 
415  INTERFACE field_dependenttypesetandlock
416  MODULE PROCEDURE field_dependent_type_set_and_lock
417  END INTERFACE field_dependenttypesetandlock
418 
419  INTERFACE field_dimensioncheck
420  MODULE PROCEDURE field_dimension_check
421  END INTERFACE field_dimensioncheck
422 
423  INTERFACE field_dimensionget
424  MODULE PROCEDURE field_dimension_get
425  END INTERFACE field_dimensionget
426 
427  INTERFACE field_dimensionset
428  MODULE PROCEDURE field_dimension_set
429  END INTERFACE field_dimensionset
430 
431  INTERFACE field_dimensionsetandlock
432  MODULE PROCEDURE field_dimension_set_and_lock
433  END INTERFACE field_dimensionsetandlock
434 
435  INTERFACE field_dofordertypecheck
436  MODULE PROCEDURE field_dof_order_type_check
437  END INTERFACE field_dofordertypecheck
438 
439  INTERFACE field_dofordertypeget
440  MODULE PROCEDURE field_dof_order_type_get
441  END INTERFACE field_dofordertypeget
442 
443  INTERFACE field_dofordertypeset
444  MODULE PROCEDURE field_dof_order_type_set
445  END INTERFACE field_dofordertypeset
446 
447  INTERFACE field_dofordertypesetandlock
448  MODULE PROCEDURE field_dof_order_type_set_and_lock
449  END INTERFACE field_dofordertypesetandlock
450 
451  INTERFACE field_geometricfieldget
452  MODULE PROCEDURE field_geometric_field_get
453  END INTERFACE field_geometricfieldget
454 
455  INTERFACE field_geometricfieldset
456  MODULE PROCEDURE field_geometric_field_set
457  END INTERFACE field_geometricfieldset
458 
459  INTERFACE field_geometricfieldsetandlock
460  MODULE PROCEDURE field_geometric_field_set_and_lock
461  END INTERFACE field_geometricfieldsetandlock
462 
463  INTERFACE field_interpolategauss
464  MODULE PROCEDURE field_interpolate_gauss
465  END INTERFACE field_interpolategauss
466 
467  INTERFACE field_interpolatexi
468  MODULE PROCEDURE field_interpolate_xi
469  END INTERFACE field_interpolatexi
470 
471  INTERFACE field_interpolatenode
472  MODULE PROCEDURE field_interpolate_node
473  END INTERFACE field_interpolatenode
474 
475  INTERFACE field_interpolatefieldnode
476  MODULE PROCEDURE field_interpolate_field_node
477  END INTERFACE field_interpolatefieldnode
478 
479  INTERFACE field_interpolatelocalfacegauss
480  MODULE PROCEDURE field_interpolate_local_face_gauss
481  END INTERFACE field_interpolatelocalfacegauss
482 
483  INTERFACE field_interpolatedpointmetricscalculate
484  MODULE PROCEDURE field_interpolated_point_metrics_calculate
485  END INTERFACE field_interpolatedpointmetricscalculate
486 
487  INTERFACE field_interpolatedpointsfinalise
488  MODULE PROCEDURE field_interpolated_points_finalise
489  END INTERFACE field_interpolatedpointsfinalise
490 
491  INTERFACE field_interpolatedpointsinitialise
492  MODULE PROCEDURE field_interpolated_points_initialise
493  END INTERFACE field_interpolatedpointsinitialise
494 
495  INTERFACE field_interpolationparameterselementget
496  MODULE PROCEDURE field_interpolation_parameters_element_get
497  END INTERFACE field_interpolationparameterselementget
498 
499  INTERFACE field_interpolationparametersfinalise
500  MODULE PROCEDURE field_interpolation_parameters_finalise
501  END INTERFACE field_interpolationparametersfinalise
502 
503  INTERFACE field_interpolationparametersinitialise
504  MODULE PROCEDURE field_interpolation_parameters_initialise
505  END INTERFACE field_interpolationparametersinitialise
506 
507  INTERFACE field_interpolationparametersfaceget
508  MODULE PROCEDURE field_interpolation_parameters_face_get
509  END INTERFACE field_interpolationparametersfaceget
510 
511  INTERFACE field_interpolationparameterslineget
512  MODULE PROCEDURE field_interpolation_parameters_line_get
513  END INTERFACE field_interpolationparameterslineget
514 
516  INTERFACE field_label_get
517  MODULE PROCEDURE field_label_get_c
518  MODULE PROCEDURE field_label_get_vs
519  END INTERFACE field_label_get
520 
522  INTERFACE field_labelget
523  MODULE PROCEDURE field_label_get_c
524  MODULE PROCEDURE field_label_get_vs
525  END INTERFACE field_labelget
526 
528  INTERFACE field_label_set
529  MODULE PROCEDURE field_label_set_c
530  MODULE PROCEDURE field_label_set_vs
531  END INTERFACE field_label_set
532 
534  INTERFACE field_labelset
535  MODULE PROCEDURE field_label_set_c
536  MODULE PROCEDURE field_label_set_vs
537  END INTERFACE field_labelset
538 
540  INTERFACE field_label_set_and_lock
541  MODULE PROCEDURE field_label_set_and_lock_c
542  MODULE PROCEDURE field_label_set_and_lock_vs
543  END INTERFACE field_label_set_and_lock
544 
546  INTERFACE field_labelsetandlock
547  MODULE PROCEDURE field_label_set_and_lock_c
548  MODULE PROCEDURE field_label_set_and_lock_vs
549  END INTERFACE field_labelsetandlock
550 
551  INTERFACE field_meshdecompositionget
552  MODULE PROCEDURE field_mesh_decomposition_get
553  END INTERFACE field_meshdecompositionget
554 
555  INTERFACE field_meshdecompositionset
556  MODULE PROCEDURE field_mesh_decomposition_set
557  END INTERFACE field_meshdecompositionset
558 
559  INTERFACE field_meshdecompositionsetandlock
560  MODULE PROCEDURE field_mesh_decomposition_set_and_lock
561  END INTERFACE field_meshdecompositionsetandlock
562 
563  INTERFACE field_numberofcomponentscheck
564  MODULE PROCEDURE field_number_of_components_check
565  END INTERFACE field_numberofcomponentscheck
566 
567  INTERFACE field_numberofcomponentsget
568  MODULE PROCEDURE field_number_of_components_get
569  END INTERFACE field_numberofcomponentsget
570 
571  INTERFACE field_numberofcomponentsset
572  MODULE PROCEDURE field_number_of_components_set
573  END INTERFACE field_numberofcomponentsset
574 
575  INTERFACE field_numberofcomponentssetandlock
576  MODULE PROCEDURE field_number_of_components_set_and_lock
577  END INTERFACE field_numberofcomponentssetandlock
578 
579  INTERFACE field_numberofvariablescheck
580  MODULE PROCEDURE field_number_of_variables_check
581  END INTERFACE field_numberofvariablescheck
582 
583  INTERFACE field_numberofvariablesget
584  MODULE PROCEDURE field_number_of_variables_get
585  END INTERFACE field_numberofvariablesget
586 
587  INTERFACE field_numberofvariablesset
588  MODULE PROCEDURE field_number_of_variables_set
589  END INTERFACE field_numberofvariablesset
590 
591  INTERFACE field_numberofvariablessetandlock
592  MODULE PROCEDURE field_number_of_variables_set_and_lock
593  END INTERFACE field_numberofvariablessetandlock
594 
596  INTERFACE field_parameter_sets_add
597  MODULE PROCEDURE field_parameter_sets_add_dp
598  MODULE PROCEDURE field_parameter_sets_add_dp1
599  END INTERFACE field_parameter_sets_add
600 
602  INTERFACE field_parametersetsadd
603  MODULE PROCEDURE field_parameter_sets_add_dp
604  MODULE PROCEDURE field_parameter_sets_add_dp1
605  END INTERFACE field_parametersetsadd
606 
607  INTERFACE field_parametersetscopy
608  MODULE PROCEDURE field_parameter_sets_copy
609  END INTERFACE field_parametersetscopy
610 
611  INTERFACE field_parametersetdestroy
612  MODULE PROCEDURE field_parameter_set_destroy
613  END INTERFACE field_parametersetdestroy
614 
615  INTERFACE field_parametersetget
616  MODULE PROCEDURE field_parameter_set_get
617  END INTERFACE field_parametersetget
618 
620  INTERFACE field_parameter_set_add_constant
621  MODULE PROCEDURE field_parameter_set_add_constant_intg
622  MODULE PROCEDURE field_parameter_set_add_constant_sp
623  MODULE PROCEDURE field_parameter_set_add_constant_dp
624  MODULE PROCEDURE field_parameter_set_add_constant_l
625  END INTERFACE field_parameter_set_add_constant
626 
628  INTERFACE field_parametersetaddconstant
629  MODULE PROCEDURE field_parameter_set_add_constant_intg
630  MODULE PROCEDURE field_parameter_set_add_constant_sp
631  MODULE PROCEDURE field_parameter_set_add_constant_dp
632  MODULE PROCEDURE field_parameter_set_add_constant_l
633  END INTERFACE field_parametersetaddconstant
634 
636  INTERFACE field_parameter_set_add_local_dof
637  MODULE PROCEDURE field_parameter_set_add_local_dof_intg
638  MODULE PROCEDURE field_parameter_set_add_local_dof_sp
639  MODULE PROCEDURE field_parameter_set_add_local_dof_dp
640  MODULE PROCEDURE field_parameter_set_add_local_dof_l
641  END INTERFACE field_parameter_set_add_local_dof
642 
644  INTERFACE field_parametersetaddlocaldof
645  MODULE PROCEDURE field_parameter_set_add_local_dof_intg
646  MODULE PROCEDURE field_parameter_set_add_local_dof_sp
647  MODULE PROCEDURE field_parameter_set_add_local_dof_dp
648  MODULE PROCEDURE field_parameter_set_add_local_dof_l
649  END INTERFACE field_parametersetaddlocaldof
650 
652  INTERFACE field_parameter_set_add_element
653  MODULE PROCEDURE field_parameter_set_add_element_intg
654  MODULE PROCEDURE field_parameter_set_add_element_sp
655  MODULE PROCEDURE field_parameter_set_add_element_dp
656  MODULE PROCEDURE field_parameter_set_add_element_l
657  END INTERFACE field_parameter_set_add_element
658 
660  INTERFACE field_parametersetaddelement
661  MODULE PROCEDURE field_parameter_set_add_element_intg
662  MODULE PROCEDURE field_parameter_set_add_element_sp
663  MODULE PROCEDURE field_parameter_set_add_element_dp
664  MODULE PROCEDURE field_parameter_set_add_element_l
665  END INTERFACE field_parametersetaddelement
666 
668  INTERFACE field_parameter_set_add_local_element
669  MODULE PROCEDURE field_parameter_set_add_local_element_intg
670  MODULE PROCEDURE field_parameter_set_add_local_element_sp
671  MODULE PROCEDURE field_parameter_set_add_local_element_dp
672  MODULE PROCEDURE field_parameter_set_add_local_element_l
673  END INTERFACE field_parameter_set_add_local_element
674 
676  INTERFACE field_parametersetaddlocalelement
677  MODULE PROCEDURE field_parameter_set_add_local_element_intg
678  MODULE PROCEDURE field_parameter_set_add_local_element_sp
679  MODULE PROCEDURE field_parameter_set_add_local_element_dp
680  MODULE PROCEDURE field_parameter_set_add_local_element_l
681  END INTERFACE field_parametersetaddlocalelement
682 
684  INTERFACE field_parameter_set_add_node
685  MODULE PROCEDURE field_parameter_set_add_node_intg
686  MODULE PROCEDURE field_parameter_set_add_node_sp
687  MODULE PROCEDURE field_parameter_set_add_node_dp
688  MODULE PROCEDURE field_parameter_set_add_node_l
689  END INTERFACE field_parameter_set_add_node
690 
692  INTERFACE field_parametersetaddnode
693  MODULE PROCEDURE field_parameter_set_add_node_intg
694  MODULE PROCEDURE field_parameter_set_add_node_sp
695  MODULE PROCEDURE field_parameter_set_add_node_dp
696  MODULE PROCEDURE field_parameter_set_add_node_l
697  END INTERFACE field_parametersetaddnode
698 
700  INTERFACE field_parameter_set_add_local_node
701  MODULE PROCEDURE field_parameter_set_add_local_node_intg
702  MODULE PROCEDURE field_parameter_set_add_local_node_sp
703  MODULE PROCEDURE field_parameter_set_add_local_node_dp
704  MODULE PROCEDURE field_parameter_set_add_local_node_l
705  END INTERFACE field_parameter_set_add_local_node
706 
708  INTERFACE field_parametersetaddlocalnode
709  MODULE PROCEDURE field_parameter_set_add_local_node_intg
710  MODULE PROCEDURE field_parameter_set_add_local_node_sp
711  MODULE PROCEDURE field_parameter_set_add_local_node_dp
712  MODULE PROCEDURE field_parameter_set_add_local_node_l
713  END INTERFACE field_parametersetaddlocalnode
714 
715  INTERFACE field_parametersetcreate
716  MODULE PROCEDURE field_parameter_set_create
717  END INTERFACE field_parametersetcreate
718 
719  INTERFACE field_parametersetcreated
720  MODULE PROCEDURE field_parameter_set_created
721  END INTERFACE field_parametersetcreated
722 
724  INTERFACE field_parameter_set_data_get
725  MODULE PROCEDURE field_parameter_set_data_get_intg
726  MODULE PROCEDURE field_parameter_set_data_get_sp
727  MODULE PROCEDURE field_parameter_set_data_get_dp
728  MODULE PROCEDURE field_parameter_set_data_get_l
729  END INTERFACE field_parameter_set_data_get
730 
732  INTERFACE field_parametersetdataget
733  MODULE PROCEDURE field_parameter_set_data_get_intg
734  MODULE PROCEDURE field_parameter_set_data_get_sp
735  MODULE PROCEDURE field_parameter_set_data_get_dp
736  MODULE PROCEDURE field_parameter_set_data_get_l
737  END INTERFACE field_parametersetdataget
738 
740  INTERFACE field_parameter_set_data_restore
741  MODULE PROCEDURE field_parameter_set_data_restore_intg
742  MODULE PROCEDURE field_parameter_set_data_restore_sp
743  MODULE PROCEDURE field_parameter_set_data_restore_dp
744  MODULE PROCEDURE field_parameter_set_data_restore_l
745  END INTERFACE field_parameter_set_data_restore
746 
748  INTERFACE field_parametersetdatarestore
749  MODULE PROCEDURE field_parameter_set_data_restore_intg
750  MODULE PROCEDURE field_parameter_set_data_restore_sp
751  MODULE PROCEDURE field_parameter_set_data_restore_dp
752  MODULE PROCEDURE field_parameter_set_data_restore_l
753  END INTERFACE field_parametersetdatarestore
754 
756  INTERFACE field_parameter_set_get_constant
757  MODULE PROCEDURE field_parameter_set_get_constant_intg
758  MODULE PROCEDURE field_parameter_set_get_constant_sp
759  MODULE PROCEDURE field_parameter_set_get_constant_dp
760  MODULE PROCEDURE field_parameter_set_get_constant_l
761  END INTERFACE field_parameter_set_get_constant
762 
764  INTERFACE field_parametersetgetconstant
765  MODULE PROCEDURE field_parameter_set_get_constant_intg
766  MODULE PROCEDURE field_parameter_set_get_constant_sp
767  MODULE PROCEDURE field_parameter_set_get_constant_dp
768  MODULE PROCEDURE field_parameter_set_get_constant_l
769  END INTERFACE field_parametersetgetconstant
770 
772  INTERFACE field_parametersetgetdatapoint
773  MODULE PROCEDURE field_parametersetgetdatapointintg
774  MODULE PROCEDURE field_parametersetgetdatapointsp
775  MODULE PROCEDURE field_parametersetgetdatapointdp
776  MODULE PROCEDURE field_parametersetgetdatapointl
777  END INTERFACE field_parametersetgetdatapoint
778 
780  INTERFACE field_parameter_set_get_element
781  MODULE PROCEDURE field_parameter_set_get_element_intg
782  MODULE PROCEDURE field_parameter_set_get_element_sp
783  MODULE PROCEDURE field_parameter_set_get_element_dp
784  MODULE PROCEDURE field_parameter_set_get_element_l
785  END INTERFACE field_parameter_set_get_element
786 
788  INTERFACE field_parametersetgetelement
789  MODULE PROCEDURE field_parameter_set_get_element_intg
790  MODULE PROCEDURE field_parameter_set_get_element_sp
791  MODULE PROCEDURE field_parameter_set_get_element_dp
792  MODULE PROCEDURE field_parameter_set_get_element_l
793  END INTERFACE field_parametersetgetelement
794 
796  INTERFACE field_parameter_set_get_local_dof
797  MODULE PROCEDURE field_parameter_set_get_local_dof_intg
798  MODULE PROCEDURE field_parameter_set_get_local_dof_sp
799  MODULE PROCEDURE field_parameter_set_get_local_dof_dp
800  MODULE PROCEDURE field_parameter_set_get_local_dof_l
801  END INTERFACE field_parameter_set_get_local_dof
802 
804  INTERFACE field_parametersetgetlocaldof
805  MODULE PROCEDURE field_parameter_set_get_local_dof_intg
806  MODULE PROCEDURE field_parameter_set_get_local_dof_sp
807  MODULE PROCEDURE field_parameter_set_get_local_dof_dp
808  MODULE PROCEDURE field_parameter_set_get_local_dof_l
809  END INTERFACE field_parametersetgetlocaldof
810 
812  INTERFACE field_parameter_set_get_node
813  MODULE PROCEDURE field_parameter_set_get_node_intg
814  MODULE PROCEDURE field_parameter_set_get_node_sp
815  MODULE PROCEDURE field_parameter_set_get_node_dp
816  MODULE PROCEDURE field_parameter_set_get_node_l
817  END INTERFACE field_parameter_set_get_node
818 
820  INTERFACE field_parametersetgetnode
821  MODULE PROCEDURE field_parameter_set_get_node_intg
822  MODULE PROCEDURE field_parameter_set_get_node_sp
823  MODULE PROCEDURE field_parameter_set_get_node_dp
824  MODULE PROCEDURE field_parameter_set_get_node_l
825  END INTERFACE field_parametersetgetnode
826 
828  INTERFACE field_parametersetgetlocalnode
829  MODULE PROCEDURE field_parametersetgetlocalnode_intg
830  MODULE PROCEDURE field_parametersetgetlocalnode_sp
831  MODULE PROCEDURE field_parametersetgetlocalnode_dp
832  MODULE PROCEDURE field_parametersetgetlocalnode_l
833  END INTERFACE field_parametersetgetlocalnode
834 
836  INTERFACE field_parametersetgetlocalelement
837  MODULE PROCEDURE field_parametersetgetlocalelement_intg
838  MODULE PROCEDURE field_parametersetgetlocalelement_sp
839  MODULE PROCEDURE field_parametersetgetlocalelement_dp
840  MODULE PROCEDURE field_parametersetgetlocalelement_l
841  END INTERFACE field_parametersetgetlocalelement
842 
844  INTERFACE field_parametersetgetgausspoint
845  MODULE PROCEDURE field_parametersetgetgausspointdp
846  END INTERFACE field_parametersetgetgausspoint
847 
849  INTERFACE field_parameter_set_get_gauss_point
850  MODULE PROCEDURE field_parametersetgetgausspointdp
851  END INTERFACE field_parameter_set_get_gauss_point
852 
854  INTERFACE field_parametersetgetlocalgausspoint
855  MODULE PROCEDURE field_parametersetgetlocalgausspointdp
856  END INTERFACE field_parametersetgetlocalgausspoint
857 
858  INTERFACE field_parametersetoutput
859  MODULE PROCEDURE field_parameter_set_output
860  END INTERFACE field_parametersetoutput
861 
862  INTERFACE field_parametersetupdatefinish
863  MODULE PROCEDURE field_parameter_set_update_finish
864  END INTERFACE field_parametersetupdatefinish
865 
866  INTERFACE field_parametersetupdatestart
867  MODULE PROCEDURE field_parameter_set_update_start
868  END INTERFACE field_parametersetupdatestart
869 
871  INTERFACE field_parameter_set_update_constant
872  MODULE PROCEDURE field_parameter_set_update_constant_intg
873  MODULE PROCEDURE field_parameter_set_update_constant_sp
874  MODULE PROCEDURE field_parameter_set_update_constant_dp
875  MODULE PROCEDURE field_parameter_set_update_constant_l
876  END INTERFACE field_parameter_set_update_constant
877 
879  INTERFACE field_parametersetupdateconstant
880  MODULE PROCEDURE field_parameter_set_update_constant_intg
881  MODULE PROCEDURE field_parameter_set_update_constant_sp
882  MODULE PROCEDURE field_parameter_set_update_constant_dp
883  MODULE PROCEDURE field_parameter_set_update_constant_l
884  END INTERFACE field_parametersetupdateconstant
885 
887  INTERFACE field_parametersetupdatedatapoint
888  MODULE PROCEDURE field_parametersetupdatedatapointintg
889  MODULE PROCEDURE field_parametersetupdatedatapointsp
890  MODULE PROCEDURE field_parametersetupdatedatapointdp
891  MODULE PROCEDURE field_parametersetupdatedatapointl
892  END INTERFACE field_parametersetupdatedatapoint
893 
895  INTERFACE field_parameter_set_update_local_dof
896  MODULE PROCEDURE field_parameter_set_update_local_dof_intg
897  MODULE PROCEDURE field_parameter_set_update_local_dof_sp
898  MODULE PROCEDURE field_parameter_set_update_local_dof_dp
899  MODULE PROCEDURE field_parameter_set_update_local_dof_l
900  END INTERFACE field_parameter_set_update_local_dof
901 
903  INTERFACE field_parametersetupdatelocaldof
904  MODULE PROCEDURE field_parameter_set_update_local_dof_intg
905  MODULE PROCEDURE field_parameter_set_update_local_dof_sp
906  MODULE PROCEDURE field_parameter_set_update_local_dof_dp
907  MODULE PROCEDURE field_parameter_set_update_local_dof_l
908  END INTERFACE field_parametersetupdatelocaldof
909 
911  INTERFACE field_parameter_set_update_local_dofs
912  MODULE PROCEDURE field_parameter_set_update_local_dofs_dp
913  END INTERFACE field_parameter_set_update_local_dofs
914 
916  INTERFACE field_parametersetupdatelocaldofs
917  MODULE PROCEDURE field_parameter_set_update_local_dofs_dp
918  END INTERFACE field_parametersetupdatelocaldofs
919 
921  INTERFACE field_parameter_set_update_element
922  MODULE PROCEDURE field_parameter_set_update_element_intg
923  MODULE PROCEDURE field_parameter_set_update_element_sp
924  MODULE PROCEDURE field_parameter_set_update_element_dp
925  MODULE PROCEDURE field_parameter_set_update_element_l
926  END INTERFACE field_parameter_set_update_element
927 
929  INTERFACE field_parametersetupdateelement
930  MODULE PROCEDURE field_parameter_set_update_element_intg
931  MODULE PROCEDURE field_parameter_set_update_element_sp
932  MODULE PROCEDURE field_parameter_set_update_element_dp
933  MODULE PROCEDURE field_parameter_set_update_element_l
934  END INTERFACE field_parametersetupdateelement
935 
937  INTERFACE field_parameter_set_update_local_element
938  MODULE PROCEDURE field_parametersetupdatelocalelementintg
939  MODULE PROCEDURE field_parameter_set_update_local_element_sp
940  MODULE PROCEDURE field_parameter_set_update_local_element_dp
941  MODULE PROCEDURE field_parameter_set_update_local_element_l
942  END INTERFACE field_parameter_set_update_local_element
943 
945  INTERFACE field_parametersetupdatelocalelement
946  MODULE PROCEDURE field_parametersetupdatelocalelementintg
947  MODULE PROCEDURE field_parameter_set_update_local_element_sp
948  MODULE PROCEDURE field_parameter_set_update_local_element_dp
949  MODULE PROCEDURE field_parameter_set_update_local_element_l
950  END INTERFACE field_parametersetupdatelocalelement
951 
953  INTERFACE field_parameter_set_update_node
954  MODULE PROCEDURE field_parameter_set_update_node_intg
955  MODULE PROCEDURE field_parameter_set_update_node_sp
956  MODULE PROCEDURE field_parameter_set_update_node_dp
957  MODULE PROCEDURE field_parameter_set_update_node_l
958  END INTERFACE field_parameter_set_update_node
959 
961  INTERFACE field_parametersetupdatenode
962  MODULE PROCEDURE field_parameter_set_update_node_intg
963  MODULE PROCEDURE field_parameter_set_update_node_sp
964  MODULE PROCEDURE field_parameter_set_update_node_dp
965  MODULE PROCEDURE field_parameter_set_update_node_l
966  END INTERFACE field_parametersetupdatenode
967 
969  INTERFACE field_parameter_set_update_local_node
970  MODULE PROCEDURE field_parameter_set_update_local_node_intg
971  MODULE PROCEDURE field_parameter_set_update_local_node_sp
972  MODULE PROCEDURE field_parameter_set_update_local_node_dp
973  MODULE PROCEDURE field_parameter_set_update_local_node_l
974  END INTERFACE field_parameter_set_update_local_node
975 
977  INTERFACE field_parametersetupdatelocalnode
978  MODULE PROCEDURE field_parameter_set_update_local_node_intg
979  MODULE PROCEDURE field_parameter_set_update_local_node_sp
980  MODULE PROCEDURE field_parameter_set_update_local_node_dp
981  MODULE PROCEDURE field_parameter_set_update_local_node_l
982  END INTERFACE field_parametersetupdatelocalnode
983 
985  INTERFACE field_parametersetupdategausspoint
986  MODULE PROCEDURE field_parametersetupdategausspointintg
987  MODULE PROCEDURE field_parametersetupdategausspointsp
988  MODULE PROCEDURE field_parametersetupdategausspointdp
989  MODULE PROCEDURE field_parametersetupdategausspointl
990  END INTERFACE field_parametersetupdategausspoint
991 
993  INTERFACE field_parameter_set_update_gauss_point
994  MODULE PROCEDURE field_parametersetupdategausspointintg
995  MODULE PROCEDURE field_parametersetupdategausspointsp
996  MODULE PROCEDURE field_parametersetupdategausspointdp
997  MODULE PROCEDURE field_parametersetupdategausspointl
998  END INTERFACE field_parameter_set_update_gauss_point
999 
1001  INTERFACE field_parametersetupdatelocalgausspoint
1002  MODULE PROCEDURE field_parametersetupdatelocalgausspointdp
1003  END INTERFACE field_parametersetupdatelocalgausspoint
1004 
1006  INTERFACE field_parametersetupdateelementdatapoint
1007  MODULE PROCEDURE field_parametersetupdateelementdatapointdp
1008  END INTERFACE field_parametersetupdateelementdatapoint
1009 
1011  INTERFACE field_parameter_set_interpolate_single_xi
1012  MODULE PROCEDURE field_parametersetinterpolatesinglexidp
1013  END INTERFACE field_parameter_set_interpolate_single_xi
1014 
1016  INTERFACE field_parametersetinterpolatesinglexi
1017  MODULE PROCEDURE field_parametersetinterpolatesinglexidp
1018  END INTERFACE field_parametersetinterpolatesinglexi
1019 
1021  INTERFACE field_parameter_set_interpolate_multiple_xi
1022  MODULE PROCEDURE field_parametersetinterpolatemultiplexidp
1023  END INTERFACE field_parameter_set_interpolate_multiple_xi
1024 
1026  INTERFACE field_parametersetinterpolatemultiplexi
1027  MODULE PROCEDURE field_parametersetinterpolatemultiplexidp
1028  END INTERFACE field_parametersetinterpolatemultiplexi
1029 
1031  INTERFACE field_parameter_set_interpolate_single_gauss
1032  MODULE PROCEDURE field_parametersetinterpolatesinglegaussdp
1033  END INTERFACE field_parameter_set_interpolate_single_gauss
1034 
1036  INTERFACE field_parametersetinterpolatesinglegauss
1037  MODULE PROCEDURE field_parametersetinterpolatesinglegaussdp
1038  END INTERFACE field_parametersetinterpolatesinglegauss
1039 
1041  INTERFACE field_parameter_set_interpolate_multiple_gauss
1042  MODULE PROCEDURE field_parametersetinterpolatemultiplegaussdp
1043  END INTERFACE field_parameter_set_interpolate_multiple_gauss
1044 
1046  INTERFACE field_parametersetinterpoaltemultiplegauss
1047  MODULE PROCEDURE field_parametersetinterpolatemultiplegaussdp
1048  END INTERFACE field_parametersetinterpoaltemultiplegauss
1049 
1050  INTERFACE field_parametersetvectorget
1051  MODULE PROCEDURE field_parameter_set_vector_get
1052  END INTERFACE field_parametersetvectorget
1053 
1054  INTERFACE field_physicalpointsfinalise
1055  MODULE PROCEDURE field_physical_points_finalise
1056  END INTERFACE field_physicalpointsfinalise
1057 
1058  INTERFACE field_physicalpointsinitialise
1059  MODULE PROCEDURE field_physical_points_initialise
1060  END INTERFACE field_physicalpointsinitialise
1061 
1062  INTERFACE field_regionget
1063  MODULE PROCEDURE field_region_get
1064  END INTERFACE field_regionget
1065 
1066  INTERFACE field_scalingtypecheck
1067  MODULE PROCEDURE field_scaling_type_check
1068  END INTERFACE field_scalingtypecheck
1069 
1070  INTERFACE field_scalingtypeget
1071  MODULE PROCEDURE field_scaling_type_get
1072  END INTERFACE field_scalingtypeget
1073 
1074  INTERFACE field_scalingtypeset
1075  MODULE PROCEDURE field_scaling_type_set
1076  END INTERFACE field_scalingtypeset
1077 
1078  INTERFACE field_scalingtypesetandlock
1079  MODULE PROCEDURE field_scaling_type_set_and_lock
1080  END INTERFACE field_scalingtypesetandlock
1081 
1082  INTERFACE field_typecheck
1083  MODULE PROCEDURE field_type_check
1084  END INTERFACE field_typecheck
1085 
1086  INTERFACE field_typeget
1087  MODULE PROCEDURE field_type_get
1088  END INTERFACE field_typeget
1089 
1090  INTERFACE field_typeset
1091  MODULE PROCEDURE field_type_set
1092  END INTERFACE field_typeset
1093 
1094  INTERFACE field_typesetandlock
1095  MODULE PROCEDURE field_type_set_and_lock
1096  END INTERFACE field_typesetandlock
1097 
1099  INTERFACE field_user_number_find
1100  MODULE PROCEDURE field_user_number_find_interface
1101  MODULE PROCEDURE field_user_number_find_region
1102  END INTERFACE field_user_number_find
1103 
1105  INTERFACE field_usernumberfind
1106  MODULE PROCEDURE field_user_number_find_interface
1107  MODULE PROCEDURE field_user_number_find_region
1108  END INTERFACE field_usernumberfind
1109 
1111  INTERFACE field_user_number_to_field
1112  MODULE PROCEDURE field_user_number_to_field_interface
1113  MODULE PROCEDURE field_user_number_to_field_region
1114  END INTERFACE field_user_number_to_field
1115 
1117  INTERFACE field_usernumbertofield
1118  MODULE PROCEDURE field_user_number_to_field_interface
1119  MODULE PROCEDURE field_user_number_to_field_region
1120  END INTERFACE field_usernumbertofield
1121 
1122  INTERFACE field_variableget
1123  MODULE PROCEDURE field_variable_get
1124  END INTERFACE field_variableget
1125 
1127  INTERFACE field_variable_label_get
1128  MODULE PROCEDURE field_variable_label_get_c
1129  MODULE PROCEDURE field_variable_label_get_vs
1130  END INTERFACE field_variable_label_get
1131 
1133  INTERFACE field_variablelabelget
1134  MODULE PROCEDURE field_variable_label_get_c
1135  MODULE PROCEDURE field_variable_label_get_vs
1136  END INTERFACE field_variablelabelget
1137 
1139  INTERFACE field_variable_label_set
1140  MODULE PROCEDURE field_variable_label_set_c
1141  MODULE PROCEDURE field_variable_label_set_vs
1142  END INTERFACE field_variable_label_set
1143 
1145  INTERFACE field_variablelabelset
1146  MODULE PROCEDURE field_variable_label_set_c
1147  MODULE PROCEDURE field_variable_label_set_vs
1148  END INTERFACE field_variablelabelset
1149 
1151  INTERFACE field_variable_label_set_and_lock
1152  MODULE PROCEDURE field_variable_label_set_and_lock_c
1153  MODULE PROCEDURE field_variable_label_set_and_lock_vs
1154  END INTERFACE field_variable_label_set_and_lock
1155 
1157  INTERFACE field_variablelabelsetandlock
1158  MODULE PROCEDURE field_variable_label_set_and_lock_c
1159  MODULE PROCEDURE field_variable_label_set_and_lock_vs
1160  END INTERFACE field_variablelabelsetandlock
1161 
1162  INTERFACE field_variabletypecheck
1163  MODULE PROCEDURE field_variable_type_check
1164  END INTERFACE field_variabletypecheck
1165 
1166  INTERFACE field_variabletypescheck
1167  MODULE PROCEDURE field_variable_types_check
1168  END INTERFACE field_variabletypescheck
1169 
1170  INTERFACE field_variabletypesget
1171  MODULE PROCEDURE field_variable_types_get
1172  END INTERFACE field_variabletypesget
1173 
1174  INTERFACE field_variabletypesset
1175  MODULE PROCEDURE field_variable_types_set
1176  END INTERFACE field_variabletypesset
1177 
1178  INTERFACE field_variabletypessetandlock
1179  MODULE PROCEDURE field_variable_types_set_and_lock
1180  END INTERFACE field_variabletypessetandlock
1181 
1183  INTERFACE fields_initialise
1184  MODULE PROCEDURE fields_initialise_interface
1185  MODULE PROCEDURE fields_initialise_region
1186  END INTERFACE fields_initialise
1187 
1188  PUBLIC field_independent_type,field_dependent_type
1189 
1190  PUBLIC field_scalar_dimension_type,field_vector_dimension_type,field_tensor_dimension_type
1191 
1192  PUBLIC field_geometric_type,field_fibre_type,field_general_type,field_material_type,field_geometric_general_type
1193 
1194  PUBLIC field_constant_interpolation,field_element_based_interpolation,field_node_based_interpolation, &
1195  & field_grid_point_based_interpolation,field_gauss_point_based_interpolation,field_data_point_based_interpolation
1196 
1197  PUBLIC field_constant_dof_type,field_element_dof_type,field_node_dof_type,field_grid_point_dof_type,field_gauss_point_dof_type, &
1198  & field_data_point_dof_type
1199 
1200  PUBLIC field_number_of_variable_types,field_number_of_variable_subtypes,field_number_of_set_types, &
1201  & field_u_variable_type,field_deludeln_variable_type,field_deludelt_variable_type, &
1202  & field_del2udelt2_variable_type,field_v_variable_type,field_delvdeln_variable_type,field_delvdelt_variable_type, &
1203  & field_del2vdelt2_variable_type,&
1204  & field_u1_variable_type,field_delu1deln_variable_type,field_delu1delt_variable_type,field_del2u1delt2_variable_type,&
1205  & field_u2_variable_type,field_delu2deln_variable_type,field_delu2delt_variable_type,field_del2u2delt2_variable_type,&
1206  & field_u3_variable_type,field_delu3deln_variable_type,field_delu3delt_variable_type,field_del2u3delt2_variable_type,&
1207  & field_u4_variable_type,field_delu4deln_variable_type,field_delu4delt_variable_type,field_del2u4delt2_variable_type,&
1208  & field_u5_variable_type,field_delu5deln_variable_type,field_delu5delt_variable_type,field_del2u5delt2_variable_type,&
1209  & field_u6_variable_type,field_delu6deln_variable_type,field_delu6delt_variable_type,field_del2u6delt2_variable_type,&
1210  & field_u7_variable_type,field_delu7deln_variable_type,field_delu7delt_variable_type,field_del2u7delt2_variable_type,&
1211  & field_u8_variable_type,field_delu8deln_variable_type,field_delu8delt_variable_type,field_del2u8delt2_variable_type,&
1212  & field_u9_variable_type,field_delu9deln_variable_type,field_delu9delt_variable_type,field_del2u9delt2_variable_type,&
1213  & field_u10_variable_type,field_delu10deln_variable_type,field_delu10delt_variable_type,field_del2u10delt2_variable_type
1214 
1215  PUBLIC field_intg_type,field_sp_type,field_dp_type,field_l_type
1216 
1217  PUBLIC field_separated_component_dof_order,field_contiguous_component_dof_order
1218 
1219  PUBLIC field_values_set_type,field_boundary_conditions_set_type,field_initial_values_set_type,field_incremental_values_set_type, &
1220  & field_analytic_values_set_type,field_previous_values_set_type,field_mean_predicted_displacement_set_type, &
1221  & field_velocity_values_set_type,field_initial_velocity_set_type,field_previous_velocity_set_type, &
1222  & field_mean_predicted_velocity_set_type,field_acceleration_values_set_type,field_initial_acceleration_set_type, &
1223  & field_previous_acceleration_set_type,field_mean_predicted_acceleration_set_type,field_predicted_displacement_set_type, &
1224  & field_predicted_velocity_set_type,field_predicted_acceleration_set_type,field_residual_set_type, &
1225  & field_previous_residual_set_type,field_mesh_displacement_set_type,field_mesh_velocity_set_type,field_boundary_set_type, &
1226  & field_input_data1_set_type, field_input_data2_set_type, field_input_data3_set_type, field_pressure_values_set_type, &
1227  & field_previous_pressure_set_type, field_relative_velocity_set_type, field_negative_mesh_velocity_set_type, &
1228  & field_previous_iteration_values_set_type, &
1229  & field_input_vel1_set_type,field_input_vel2_set_type,field_input_vel3_set_type,field_input_label_set_type, &
1230  & field_impermeable_flag_values_set_type,field_integrated_neumann_set_type,field_upwind_values_set_type, &
1231  & field_previous_upwind_values_set_type
1232 
1233  PUBLIC field_no_scaling,field_unit_scaling,field_arc_length_scaling,field_harmonic_mean_scaling,field_arithmetic_mean_scaling, &
1234  & field_geometric_mean_scaling
1235 
1236  PUBLIC field_all_components_type,field_geometric_components_type,field_nongeometric_components_type
1237 
1238  PUBLIC field_coordinate_system_get
1239 
1240  PUBLIC field_coordinatesystemget
1241 
1242  PUBLIC field_component_dof_get_constant,field_component_dof_get_user_element,field_component_dof_get_user_node, &
1243  & field_componentdofgetuserdatapoint
1244 
1245  PUBLIC field_component_interpolation_check,field_component_interpolation_get,field_component_interpolation_set, &
1246  & field_component_interpolation_set_and_lock
1247 
1248  PUBLIC field_componentinterpolationcheck,field_componentinterpolationget,field_componentinterpolationset, &
1249  & field_componentinterpolationsetandlock
1250 
1251  PUBLIC field_component_label_get,field_component_label_set,field_component_label_set_and_lock
1252 
1253  PUBLIC field_componentlabelget,field_componentlabelset,field_componentlabelsetandlock
1254 
1255  PUBLIC field_component_mesh_component_check,field_component_mesh_component_get,field_component_mesh_component_set, &
1256  & field_component_mesh_component_set_and_lock
1257 
1258  PUBLIC field_componentmeshcomponentcheck,field_componentmeshcomponentget,field_componentmeshcomponentset, &
1259  & field_componentmeshcomponentsetandlock
1260 
1261  PUBLIC field_component_values_initialise
1262 
1263  PUBLIC field_componentvaluesinitialise
1264 
1265  PUBLIC field_create_finish,field_create_start
1266 
1267  PUBLIC field_createfinish,field_createstart
1268 
1269  PUBLIC field_dataprojectionset
1270 
1271  PUBLIC field_data_type_check,field_data_type_get,field_data_type_set,field_data_type_set_and_lock
1272 
1273  PUBLIC field_datatypecheck,field_datatypeget,field_datatypeset,field_datatypesetandlock
1274 
1275  PUBLIC field_destroy
1276 
1277  PUBLIC field_geometricgeneralfieldget
1278 
1279  PUBLIC field_dependent_type_check,field_dependent_type_get,field_dependent_type_set,field_dependent_type_set_and_lock
1280 
1281  PUBLIC field_dependenttypecheck,field_dependenttypeget,field_dependenttypeset,field_dependenttypesetandlock
1282 
1283  PUBLIC field_dimension_check,field_dimension_get,field_dimension_set,field_dimension_set_and_lock
1284 
1285  PUBLIC field_dimensioncheck,field_dimensionget,field_dimensionset,field_dimensionsetandlock
1286 
1287  PUBLIC field_dof_order_type_check,field_dof_order_type_get,field_dof_order_type_set,field_dof_order_type_set_and_lock
1288 
1289  PUBLIC field_dofordertypecheck,field_dofordertypeget,field_dofordertypeset,field_dofordertypesetandlock
1290 
1291  PUBLIC field_geometric_field_get,field_geometric_field_set,field_geometric_field_set_and_lock
1292 
1293  PUBLIC field_geometricfieldget,field_geometricfieldset,field_geometricfieldsetandlock
1294 
1295  PUBLIC field_geometricparameterselementlinelengthget, field_geometricparameterselementvolumeget
1296 
1297  PUBLIC field_interpolate_gauss,field_interpolate_xi,field_interpolate_node,field_interpolate_field_node, &
1298  & field_interpolate_local_face_gauss
1299 
1300  PUBLIC field_interpolategauss,field_interpolatexi,field_interpolatenode,field_interpolatefieldnode,field_interpolatelocalfacegauss
1301 
1302  PUBLIC field_positionnormaltangentscalculateintptmetric,field_positionnormaltangentscalculatenode
1303 
1304  PUBLIC field_interpolated_point_metrics_calculate
1305 
1306  PUBLIC field_interpolatedpointmetricscalculate,field_interpolatedpointsmetricsfinalise,field_interpolatedpointsmetricsinitialise
1307 
1308  PUBLIC field_interpolated_points_finalise,field_interpolated_points_initialise
1309 
1310  PUBLIC field_interpolatedpointsfinalise,field_interpolatedpointsinitialise
1311 
1312  PUBLIC field_interpolation_parameters_element_get,field_interpolation_parameters_finalise, &
1313  & field_interpolation_parameters_initialise,field_interpolation_parameters_line_get, &
1314  & field_interpolation_parameters_face_get
1315 
1316  PUBLIC field_interpolationparametersfinalise,field_interpolationparametersinitialise
1317 
1318  PUBLIC field_interpolationparameterselementget,field_interpolationparametersfaceget,field_interpolationparameterslineget
1319 
1320  PUBLIC field_interpolationparametersscalefactorselementget,field_interpolationparametersscalefactorslineget, &
1321  & field_interpolationparametersscalefactorsfaceget
1322 
1323  PUBLIC field_label_get,field_label_set,field_label_set_and_lock
1324 
1325  PUBLIC field_mesh_decomposition_get,field_mesh_decomposition_set,field_mesh_decomposition_set_and_lock
1326 
1327  PUBLIC field_meshdecompositionget,field_meshdecompositionset,field_meshdecompositionsetandlock
1328 
1329  PUBLIC field_number_of_components_check,field_number_of_components_get,field_number_of_components_set, &
1330  & field_number_of_components_set_and_lock
1331 
1332  PUBLIC field_numberofcomponentscheck,field_numberofcomponentsget,field_numberofcomponentsset,field_numberofcomponentssetandlock
1333 
1334  PUBLIC field_number_of_variables_check,field_number_of_variables_get,field_number_of_variables_set, &
1335  & field_number_of_variables_set_and_lock
1336 
1337  PUBLIC field_numberofvariablescheck,field_numberofvariablesget,field_numberofvariablesset,field_numberofvariablessetandlock
1338 
1339  PUBLIC field_parameter_sets_add
1340 
1341  PUBLIC field_parametersetsadd
1342 
1343  PUBLIC field_parameter_sets_copy
1344 
1345  PUBLIC field_parametersetscopy
1346 
1347  PUBLIC field_parameter_set_destroy
1348 
1349  PUBLIC field_parametersetdestroy
1350 
1351  PUBLIC field_parameterstofieldparameterscopy
1352 
1353  PUBLIC field_parameter_set_get
1354 
1355  PUBLIC field_parametersetget
1356 
1357  PUBLIC field_parameter_set_add_constant,field_parameter_set_add_local_dof,field_parameter_set_add_element, &
1358  & field_parameter_set_add_local_element,field_parameter_set_add_node,field_parameter_set_add_local_node
1359 
1360  PUBLIC field_parametersetaddconstant,field_parametersetaddlocaldof,field_parametersetaddelement, &
1361  & field_parametersetaddlocalelement,field_parametersetaddnode,field_parametersetaddlocalnode
1362 
1363  PUBLIC field_parameter_set_create
1364 
1365  PUBLIC field_parametersetcreate
1366 
1367  PUBLIC field_parameter_set_created
1368 
1369  PUBLIC field_parametersetensurecreated,field_parametersetcreated
1370 
1371  PUBLIC field_parameter_set_data_get,field_parameter_set_data_restore
1372 
1373  PUBLIC field_parametersetdataget,field_parametersetdatarestore
1374 
1375  PUBLIC field_parameter_set_get_constant,field_parameter_set_get_element, &
1376  & field_parameter_set_get_local_dof,field_parameter_set_get_node, &
1377  & field_parameter_set_get_gauss_point
1378 
1379  PUBLIC field_parametersetgetconstant,field_parametersetgetdatapoint,field_parametersetgetelement, &
1380  & field_parametersetgetlocalelement,field_parametersetgetlocaldof,field_parametersetgetnode, &
1381  & field_parametersetgetlocalnode,field_parametersetgetgausspoint,field_parametersetgetlocalgausspoint
1382 
1383  PUBLIC field_parameter_set_output
1384 
1385  PUBLIC field_parametersetoutput
1386 
1387  PUBLIC field_parameter_set_update_finish,field_parameter_set_update_start
1388 
1389  PUBLIC field_parametersetupdatefinish,field_parametersetupdatestart
1390 
1391  PUBLIC field_parameter_set_update_constant,field_parameter_set_update_local_dof,field_parameter_set_update_local_dofs, &
1392  & field_parameter_set_update_element,field_parameter_set_update_local_element,field_parameter_set_update_node, &
1393  & field_parameter_set_update_local_node,field_parameter_set_update_gauss_point
1394 
1395  PUBLIC field_parametersetupdateconstant,field_parametersetupdatedatapoint,field_parametersetupdateelement, &
1396  & field_parametersetupdatelocalelement,field_parametersetupdateelementdatapoint,field_parametersetupdategausspoint, &
1397  & field_parametersetupdatelocalgausspoint,field_parametersetupdatelocaldof,field_parametersetupdatelocaldofs, &
1398  & field_parametersetupdatenode,field_parametersetupdatelocalnode
1399 
1400  PUBLIC field_parametersetnodescalefactorget,field_parametersetnodescalefactorset, &
1401  & field_parametersetnodescalefactorsget,field_parametersetnodescalefactorsset, &
1402  & field_parametersetnodenumberofscalefactordofsget
1403 
1404  PUBLIC field_parameter_set_interpolate_single_xi, field_parameter_set_interpolate_multiple_xi
1405 
1406  PUBLIC field_parametersetinterpolatesinglexi,field_parametersetinterpolatemultiplexi
1407 
1408  PUBLIC field_parameter_set_interpolate_single_gauss, field_parameter_set_interpolate_multiple_gauss
1409 
1410  PUBLIC field_parametersetinterpolatesinglegauss,field_parametersetinterpoaltemultiplegauss
1411 
1412  PUBLIC field_parameter_set_vector_get
1413 
1414  PUBLIC field_parametersetvectorget
1415 
1416  PUBLIC field_physical_points_finalise,field_physical_points_initialise
1417 
1418  PUBLIC field_physicalpointsfinalise,field_physicalpointsinitialise
1419 
1420  PUBLIC field_region_get
1421 
1422  PUBLIC field_regionget
1423 
1424  PUBLIC field_scaling_type_check,field_scaling_type_get,field_scaling_type_set,field_scaling_type_set_and_lock
1425 
1426  PUBLIC field_scalingtypecheck,field_scalingtypeget,field_scalingtypeset,field_scalingtypesetandlock
1427 
1428  PUBLIC field_type_check,field_type_get,field_type_set,field_type_set_and_lock
1429 
1430  PUBLIC field_typecheck,field_typeget,field_typeset,field_typesetandlock
1431 
1432  PUBLIC field_user_number_find, field_user_number_to_field
1433 
1434  PUBLIC field_usernumberfind,field_usernumbertofield
1435 
1436  PUBLIC field_variable_get
1437 
1438  PUBLIC field_variableget
1439 
1440  PUBLIC field_variable_label_get,field_variable_label_set,field_variable_label_set_and_lock
1441 
1442  PUBLIC field_variablelabelget,field_variablelabelset,field_variablelabelsetandlock
1443 
1444  PUBLIC field_variable_type_check
1445 
1446  PUBLIC field_variabletypecheck
1447 
1448  PUBLIC field_variable_types_check,field_variable_types_get,field_variable_types_set,field_variable_types_set_and_lock
1449 
1450  PUBLIC field_variabletypescheck,field_variabletypesget,field_variabletypesset,field_variabletypessetandlock
1451 
1452  PUBLIC fields_finalise,fields_initialise
1453 
1454  PUBLIC mesh_embedding_push_data, mesh_embedding_pull_gauss_point_data, field_parameter_set_get_gauss_point_coord
1455 
1456 CONTAINS
1457 
1458  !
1459  !================================================================================================================================
1460  !
1461 
1463  SUBROUTINE field_component_interpolation_check(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,INTERPOLATION_TYPE,ERR,ERROR,*)
1464 
1465  !Argument variables
1466  TYPE(field_type), POINTER :: field
1467  INTEGER(INTG), INTENT(IN) :: variable_type
1468  INTEGER(INTG), INTENT(IN) :: component_number
1469  INTEGER(INTG), INTENT(IN) :: interpolation_type
1470  INTEGER(INTG), INTENT(OUT) :: err
1471  TYPE(varying_string), INTENT(OUT) :: error
1472  !Local Variables
1473  TYPE(field_variable_type), POINTER :: field_variable
1474  TYPE(varying_string) :: local_error
1475 
1476  enters("FIELD_COMPONENT_INTERPOLATION_CHECK",err,error,*999)
1477 
1478  IF(ASSOCIATED(field)) THEN
1479  IF(field%FIELD_FINISHED) THEN
1480  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
1481  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
1482  IF(ASSOCIATED(field_variable)) THEN
1483  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
1484  SELECT CASE(interpolation_type)
1485  CASE(field_constant_interpolation)
1486  IF(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE/=field_constant_interpolation) THEN
1487  local_error="Invalid interpolation type. The interpolation type for component number "// &
1488  & trim(number_to_vstring(component_number,"*",err,error))// &
1489  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1490  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
1491  & trim(number_to_vstring(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
1492  & " which is not constant interpolation."
1493  CALL flagerror(local_error,err,error,*999)
1494  ENDIF
1495  CASE(field_element_based_interpolation)
1496  IF(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE/=field_element_based_interpolation) THEN
1497  local_error="Invalid interpolation type. The interpolation type for component number "// &
1498  & trim(number_to_vstring(component_number,"*",err,error))// &
1499  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1500  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
1501  & trim(number_to_vstring(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
1502  & " which is not element based interpolation."
1503  CALL flagerror(local_error,err,error,*999)
1504  ENDIF
1505  CASE(field_node_based_interpolation)
1506  IF(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE/=field_node_based_interpolation) THEN
1507  local_error="Invalid interpolation type. The interpolation type for component number "// &
1508  & trim(number_to_vstring(component_number,"*",err,error))// &
1509  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1510  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
1511  & trim(number_to_vstring(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
1512  & " which is not node based interpolation."
1513  CALL flagerror(local_error,err,error,*999)
1514  ENDIF
1515  CASE(field_grid_point_based_interpolation)
1516  IF(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE/=field_grid_point_based_interpolation) THEN
1517  local_error="Invalid interpolation type. The interpolation type for component number "// &
1518  & trim(number_to_vstring(component_number,"*",err,error))// &
1519  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1520  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
1521  & trim(number_to_vstring(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
1522  & " which is not grid point based interpolation."
1523  CALL flagerror(local_error,err,error,*999)
1524  ENDIF
1525  CASE(field_gauss_point_based_interpolation)
1526  IF(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE/=field_gauss_point_based_interpolation) THEN
1527  local_error="Invalid interpolation type. The interpolation type for component number "// &
1528  & trim(number_to_vstring(component_number,"*",err,error))// &
1529  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1530  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
1531  & trim(number_to_vstring(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
1532  & " which is not Gauss point based interpolation."
1533  CALL flagerror(local_error,err,error,*999)
1534  ENDIF
1535  CASE(field_data_point_based_interpolation)
1536  IF(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE/=field_data_point_based_interpolation) THEN
1537  local_error="Invalid interpolation type. The interpolation type for component number "// &
1538  & trim(number_to_vstring(component_number,"*",err,error))// &
1539  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1540  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
1541  & trim(number_to_vstring(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
1542  & " which is not data point based interpolation."
1543  CALL flagerror(local_error,err,error,*999)
1544  ENDIF
1545  CASE DEFAULT
1546  local_error="The specified interpolation type of "//trim(number_to_vstring(interpolation_type,"*",err,error))// &
1547  & " is invalid."
1548  CALL flagerror(local_error,err,error,*999)
1549  END SELECT
1550  ELSE
1551  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
1552  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1553  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
1554  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
1555  & " components."
1556  CALL flagerror(local_error,err,error,*999)
1557  ENDIF
1558  ELSE
1559  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
1560  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1561  CALL flagerror(local_error,err,error,*999)
1562  ENDIF
1563  ELSE
1564  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
1565  & " is invalid. The variable type must be between 1 and "// &
1566  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
1567  CALL flagerror(local_error,err,error,*999)
1568  ENDIF
1569  ELSE
1570  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
1571  & " has not been finished."
1572  CALL flagerror(local_error,err,error,*999)
1573  ENDIF
1574  ELSE
1575  CALL flagerror("Field is not associated.",err,error,*999)
1576  ENDIF
1577 
1578  exits("FIELD_COMPONENT_INTERPOLATION_CHECK")
1579  RETURN
1580 999 errorsexits("FIELD_COMPONENT_INTERPOLATION_CHECK",err,error)
1581  RETURN 1
1582  END SUBROUTINE field_component_interpolation_check
1583 
1584  !
1585  !================================================================================================================================
1586  !
1587 
1589  SUBROUTINE field_component_interpolation_get(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,INTERPOLATION_TYPE,ERR,ERROR,*)
1590 
1591  !Argument variables
1592  TYPE(field_type), POINTER :: field
1593  INTEGER(INTG), INTENT(IN) :: variable_type
1594  INTEGER(INTG), INTENT(IN) :: component_number
1595  INTEGER(INTG), INTENT(OUT) :: interpolation_type
1596  INTEGER(INTG), INTENT(OUT) :: err
1597  TYPE(varying_string), INTENT(OUT) :: error
1598  !Local Variables
1599  TYPE(field_variable_type), POINTER :: field_variable
1600  TYPE(varying_string) :: local_error
1601 
1602  enters("FIELD_COMPONENT_INTERPOLATION_GET",err,error,*999)
1603 
1604  IF(ASSOCIATED(field)) THEN
1605  IF(field%FIELD_FINISHED) THEN
1606  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
1607  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
1608  IF(ASSOCIATED(field_variable)) THEN
1609  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
1610  interpolation_type=field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE
1611  ELSE
1612  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
1613  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1614  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
1615  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
1616  & " components."
1617  CALL flagerror(local_error,err,error,*999)
1618  ENDIF
1619  ELSE
1620  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
1621  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1622  CALL flagerror(local_error,err,error,*999)
1623  ENDIF
1624  ELSE
1625  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
1626  & " is invalid. The variable type must be between 1 and "// &
1627  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
1628  CALL flagerror(local_error,err,error,*999)
1629  ENDIF
1630  ELSE
1631  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
1632  & " has not been finished."
1633  CALL flagerror(local_error,err,error,*999)
1634  ENDIF
1635  ELSE
1636  CALL flagerror("Field is not associated.",err,error,*999)
1637  ENDIF
1638 
1639  exits("FIELD_COMPONENT_INTERPOLATION_GET")
1640  RETURN
1641 999 errorsexits("FIELD_COMPONENT_INTERPOLATION_GET",err,error)
1642  RETURN 1
1643  END SUBROUTINE field_component_interpolation_get
1644 
1645  !
1646  !================================================================================================================================
1647  !
1648 
1650  SUBROUTINE field_component_interpolation_set(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,INTERPOLATION_TYPE,ERR,ERROR,*)
1651 
1652  !Argument variables
1653  TYPE(field_type), POINTER :: field
1654  INTEGER(INTG), INTENT(IN) :: variable_type
1655  INTEGER(INTG), INTENT(IN) :: component_number
1656  INTEGER(INTG), INTENT(IN) :: interpolation_type
1657  INTEGER(INTG), INTENT(OUT) :: err
1658  TYPE(varying_string), INTENT(OUT) :: error
1659  !Local Variables
1660  TYPE(varying_string) :: local_error
1661 
1662  enters("FIELD_COMPONENT_INTERPOLATION_SET",err,error,*999)
1663 
1664  IF(ASSOCIATED(field)) THEN
1665  IF(field%FIELD_FINISHED) THEN
1666  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
1667  CALL flagerror(local_error,err,error,*999)
1668  ELSE
1669  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
1670  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
1671  IF(any(field%CREATE_VALUES_CACHE%VARIABLE_TYPES==variable_type)) THEN
1672  IF(component_number>=1.AND.component_number<=field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)) THEN
1673  IF(field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED(component_number,variable_type)) THEN
1674  local_error="The interpolation type has been locked for component number "// &
1675  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
1676  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
1677  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
1678  CALL flagerror(local_error,err,error,*999)
1679  ELSE
1680  SELECT CASE(interpolation_type)
1681  CASE(field_constant_interpolation)
1682  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(component_number,variable_type)=interpolation_type
1683  CASE(field_element_based_interpolation)
1684  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(component_number,variable_type)=interpolation_type
1685  CASE(field_node_based_interpolation)
1686  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(component_number,variable_type)=interpolation_type
1687  CASE(field_grid_point_based_interpolation)
1688  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(component_number,variable_type)=interpolation_type
1689  CASE(field_gauss_point_based_interpolation)
1690  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(component_number,variable_type)=interpolation_type
1691  CASE(field_data_point_based_interpolation)
1692  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(component_number,variable_type)=interpolation_type
1693  CASE DEFAULT
1694  local_error="The specified interpolation type of "// &
1695  & trim(number_to_vstring(interpolation_type,"*",err,error))//" is invalid."
1696  CALL flagerror(local_error,err,error,*999)
1697  END SELECT
1698  ENDIF
1699  ELSE
1700  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
1701  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1702  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
1703  & trim(number_to_vstring(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type),"*",err,error))// &
1704  & " components."
1705  CALL flagerror(local_error,err,error,*999)
1706  ENDIF
1707  ELSE
1708  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
1709  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1710  CALL flagerror(local_error,err,error,*999)
1711  ENDIF
1712  ELSE
1713  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
1714  & " is invalid. The variable type must be between 1 and "// &
1715  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
1716  CALL flagerror(local_error,err,error,*999)
1717  ENDIF
1718  ELSE
1719  local_error="Field create values cache is not associated for field number "// &
1720  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1721  CALL flagerror(local_error,err,error,*999)
1722  ENDIF
1723  ENDIF
1724  ELSE
1725  CALL flagerror("Field is not associated.",err,error,*999)
1726  ENDIF
1727 
1728  exits("FIELD_COMPONENT_INTERPOLATION_SET")
1729  RETURN
1730 999 errorsexits("FIELD_COMPONENT_INTERPOLATION_SET",err,error)
1731  RETURN 1
1732  END SUBROUTINE field_component_interpolation_set
1733 
1734  !
1735  !================================================================================================================================
1736  !
1737 
1739  SUBROUTINE field_component_interpolation_set_and_lock(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,INTERPOLATION_TYPE,ERR,ERROR,*)
1740 
1741  !Argument variables
1742  TYPE(field_type), POINTER :: field
1743  INTEGER(INTG), INTENT(IN) :: variable_type
1744  INTEGER(INTG), INTENT(IN) :: component_number
1745  INTEGER(INTG), INTENT(IN) :: interpolation_type
1746  INTEGER(INTG), INTENT(OUT) :: err
1747  TYPE(varying_string), INTENT(OUT) :: error
1748  !Local Variables
1749  TYPE(varying_string) :: local_error
1750 
1751  enters("FIELD_COMPONENT_INTERPOLATION_SET_AND_LOCK",err,error,*999)
1752 
1753  CALL field_component_interpolation_set(field,variable_type,component_number,interpolation_type,err,error,*999)
1754  IF(ASSOCIATED(field)) THEN
1755  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
1756  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED(component_number,variable_type)=.true.
1757  ELSE
1758  local_error="Field create values cache is not associated for field number "// &
1759  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1760  CALL flagerror(local_error,err,error,*999)
1761  ENDIF
1762  ELSE
1763  CALL flagerror("Field is not associated.",err,error,*999)
1764  ENDIF
1765 
1766  exits("FIELD_COMPONENT_INTERPOLATION_SET_AND_LOCK")
1767  RETURN
1768 999 errorsexits("FIELD_COMPONENT_INTERPOLATION_SET_AND_LOCK",err,error)
1769  RETURN 1
1770  END SUBROUTINE field_component_interpolation_set_and_lock
1771 
1772  !
1773  !================================================================================================================================
1774  !
1775 
1777  SUBROUTINE field_component_dof_get_constant(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,LOCAL_DOF,GLOBAL_DOF,ERR,ERROR,*)
1778 
1779  !Argument variables
1780  TYPE(field_type), POINTER :: field
1781  INTEGER(INTG), INTENT(IN) :: variable_type
1782  INTEGER(INTG), INTENT(IN) :: component_number
1783  INTEGER(INTG), INTENT(OUT) :: local_dof
1784  INTEGER(INTG), INTENT(OUT) :: global_dof
1785  INTEGER(INTG), INTENT(OUT) :: err
1786  TYPE(varying_string), INTENT(OUT) :: error
1787  !Local Variables
1788  TYPE(field_variable_type), POINTER :: field_variable
1789  TYPE(varying_string) :: local_error
1790 
1791  enters("FIELD_COMPONENT_DOF_GET_CONSTANT",err,error,*999)
1792 
1793  IF(ASSOCIATED(field)) THEN
1794  IF(field%FIELD_FINISHED) THEN
1795  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
1796  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
1797  IF(ASSOCIATED(field_variable)) THEN
1798  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
1799  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
1800  CASE(field_constant_interpolation)
1801  IF(ASSOCIATED(field_variable%DOMAIN_MAPPING)) THEN
1802  local_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
1803  global_dof=field_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(local_dof)
1804  ELSE
1805  local_error="The field variable domain mapping is not associated for variable type "// &
1806  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
1807  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1808  CALL flagerror(local_error,err,error,*999)
1809  ENDIF
1810  CASE(field_element_based_interpolation)
1811  local_error="Can not get the dof by constant for component number "// &
1812  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
1813  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
1814  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
1815  CALL flagerror(local_error,err,error,*999)
1816  CASE(field_node_based_interpolation)
1817  local_error="Can not get the dof by constant for component number "// &
1818  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
1819  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
1820  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
1821  CALL flagerror(local_error,err,error,*999)
1822  CASE(field_grid_point_based_interpolation)
1823  local_error="Can not get the dof by constant for component number "// &
1824  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
1825  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
1826  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
1827  CALL flagerror(local_error,err,error,*999)
1828  CASE(field_gauss_point_based_interpolation)
1829  local_error="Can not get the dof by constant for component number "// &
1830  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
1831  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
1832  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
1833  CALL flagerror(local_error,err,error,*999)
1834  CASE(field_data_point_based_interpolation)
1835  local_error="Can not get the dof by constant for component number "// &
1836  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
1837  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
1838  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
1839  CALL flagerror(local_error,err,error,*999)
1840  CASE DEFAULT
1841  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
1842  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
1843  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
1844  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1845  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1846  CALL flagerror(local_error,err,error,*999)
1847  END SELECT
1848  ELSE
1849  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
1850  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
1851  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
1852  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
1853  & " components."
1854  CALL flagerror(local_error,err,error,*999)
1855  ENDIF
1856  ELSE
1857  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
1858  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1859  CALL flagerror(local_error,err,error,*999)
1860  ENDIF
1861  ELSE
1862  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
1863  & " is invalid. The variable type must be between 1 and "// &
1864  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
1865  CALL flagerror(local_error,err,error,*999)
1866  ENDIF
1867  ELSE
1868  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
1869  & " has not been finished."
1870  CALL flagerror(local_error,err,error,*999)
1871  ENDIF
1872  ELSE
1873  CALL flagerror("Field is not associated.",err,error,*999)
1874  ENDIF
1875 
1876  exits("FIELD_COMPONENT_DOF_GET_CONSTANT")
1877  RETURN
1878 999 errorsexits("FIELD_COMPONENT_DOF_GET_CONSTANT",err,error)
1879  RETURN 1
1880  END SUBROUTINE field_component_dof_get_constant
1881 
1882  !
1883  !================================================================================================================================
1884  !
1885 
1887  SUBROUTINE field_componentdofgetuserdatapoint(field,variableType,userDataPointNumber,componentNumber,localDof, &
1888  & globaldof,err,error,*)
1889 
1890  !Argument variables
1891  TYPE(field_type), POINTER :: field
1892  INTEGER(INTG), INTENT(IN) :: variabletype
1893  INTEGER(INTG), INTENT(IN) :: userdatapointnumber
1894  INTEGER(INTG), INTENT(IN) :: componentnumber
1895  INTEGER(INTG), INTENT(OUT) :: localdof
1896  INTEGER(INTG), INTENT(OUT) :: globaldof
1897  INTEGER(INTG), INTENT(OUT) :: err
1898  TYPE(varying_string), INTENT(OUT) :: error
1899  !Local Variables
1900  LOGICAL :: ghostdatapoint,userdatapointexists
1901  INTEGER(INTG) :: decompositionlocaldatapointnumber
1902  TYPE(decomposition_type), POINTER :: decomposition
1903  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
1904  TYPE(field_variable_type), POINTER :: fieldvariable
1905  TYPE(varying_string) :: localerror
1906 
1907  enters("Field_componentDofGetUserDataPoint",err,error,*999)
1908 
1909  IF(ASSOCIATED(field)) THEN
1910  IF(field%FIELD_FINISHED) THEN
1911  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
1912  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
1913  IF(ASSOCIATED(fieldvariable)) THEN
1914  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
1915  SELECT CASE(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE)
1916  CASE(field_constant_interpolation)
1917  localerror="Can not get the dof by user data point for component number "// &
1918  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
1919  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
1920  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
1921  CALL flag_error(localerror,err,error,*999)
1922  CASE(field_element_based_interpolation)
1923  localerror="Can not get the dof by user data point for component number "// &
1924  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
1925  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
1926  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
1927  CALL flagerror(localerror,err,error,*999)
1928  CASE(field_node_based_interpolation)
1929  localerror="Can not get the dof by user data point for component number "// &
1930  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
1931  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
1932  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
1933  CALL flagerror(localerror,err,error,*999)
1934  CASE(field_grid_point_based_interpolation)
1935  localerror="Can not get the dof by user data point for component number "// &
1936  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
1937  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
1938  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
1939  CALL flagerror(localerror,err,error,*999)
1940  CASE(field_gauss_point_based_interpolation)
1941  localerror="Can not get the dof by user data point for component number "// &
1942  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
1943  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
1944  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
1945  CALL flagerror(localerror,err,error,*999)
1946  CASE(field_data_point_based_interpolation)
1947  decomposition=>fieldvariable%COMPONENTS(componentnumber)%DOMAIN%DECOMPOSITION
1948  IF(ASSOCIATED(decomposition)) THEN
1949  decompositiontopology=>decomposition%TOPOLOGY
1950  userdatapointexists=.true.
1951  IF(ASSOCIATED(decompositiontopology)) THEN
1952  CALL decompositiontopology_datapointcheckexists(decompositiontopology,userdatapointnumber,userdatapointexists, &
1953  & decompositionlocaldatapointnumber,ghostdatapoint,err,error,*999)
1954  IF(userdatapointexists) THEN
1955  localdof=fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
1956  & data_point_param2dof_map%DATA_POINTS(decompositionlocaldatapointnumber)
1957  globaldof=fieldvariable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(localdof)
1958  ELSE
1959  localerror="The specified user data point number of "// &
1960  & trim(number_to_vstring(userdatapointnumber,"*",err,error))// &
1961  & " does not exist in the domain for field component number "// &
1962  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable "// &
1963  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
1964  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1965  CALL flagerror(localerror,err,error,*999)
1966  ENDIF
1967  ELSE
1968  CALL flagerror("Decomposition topology is not associated.",err,error,*999)
1969  ENDIF
1970  ELSE
1971  CALL flagerror("Decomposition is not associated.",err,error,*999)
1972  ENDIF
1973  CASE DEFAULT
1974  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
1975  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
1976  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
1977  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
1978  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1979  CALL flagerror(localerror,err,error,*999)
1980  END SELECT
1981  ELSE
1982  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
1983  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
1984  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
1985  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
1986  & " components."
1987  CALL flagerror(localerror,err,error,*999)
1988  ENDIF
1989  ELSE
1990  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
1991  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
1992  CALL flagerror(localerror,err,error,*999)
1993  ENDIF
1994  ELSE
1995  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
1996  & " is invalid. The variable type must be between 1 and "// &
1997  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
1998  CALL flagerror(localerror,err,error,*999)
1999  ENDIF
2000  ELSE
2001  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
2002  & " has not been finished."
2003  CALL flagerror(localerror,err,error,*999)
2004  ENDIF
2005  ELSE
2006  CALL flagerror("Field is not associated.",err,error,*999)
2007  ENDIF
2008 
2009  exits("Field_componentDofGetUserDataPoint")
2010  RETURN
2011 999 errorsexits("Field_componentDofGetUserDataPoint",err,error)
2012  RETURN 1
2013  END SUBROUTINE field_componentdofgetuserdatapoint
2014 
2015  !
2016  !================================================================================================================================
2017  !
2018 
2020  SUBROUTINE field_component_dof_get_user_element(FIELD,VARIABLE_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER,LOCAL_DOF, &
2021  & global_dof,err,error,*)
2022 
2023  !Argument variables
2024  TYPE(field_type), POINTER :: field
2025  INTEGER(INTG), INTENT(IN) :: variable_type
2026  INTEGER(INTG), INTENT(IN) :: user_element_number
2027  INTEGER(INTG), INTENT(IN) :: component_number
2028  INTEGER(INTG), INTENT(OUT) :: local_dof
2029  INTEGER(INTG), INTENT(OUT) :: global_dof
2030  INTEGER(INTG), INTENT(OUT) :: err
2031  TYPE(varying_string), INTENT(OUT) :: error
2032  !Local Variables
2033  INTEGER(INTG) :: decomposition_local_element_number
2034  LOGICAL :: ghost_element,user_element_exists
2035  TYPE(decomposition_type), POINTER :: decomposition
2036  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
2037  TYPE(field_variable_type), POINTER :: field_variable
2038  TYPE(varying_string) :: local_error
2039 
2040  enters("FIELD_COMPONENT_DOF_GET_USER_ELEMENT",err,error,*999)
2041 
2042  IF(ASSOCIATED(field)) THEN
2043  IF(field%FIELD_FINISHED) THEN
2044  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
2045  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
2046  IF(ASSOCIATED(field_variable)) THEN
2047  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
2048  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
2049  CASE(field_constant_interpolation)
2050  local_error="Can not get the dof by user element for component number "// &
2051  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2052  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2053  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
2054  CALL flagerror(local_error,err,error,*999)
2055  CASE(field_element_based_interpolation)
2056  decomposition=>field%DECOMPOSITION
2057  IF(ASSOCIATED(decomposition)) THEN
2058  decomposition_topology=>decomposition%TOPOLOGY
2059  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
2060  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
2061  IF(user_element_exists) THEN
2062  IF(ASSOCIATED(field_variable%DOMAIN_MAPPING)) THEN
2063  local_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
2064  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
2065  global_dof=field_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(local_dof)
2066  ELSE
2067  CALL flagerror("The field variable domain mapping is not associated.",err,error,*999)
2068  ENDIF
2069  ELSE
2070  local_error="The specified user element number of "// &
2071  & trim(number_to_vstring(user_element_number,"*",err,error))// &
2072  & " does not exist in the decomposition for field component number "// &
2073  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable "// &
2074  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2075  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2076  CALL flagerror(local_error,err,error,*999)
2077  ENDIF
2078  ELSE
2079  CALL flagerror("Field decomposition is not associated.",err,error,*999)
2080  ENDIF
2081  CASE(field_node_based_interpolation)
2082  local_error="Can not get the dof by user element for component number "// &
2083  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2084  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2085  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
2086  CALL flagerror(local_error,err,error,*999)
2087  CASE(field_grid_point_based_interpolation)
2088  local_error="Can not get the dof by user element for component number "// &
2089  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2090  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2091  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
2092  CALL flagerror(local_error,err,error,*999)
2093  CASE(field_gauss_point_based_interpolation)
2094  local_error="Can not get the dof by user element for component number "// &
2095  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2096  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2097  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
2098  CALL flagerror(local_error,err,error,*999)
2099  CASE(field_data_point_based_interpolation)
2100  local_error="Can not get the dof by user element for component number "// &
2101  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2102  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2103  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
2104  CALL flagerror(local_error,err,error,*999)
2105  CASE DEFAULT
2106  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
2107  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
2108  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2109  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2110  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2111  CALL flagerror(local_error,err,error,*999)
2112  END SELECT
2113  ELSE
2114  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2115  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2116  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
2117  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
2118  & " components."
2119  CALL flagerror(local_error,err,error,*999)
2120  ENDIF
2121  ELSE
2122  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2123  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2124  CALL flagerror(local_error,err,error,*999)
2125  ENDIF
2126  ELSE
2127  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2128  & " is invalid. The variable type must be between 1 and "// &
2129  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
2130  CALL flagerror(local_error,err,error,*999)
2131  ENDIF
2132  ELSE
2133  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
2134  & " has not been finished."
2135  CALL flagerror(local_error,err,error,*999)
2136  ENDIF
2137  ELSE
2138  CALL flagerror("Field is not associated.",err,error,*999)
2139  ENDIF
2140 
2141  exits("FIELD_COMPONENT_DOF_GET_USER_ELEMENT")
2142  RETURN
2143 999 errorsexits("FIELD_COMPONENT_DOF_GET_USER_ELEMENT",err,error)
2144  RETURN 1
2145  END SUBROUTINE field_component_dof_get_user_element
2146 
2147  !
2148  !================================================================================================================================
2149  !
2151  SUBROUTINE field_component_dof_get_user_node(FIELD,VARIABLE_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER,USER_NODE_NUMBER, &
2152  & component_number,local_dof,global_dof,err,error,*)
2153 
2154  !Argument variables
2155  TYPE(field_type), POINTER :: field
2156  INTEGER(INTG), INTENT(IN) :: variable_type
2157  INTEGER(INTG), INTENT(IN) :: version_number
2158  INTEGER(INTG), INTENT(IN) :: derivative_number
2159  INTEGER(INTG), INTENT(IN) :: user_node_number
2160  INTEGER(INTG), INTENT(IN) :: component_number
2161  INTEGER(INTG), INTENT(OUT) :: local_dof
2162  INTEGER(INTG), INTENT(OUT) :: global_dof
2163  INTEGER(INTG), INTENT(OUT) :: err
2164  TYPE(varying_string), INTENT(OUT) :: error
2165  !Local Variables
2166  INTEGER(INTG) :: domain_local_node_number
2167  LOGICAL :: ghost_node,user_node_exists
2168  TYPE(domain_type), POINTER :: domain
2169  TYPE(domain_topology_type), POINTER :: domain_topology
2170  TYPE(field_variable_type), POINTER :: field_variable
2171  TYPE(varying_string) :: local_error
2172 
2173  enters("FIELD_COMPONENT_DOF_GET_USER_NODE",err,error,*999)
2174 
2175  IF(ASSOCIATED(field)) THEN
2176  IF(field%FIELD_FINISHED) THEN
2177  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
2178  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
2179  IF(ASSOCIATED(field_variable)) THEN
2180  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
2181  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
2182  CASE(field_constant_interpolation)
2183  local_error="Can not get the dof by user node for component number "// &
2184  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2185  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2186  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
2187  CALL flagerror(local_error,err,error,*999)
2188  CASE(field_element_based_interpolation)
2189  local_error="Can not get the dof by user node for component number "// &
2190  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2191  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2192  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
2193  CALL flagerror(local_error,err,error,*999)
2194  CASE(field_node_based_interpolation)
2195  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
2196  IF(ASSOCIATED(domain)) THEN
2197  domain_topology=>domain%TOPOLOGY
2198  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
2199  & domain_local_node_number,ghost_node,err,error,*999)
2200  IF(user_node_exists) THEN
2201  IF(ASSOCIATED(field_variable%DOMAIN_MAPPING)) THEN
2202  IF(derivative_number>0.AND.derivative_number<=field_variable%COMPONENTS(component_number)% &
2203  & param_to_dof_map%NODE_PARAM2DOF_MAP%NODES(domain_local_node_number)%NUMBER_OF_DERIVATIVES) &
2204  & THEN
2205  local_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
2206  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
2207  & versions(version_number)
2208  global_dof=field_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(local_dof)
2209  ELSE
2210  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
2211  & " is invalid for user node number "// &
2212  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
2213  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2214  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2215  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
2216  & trim(number_to_vstring(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
2217  & node_param2dof_map%NODES(domain_local_node_number)%NUMBER_OF_DERIVATIVES, &
2218  & "*",err,error))//" derivatives."
2219  CALL flagerror(local_error,err,error,*999)
2220  ENDIF
2221  ELSE
2222  CALL flagerror("The field variable domain mapping is not associated.",err,error,*999)
2223  ENDIF
2224  ELSE
2225  local_error="The specified user node number of "// &
2226  & trim(number_to_vstring(user_node_number,"*",err,error))// &
2227  & " does not exist in the domain for field component number "// &
2228  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable "// &
2229  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2230  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2231  CALL flagerror(local_error,err,error,*999)
2232  ENDIF
2233  ELSE
2234  CALL flagerror("Field variable component domain is not associated.",err,error,*999)
2235  ENDIF
2236  CASE(field_grid_point_based_interpolation)
2237  local_error="Can not get the dof by user node for component number "// &
2238  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2239  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2240  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
2241  CALL flagerror(local_error,err,error,*999)
2242  CASE(field_gauss_point_based_interpolation)
2243  local_error="Can not get the dof by user node for component number "// &
2244  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2245  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2246  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
2247  CALL flagerror(local_error,err,error,*999)
2248  CASE(field_data_point_based_interpolation)
2249  local_error="Can not get the dof by user node for component number "// &
2250  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2251  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2252  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
2253  CALL flagerror(local_error,err,error,*999)
2254  CASE DEFAULT
2255  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
2256  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
2257  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2258  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2259  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2260  CALL flagerror(local_error,err,error,*999)
2261  END SELECT
2262  ELSE
2263  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2264  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2265  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
2266  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
2267  & " components."
2268  CALL flagerror(local_error,err,error,*999)
2269  ENDIF
2270  ELSE
2271  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2272  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2273  CALL flagerror(local_error,err,error,*999)
2274  ENDIF
2275  ELSE
2276  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2277  & " is invalid. The variable type must be between 1 and "// &
2278  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
2279  CALL flagerror(local_error,err,error,*999)
2280  ENDIF
2281  ELSE
2282  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
2283  & " has not been finished."
2284  CALL flagerror(local_error,err,error,*999)
2285  ENDIF
2286  ELSE
2287  CALL flagerror("Field is not associated.",err,error,*999)
2288  ENDIF
2289 
2290  exits("FIELD_COMPONENT_DOF_GET_USER_NODE")
2291  RETURN
2292 999 errorsexits("FIELD_COMPONENT_DOF_GET_USER_NODE",err,error)
2293  RETURN 1
2294  END SUBROUTINE field_component_dof_get_user_node
2295 
2296  !
2297  !================================================================================================================================
2298  !
2299 
2301  SUBROUTINE field_component_label_get_c(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,LABEL,ERR,ERROR,*)
2302 
2303  !Argument variables
2304  TYPE(field_type), POINTER :: field
2305  INTEGER(INTG), INTENT(IN) :: variable_type
2306  INTEGER(INTG), INTENT(IN) :: component_number
2307  CHARACTER(LEN=*), INTENT(OUT) :: label
2308  INTEGER(INTG), INTENT(OUT) :: err
2309  TYPE(varying_string), INTENT(OUT) :: error
2310  !Local Variables
2311  INTEGER(INTG) :: c_length,vs_length
2312  TYPE(field_variable_type), POINTER :: field_variable
2313  TYPE(varying_string) :: local_error
2314 
2315  enters("FIELD_COMPONENT_LABEL_GET_C",err,error,*999)
2316 
2317  IF(ASSOCIATED(field)) THEN
2318  IF(field%FIELD_FINISHED) THEN
2319  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
2320  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
2321  IF(ASSOCIATED(field_variable)) THEN
2322  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
2323  c_length=len(label)
2324  vs_length=len_trim(field_variable%COMPONENTS(component_number)%COMPONENT_LABEL)
2325  IF(c_length>vs_length) THEN
2326  label=char(len_trim(field_variable%COMPONENTS(component_number)%COMPONENT_LABEL))
2327  ELSE
2328  label=char(field_variable%COMPONENTS(component_number)%COMPONENT_LABEL,c_length)
2329  ENDIF
2330  ELSE
2331  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2332  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2333  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
2334  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
2335  & " components."
2336  CALL flagerror(local_error,err,error,*999)
2337  ENDIF
2338  ELSE
2339  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2340  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2341  CALL flagerror(local_error,err,error,*999)
2342  ENDIF
2343  ELSE
2344  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2345  & " is invalid. The variable type must be between 1 and "// &
2346  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
2347  CALL flagerror(local_error,err,error,*999)
2348  ENDIF
2349  ELSE
2350  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
2351  CALL flagerror(local_error,err,error,*999)
2352  ENDIF
2353  ELSE
2354  CALL flagerror("Field is not associated.",err,error,*999)
2355  ENDIF
2356 
2357  exits("FIELD_COMPONENT_LABEL_GET_C")
2358  RETURN
2359 999 errorsexits("FIELD_COMPONENT_LABEL_GET_C",err,error)
2360  RETURN 1
2361  END SUBROUTINE field_component_label_get_c
2362 
2363  !
2364  !================================================================================================================================
2365  !
2366 
2368  SUBROUTINE field_component_label_get_vs(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,LABEL,ERR,ERROR,*)
2369 
2370  !Argument variables
2371  TYPE(field_type), POINTER :: field
2372  INTEGER(INTG), INTENT(IN) :: variable_type
2373  INTEGER(INTG), INTENT(IN) :: component_number
2374  TYPE(varying_string), INTENT(OUT) :: label
2375  INTEGER(INTG), INTENT(OUT) :: err
2376  TYPE(varying_string), INTENT(OUT) :: error
2377  !Local Variables
2378  TYPE(field_variable_type), POINTER :: field_variable
2379  TYPE(varying_string) :: local_error
2380 
2381  enters("FIELD_COMPONENT_LABEL_GET_VS",err,error,*999)
2382 
2383  IF(ASSOCIATED(field)) THEN
2384  IF(field%FIELD_FINISHED) THEN
2385  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
2386  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
2387  IF(ASSOCIATED(field_variable)) THEN
2388  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
2389  label=field_variable%COMPONENTS(component_number)%COMPONENT_LABEL
2390  ELSE
2391  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2392  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2393  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
2394  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
2395  & " components."
2396  CALL flagerror(local_error,err,error,*999)
2397  ENDIF
2398  ELSE
2399  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2400  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2401  CALL flagerror(local_error,err,error,*999)
2402  ENDIF
2403  ELSE
2404  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2405  & " is invalid. The variable type must be between 1 and "// &
2406  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
2407  CALL flagerror(local_error,err,error,*999)
2408  ENDIF
2409  ELSE
2410  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
2411  CALL flagerror(local_error,err,error,*999)
2412  ENDIF
2413  ELSE
2414  CALL flagerror("Field is not associated.",err,error,*999)
2415  ENDIF
2416 
2417  exits("FIELD_COMPONENT_LABEL_GET_VS")
2418  RETURN
2419 999 errorsexits("FIELD_COMPONENT_LABEL_GET_VS",err,error)
2420  RETURN 1
2421  END SUBROUTINE field_component_label_get_vs
2422 
2423  !
2424  !================================================================================================================================
2425  !
2426 
2428  SUBROUTINE field_component_label_set_c(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,LABEL,ERR,ERROR,*)
2429 
2430  !Argument variables
2431  TYPE(field_type), POINTER :: field
2432  INTEGER(INTG), INTENT(IN) :: variable_type
2433  INTEGER(INTG), INTENT(IN) :: component_number
2434  CHARACTER(LEN=*), INTENT(IN) :: label
2435  INTEGER(INTG), INTENT(OUT) :: err
2436  TYPE(varying_string), INTENT(OUT) :: error
2437  !Local Variables
2438  TYPE(varying_string) :: local_error
2439 
2440  enters("FIELD_COMPONENT_LABEL_SET_C",err,error,*999)
2441 
2442  IF(ASSOCIATED(field)) THEN
2443  IF(field%FIELD_FINISHED) THEN
2444  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
2445  CALL flagerror(local_error,err,error,*999)
2446  ELSE
2447  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
2448  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
2449  IF(any(field%CREATE_VALUES_CACHE%VARIABLE_TYPES==variable_type)) THEN
2450  IF(component_number>=1.AND.component_number<=field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)) THEN
2451  IF(field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED(component_number,variable_type)) THEN
2452  local_error="The component label has been locked for component number "// &
2453  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2454  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2455  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
2456  CALL flagerror(local_error,err,error,*999)
2457  ELSE
2458  field%CREATE_VALUES_CACHE%COMPONENT_LABELS(component_number,variable_type)=label
2459  ENDIF
2460  ELSE
2461  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2462  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2463  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
2464  & trim(number_to_vstring(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type),"*",err,error))// &
2465  & " components."
2466  CALL flagerror(local_error,err,error,*999)
2467  ENDIF
2468  ELSE
2469  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2470  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2471  CALL flagerror(local_error,err,error,*999)
2472  ENDIF
2473  ELSE
2474  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2475  & " is invalid. The variable type must be between 1 and "// &
2476  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
2477  CALL flagerror(local_error,err,error,*999)
2478  ENDIF
2479  ELSE
2480  local_error="Field create values cache is not associated for field number "// &
2481  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2482  CALL flagerror(local_error,err,error,*999)
2483  ENDIF
2484  ENDIF
2485  ELSE
2486  CALL flagerror("Field is not associated.",err,error,*999)
2487  ENDIF
2488 
2489  exits("FIELD_COMPONENT_LABEL_SET_C")
2490  RETURN
2491 999 errorsexits("FIELD_COMPONENT_LABEL_SET_C",err,error)
2492  RETURN 1
2493  END SUBROUTINE field_component_label_set_c
2494 
2495  !
2496  !================================================================================================================================
2497  !
2498 
2500  SUBROUTINE field_component_label_set_vs(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,LABEL,ERR,ERROR,*)
2501 
2502  !Argument variables
2503  TYPE(field_type), POINTER :: field
2504  INTEGER(INTG), INTENT(IN) :: variable_type
2505  INTEGER(INTG), INTENT(IN) :: component_number
2506  TYPE(varying_string), INTENT(IN) :: label
2507  INTEGER(INTG), INTENT(OUT) :: err
2508  TYPE(varying_string), INTENT(OUT) :: error
2509  !Local Variables
2510  TYPE(varying_string) :: local_error
2511 
2512  enters("FIELD_VARIABLE_LABEL_SET_VS",err,error,*999)
2513 
2514  IF(ASSOCIATED(field)) THEN
2515  IF(field%FIELD_FINISHED) THEN
2516  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
2517  CALL flagerror(local_error,err,error,*999)
2518  ELSE
2519  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
2520  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
2521  IF(any(field%CREATE_VALUES_CACHE%VARIABLE_TYPES==variable_type)) THEN
2522  IF(component_number>=1.AND.component_number<=field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)) THEN
2523  IF(field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED(component_number,variable_type)) THEN
2524  local_error="The component label has been locked for component number "// &
2525  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2526  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2527  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
2528  CALL flagerror(local_error,err,error,*999)
2529  ELSE
2530  field%CREATE_VALUES_CACHE%COMPONENT_LABELS(component_number,variable_type)=label
2531  ENDIF
2532  ELSE
2533  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2534  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2535  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
2536  & trim(number_to_vstring(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type),"*",err,error))// &
2537  & " components."
2538  CALL flagerror(local_error,err,error,*999)
2539  ENDIF
2540  ELSE
2541  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2542  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2543  CALL flagerror(local_error,err,error,*999)
2544  ENDIF
2545  ELSE
2546  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2547  & " is invalid. The variable type must be between 1 and "// &
2548  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
2549  CALL flagerror(local_error,err,error,*999)
2550  ENDIF
2551  ELSE
2552  local_error="Field create values cache is not associated for field number "// &
2553  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2554  CALL flagerror(local_error,err,error,*999)
2555  ENDIF
2556  ENDIF
2557  ELSE
2558  CALL flagerror("Field is not associated.",err,error,*999)
2559  ENDIF
2560 
2561  exits("FIELD_COMPONENT_LABEL_SET_VS")
2562  RETURN
2563 999 errorsexits("FIELD_COMPONENT_LABEL_SET_VS",err,error)
2564  RETURN 1
2565  END SUBROUTINE field_component_label_set_vs
2566 
2567  !
2568  !================================================================================================================================
2569  !
2570 
2572  SUBROUTINE field_component_label_set_and_lock_c(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,LABEL,ERR,ERROR,*)
2573 
2574  !Argument variables
2575  TYPE(field_type), POINTER :: field
2576  INTEGER(INTG), INTENT(IN) :: variable_type
2577  INTEGER(INTG), INTENT(IN) :: component_number
2578  CHARACTER(LEN=*), INTENT(IN) :: label
2579  INTEGER(INTG), INTENT(OUT) :: err
2580  TYPE(varying_string), INTENT(OUT) :: error
2581  !Local Variables
2582  TYPE(varying_string) :: local_error
2583 
2584  enters("FIELD_COMPONENT_LABEL_SET_AND_LOCK_C",err,error,*999)
2585 
2586  CALL field_component_label_set(field,variable_type,component_number,label,err,error,*999)
2587  IF(ASSOCIATED(field)) THEN
2588  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
2589  field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED(component_number,variable_type)=.true.
2590  ELSE
2591  local_error="Field create values cache is not associated for field number "// &
2592  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2593  CALL flagerror(local_error,err,error,*999)
2594  ENDIF
2595  ELSE
2596  CALL flagerror("Field is not associated.",err,error,*999)
2597  ENDIF
2598 
2599  exits("FIELD_COMPONENT_LABEL_SET_AND_LOCK_C")
2600  RETURN
2601 999 errorsexits("FIELD_COMPONENT_LABEL_SET_AND_LOCK_C",err,error)
2602  RETURN 1
2603  END SUBROUTINE field_component_label_set_and_lock_c
2604 
2605  !
2606  !================================================================================================================================
2607  !
2608 
2610  SUBROUTINE field_component_label_set_and_lock_vs(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,LABEL,ERR,ERROR,*)
2611 
2612  !Argument variables
2613  TYPE(field_type), POINTER :: field
2614  INTEGER(INTG), INTENT(IN) :: variable_type
2615  INTEGER(INTG), INTENT(IN) :: component_number
2616  TYPE(varying_string), INTENT(IN) :: label
2617  INTEGER(INTG), INTENT(OUT) :: err
2618  TYPE(varying_string), INTENT(OUT) :: error
2619  !Local Variables
2620  TYPE(varying_string) :: local_error
2621 
2622  enters("FIELD_COMPONENT_LABEL_SET_AND_LOCK_VS",err,error,*999)
2623 
2624  CALL field_component_label_set(field,variable_type,component_number,label,err,error,*999)
2625  IF(ASSOCIATED(field)) THEN
2626  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
2627  field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED(component_number,variable_type)=.true.
2628  ELSE
2629  local_error="Field create values cache is not associated for field number "// &
2630  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2631  CALL flagerror(local_error,err,error,*999)
2632  ENDIF
2633  ELSE
2634  CALL flagerror("Field is not associated.",err,error,*999)
2635  ENDIF
2636 
2637  exits("FIELD_COMPONENT_LABEL_SET_AND_LOCK_VS")
2638  RETURN
2639 999 errorsexits("FIELD_COMPONENT_LABEL_SET_AND_LOCK_VS",err,error)
2640  RETURN 1
2641  END SUBROUTINE field_component_label_set_and_lock_vs
2642 
2643  !
2644  !================================================================================================================================
2645  !
2646 
2648  SUBROUTINE field_component_mesh_component_check(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,MESH_COMPONENT,ERR,ERROR,*)
2649 
2650  !Argument variables
2651  TYPE(field_type), POINTER :: field
2652  INTEGER(INTG), INTENT(IN) :: variable_type
2653  INTEGER(INTG), INTENT(IN) :: component_number
2654  INTEGER(INTG), INTENT(IN) :: mesh_component
2655  INTEGER(INTG), INTENT(OUT) :: err
2656  TYPE(varying_string), INTENT(OUT) :: error
2657  !Local Variables
2658  TYPE(field_variable_type), POINTER :: field_variable
2659  TYPE(varying_string) :: local_error
2660 
2661  enters("FIELD_COMPONENT_MESH_COMPONENT_CHECK",err,error,*999)
2662 
2663  IF(ASSOCIATED(field)) THEN
2664  IF(field%FIELD_FINISHED) THEN
2665  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
2666  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
2667  IF(ASSOCIATED(field_variable)) THEN
2668  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
2669  IF(field_variable%COMPONENTS(component_number)%MESH_COMPONENT_NUMBER/=mesh_component) THEN
2670  local_error="Invalid mesh component number. The mesh component number for component number "// &
2671  & trim(number_to_vstring(component_number,"*",err,error))// &
2672  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2673  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
2674  & trim(number_to_vstring(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
2675  & " which is does correspond to the specified mesh component number of "// &
2676  & trim(number_to_vstring(mesh_component,"*",err,error))//"."
2677  CALL flagerror(local_error,err,error,*999)
2678  ENDIF
2679  ELSE
2680  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2681  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2682  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
2683  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
2684  & " components."
2685  CALL flagerror(local_error,err,error,*999)
2686  ENDIF
2687  ELSE
2688  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2689  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2690  CALL flagerror(local_error,err,error,*999)
2691  ENDIF
2692  ELSE
2693  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2694  & " is invalid. The field variable type must be > 1 and <= "// &
2695  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
2696  CALL flagerror(local_error,err,error,*999)
2697  ENDIF
2698  ELSE
2699  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
2700  CALL flagerror(local_error,err,error,*999)
2701  ENDIF
2702  ELSE
2703  CALL flagerror("Field is not associated.",err,error,*999)
2704  ENDIF
2705 
2706  exits("FIELD_COMPONENT_MESH_COMPONENT_CHECK")
2707  RETURN
2708 999 errorsexits("FIELD_COMPONENT_MESH_COMPONENT_CHECK",err,error)
2709  RETURN 1
2710  END SUBROUTINE field_component_mesh_component_check
2711 
2712  !
2713  !================================================================================================================================
2714  !
2715 
2717  SUBROUTINE field_component_mesh_component_get(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,MESH_COMPONENT,ERR,ERROR,*)
2718 
2719  !Argument variables
2720  TYPE(field_type), POINTER :: field
2721  INTEGER(INTG), INTENT(IN) :: variable_type
2722  INTEGER(INTG), INTENT(IN) :: component_number
2723  INTEGER(INTG), INTENT(OUT) :: mesh_component
2724  INTEGER(INTG), INTENT(OUT) :: err
2725  TYPE(varying_string), INTENT(OUT) :: error
2726  !Local Variables
2727  TYPE(field_variable_type), POINTER :: field_variable
2728  TYPE(varying_string) :: local_error
2729 
2730  enters("FIELD_COMPONENT_MESH_COMPONENT_GET",err,error,*999)
2731 
2732  IF(ASSOCIATED(field)) THEN
2733  IF(field%FIELD_FINISHED) THEN
2734  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
2735  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
2736  IF(ASSOCIATED(field_variable)) THEN
2737  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
2738  mesh_component=field_variable%COMPONENTS(component_number)%MESH_COMPONENT_NUMBER
2739  ELSE
2740  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2741  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2742  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
2743  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
2744  & " components."
2745  CALL flagerror(local_error,err,error,*999)
2746  ENDIF
2747  ELSE
2748  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2749  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2750  CALL flagerror(local_error,err,error,*999)
2751  ENDIF
2752  ELSE
2753  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2754  & " is invalid. The field variable type must be > 1 and <= "// &
2755  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
2756  CALL flagerror(local_error,err,error,*999)
2757  ENDIF
2758  ELSE
2759  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
2760  CALL flagerror(local_error,err,error,*999)
2761  ENDIF
2762  ELSE
2763  CALL flagerror("Field is not associated.",err,error,*999)
2764  ENDIF
2765 
2766  exits("FIELD_COMPONENT_MESH_COMPONENT_GET")
2767  RETURN
2768 999 errorsexits("FIELD_COMPONENT_MESH_COMPONENT_GET",err,error)
2769  RETURN 1
2770  END SUBROUTINE field_component_mesh_component_get
2771 
2772  !
2773  !================================================================================================================================
2774  !
2775 
2777  SUBROUTINE field_component_mesh_component_set(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,MESH_COMPONENT_NUMBER,ERR,ERROR,*)
2778 
2779  !Argument variables
2780  TYPE(field_type), POINTER :: field
2781  INTEGER(INTG), INTENT(IN) :: variable_type
2782  INTEGER(INTG), INTENT(IN) :: component_number
2783  INTEGER(INTG), INTENT(IN) :: mesh_component_number
2784  INTEGER(INTG), INTENT(OUT) :: err
2785  TYPE(varying_string), INTENT(OUT) :: error
2786  !Local Variables
2787  TYPE(decomposition_type), POINTER :: decomposition
2788  TYPE(mesh_type), POINTER :: mesh
2789  TYPE(varying_string) :: local_error
2790 
2791  enters("FIELD_COMPONENT_MESH_COMPONENT_SET",err,error,*999)
2792 
2793  IF(ASSOCIATED(field)) THEN
2794  IF(field%FIELD_FINISHED) THEN
2795  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
2796  CALL flagerror(local_error,err,error,*999)
2797  ELSE
2798  decomposition=>field%DECOMPOSITION
2799  IF(ASSOCIATED(decomposition)) THEN
2800  mesh=>decomposition%MESH
2801  IF(ASSOCIATED(mesh)) THEN
2802  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
2803  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
2804  IF(any(field%CREATE_VALUES_CACHE%VARIABLE_TYPES==variable_type)) THEN
2805  IF(component_number>=1.AND.component_number<=field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)) THEN
2806  IF(field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED(component_number,variable_type)) THEN
2807  local_error="The mesh component has been locked for component number "// &
2808  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
2809  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
2810  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
2811  CALL flagerror(local_error,err,error,*999)
2812  ELSE
2813  SELECT CASE(field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(component_number,variable_type))
2814 ! Should set anyway in case user changes interpolation(?) Needed by finite elasticity / material field - Sander
2815 ! CASE(FIELD_CONSTANT_INTERPOLATION)
2816 ! LOCAL_ERROR="Can not set a mesh component for field component number "// &
2817 ! & TRIM(NUMBER_TO_VSTRING(COMPONENT_NUMBER,"*",ERR,ERROR))// &
2818 ! & " of variable type "//TRIM(NUMBER_TO_VSTRING(VARIABLE_TYPE,"*",ERR,ERROR))// &
2819 ! & " of field number "//TRIM(NUMBER_TO_VSTRING(FIELD%USER_NUMBER,"*",ERR,ERROR))// &
2820 ! & " which has constant interpolation."
2821 ! CALL FlagError(LOCAL_ERROR,ERR,ERROR,*999)
2822  CASE(field_element_based_interpolation,field_node_based_interpolation,field_grid_point_based_interpolation, &
2823  & field_gauss_point_based_interpolation, field_constant_interpolation,field_data_point_based_interpolation)
2824  IF(mesh_component_number>0.AND.mesh_component_number<=mesh%NUMBER_OF_COMPONENTS) THEN
2825  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(component_number,variable_type)=mesh_component_number
2826  ELSE
2827  local_error="Mesh component number "//trim(number_to_vstring(mesh_component_number,"*",err,error))// &
2828  & " is invalid. The component number must be between 1 and "// &
2829  & trim(number_to_vstring(mesh%NUMBER_OF_COMPONENTS,"*",err,error))// &
2830  & " for mesh number "//trim(number_to_vstring(mesh%USER_NUMBER,"*",err,error))//"."
2831  CALL flagerror(local_error,err,error,*999)
2832  ENDIF
2833  CASE DEFAULT
2834  local_error="The interpolation type "//trim(number_to_vstring(field%CREATE_VALUES_CACHE% &
2835  & interpolation_type(component_number,variable_type),"*",err,error))// &
2836  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2837  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2838  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2839  CALL flagerror(local_error,err,error,*999)
2840  END SELECT
2841  ENDIF
2842  ELSE
2843  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
2844  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
2845  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
2846  & trim(number_to_vstring(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type),"*",err,error))// &
2847  & " components."
2848  CALL flagerror(local_error,err,error,*999)
2849  ENDIF
2850  ELSE
2851  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2852  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2853  CALL flagerror(local_error,err,error,*999)
2854  ENDIF
2855  ELSE
2856  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
2857  & " is invalid. The field variable type must be > 1 and <= "// &
2858  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
2859  CALL flagerror(local_error,err,error,*999)
2860  ENDIF
2861  ELSE
2862  CALL flagerror("Field create values cache is not associated.",err,error,*999)
2863  ENDIF
2864  ELSE
2865  local_error="The decomposition mesh is not associated for field number "// &
2866  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2867  CALL flagerror(local_error,err,error,*999)
2868  ENDIF
2869  ELSE
2870  local_error="The decomposition is not associated for field number "// &
2871  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2872  CALL flagerror(local_error,err,error,*999)
2873  ENDIF
2874  ENDIF
2875  ELSE
2876  CALL flagerror("Field is not associated.",err,error,*999)
2877  ENDIF
2878 
2879  exits("FIELD_COMPONENT_MESH_COMPONENT_SET")
2880  RETURN
2881 999 errorsexits("FIELD_COMPONENT_MESH_COMPONENT_SET",err,error)
2882  RETURN 1
2883  END SUBROUTINE field_component_mesh_component_set
2884 
2885  !
2886  !================================================================================================================================
2887  !
2888 
2890  SUBROUTINE field_component_mesh_component_set_and_lock(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,MESH_COMPONENT_NUMBER,ERR,ERROR,*)
2891 
2892  !Argument variables
2893  TYPE(field_type), POINTER :: field
2894  INTEGER(INTG), INTENT(IN) :: variable_type
2895  INTEGER(INTG), INTENT(IN) :: component_number
2896  INTEGER(INTG), INTENT(IN) :: mesh_component_number
2897  INTEGER(INTG), INTENT(OUT) :: err
2898  TYPE(varying_string), INTENT(OUT) :: error
2899  !Local Variables
2900  TYPE(varying_string) :: local_error
2901 
2902  enters("FIELD_COMPONENT_MESH_COMPONENT_SET_AND_LOCK",err,error,*999)
2903 
2904  CALL field_component_mesh_component_set(field,variable_type,component_number,mesh_component_number,err,error,*999)
2905  IF(ASSOCIATED(field)) THEN
2906  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
2907  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED(component_number,variable_type)=.true.
2908  ELSE
2909  local_error="Field create values cache is not associated for field number "// &
2910  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
2911  CALL flagerror(local_error,err,error,*999)
2912  ENDIF
2913  ELSE
2914  CALL flagerror("Field is not associated.",err,error,*999)
2915  ENDIF
2916 
2917  RETURN
2918 999 errorsexits("FIELD_COMPONENT_MESH_COMPONENT_SET_AND_LOCK",err,error)
2919  RETURN 1
2920  END SUBROUTINE field_component_mesh_component_set_and_lock
2921 
2922  !
2923  !================================================================================================================================
2924  !
2925 
2927  SUBROUTINE field_component_values_initialise_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
2928 
2929  !Argument variables
2930  TYPE(field_type), POINTER :: field
2931  INTEGER(INTG), INTENT(IN) :: variable_type
2932  INTEGER(INTG), INTENT(IN) :: field_set_type
2933  INTEGER(INTG), INTENT(IN) :: component_number
2934  INTEGER(INTG), INTENT(IN) :: VALUE
2935  INTEGER(INTG), INTENT(OUT) :: err
2936  TYPE(varying_string), INTENT(OUT) :: error
2937  !Local Variables
2938  INTEGER(INTG) :: element_idx,derivative_idx,version_idx,field_dof,node_idx,partial_deriv_idx,gauss_point_idx,max_ngp
2939  INTEGER(INTG), POINTER :: field_parameters(:)
2940  TYPE(domain_type), POINTER :: component_domain
2941  TYPE(domain_topology_type), POINTER :: domain_topology
2942  TYPE(domain_elements_type), POINTER :: domain_elements
2943  TYPE(domain_nodes_type), POINTER :: domain_nodes
2944  TYPE(field_parameter_set_type), POINTER :: field_parameter_set
2945  TYPE(field_variable_type), POINTER :: field_variable
2946  TYPE(varying_string) :: local_error
2947 
2948  enters("FIELD_COMPONENT_VALUES_INITIALISE_INTG",err,error,*999)
2949 
2950  NULLIFY(field_parameters)
2951 
2952  IF(ASSOCIATED(field)) THEN
2953  IF(field%FIELD_FINISHED) THEN
2954  !Check the variable type
2955  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
2956  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
2957  IF(ASSOCIATED(field_variable)) THEN
2958  !Check the data type
2959  IF(field_variable%DATA_TYPE==field_intg_type) THEN
2960  !Check the component number
2961  IF(component_number>0.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
2962  !Check the from set type input
2963  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
2964  field_parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
2965  IF(ASSOCIATED(field_parameter_set)) THEN
2966  !Get the parameters values
2967  CALL distributed_vector_data_get(field_parameter_set%PARAMETERS,field_parameters,err,error,*999)
2968  !Set the field components to give a constant value. Note that as the value is constant we can set the ghost dofs
2969  !and not worry about updating the field parameter set.
2970  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
2971  CASE(field_constant_interpolation)
2972  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
2973  field_parameters(field_dof)=VALUE
2974  CASE(field_element_based_interpolation)
2975  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
2976  IF(ASSOCIATED(component_domain)) THEN
2977  domain_topology=>component_domain%TOPOLOGY
2978  IF(ASSOCIATED(domain_topology)) THEN
2979  domain_elements=>domain_topology%ELEMENTS
2980  IF(ASSOCIATED(domain_elements)) THEN
2981  DO element_idx=1,domain_elements%TOTAL_NUMBER_OF_ELEMENTS
2982  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
2983  & element_param2dof_map%ELEMENTS(element_idx)
2984  field_parameters(field_dof)=VALUE
2985  ENDDO !element_idx
2986  ELSE
2987  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
2988  ENDIF
2989  ELSE
2990  CALL flagerror("Domain topology is not associated.",err,error,*999)
2991  ENDIF
2992  ELSE
2993  CALL flagerror("Domain is not associated.",err,error,*999)
2994  ENDIF
2995  CASE(field_node_based_interpolation)
2996  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
2997  IF(ASSOCIATED(component_domain)) THEN
2998  domain_topology=>component_domain%TOPOLOGY
2999  IF(ASSOCIATED(domain_topology)) THEN
3000  domain_nodes=>domain_topology%NODES
3001  IF(ASSOCIATED(domain_nodes)) THEN
3002  DO node_idx=1,domain_nodes%TOTAL_NUMBER_OF_NODES
3003  DO derivative_idx=1,domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
3004  DO version_idx=1,domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
3005  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3006  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(derivative_idx)%VERSIONS(version_idx)
3007  partial_deriv_idx= &
3008  & domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%PARTIAL_DERIVATIVE_INDEX
3009  SELECT CASE(partial_deriv_idx)
3010  CASE(no_part_deriv)
3011  field_parameters(field_dof)=VALUE
3012  CASE(part_deriv_s1)
3013  field_parameters(field_dof)=1_intg
3014  CASE(part_deriv_s1_s1)
3015  field_parameters(field_dof)=0_intg
3016  CASE(part_deriv_s2)
3017  field_parameters(field_dof)=1_intg
3018  CASE(part_deriv_s2_s2)
3019  field_parameters(field_dof)=0_intg
3020  CASE(part_deriv_s1_s2)
3021  field_parameters(field_dof)=0_intg
3022  CASE(part_deriv_s3)
3023  field_parameters(field_dof)=1_intg
3024  CASE(part_deriv_s3_s3)
3025  field_parameters(field_dof)=0_intg
3026  CASE(part_deriv_s1_s3)
3027  field_parameters(field_dof)=0_intg
3028  CASE(part_deriv_s2_s3)
3029  field_parameters(field_dof)=0_intg
3030  CASE(part_deriv_s1_s2_s3)
3031  field_parameters(field_dof)=0_intg
3032  CASE DEFAULT
3033  local_error="The partial derivative index of "// &
3034  & trim(number_to_vstring(partial_deriv_idx,"*",err,error))//" for node number "// &
3035  & trim(number_to_vstring(node_idx,"*",err,error))//" and derivative number "// &
3036  & trim(number_to_vstring(derivative_idx,"*",err,error))//" is invalid."
3037  CALL flagerror(local_error,err,error,*999)
3038  END SELECT
3039  ENDDO !version_idx
3040  ENDDO !derivative_idx
3041  ENDDO !node_idx
3042  ELSE
3043  CALL flagerror("Domain topology nodes is not associated.",err,error,*999)
3044  ENDIF
3045  ELSE
3046  CALL flagerror("Domain topology is not associated.",err,error,*999)
3047  ENDIF
3048  ELSE
3049  CALL flagerror("Domain is not associated.",err,error,*999)
3050  ENDIF
3051  CASE(field_grid_point_based_interpolation)
3052  CALL flagerror("Not implemented.",err,error,*999)
3053  CASE(field_gauss_point_based_interpolation)
3054  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
3055  IF(ASSOCIATED(component_domain)) THEN
3056  domain_topology=>component_domain%TOPOLOGY
3057  IF(ASSOCIATED(domain_topology)) THEN
3058  domain_elements=>domain_topology%ELEMENTS
3059  IF(ASSOCIATED(domain_elements)) THEN
3060  !GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS(gauss_point_idx,element_idx)=variable_local_ny
3061  max_ngp=SIZE(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3062  & gauss_point_param2dof_map%GAUSS_POINTS,1)
3063  DO element_idx=1,domain_elements%TOTAL_NUMBER_OF_ELEMENTS
3064  DO gauss_point_idx=1,max_ngp ! could be just element's gauss_point_idx
3065  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3066  & gauss_point_param2dof_map%GAUSS_POINTS(gauss_point_idx,element_idx)
3067  field_parameters(field_dof)=VALUE
3068  ENDDO !gauss_point_idx
3069  ENDDO !element_idx
3070  ELSE
3071  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
3072  ENDIF
3073  ELSE
3074  CALL flagerror("Domain topology is not associated.",err,error,*999)
3075  ENDIF
3076  ELSE
3077  CALL flagerror("Domain is not associated.",err,error,*999)
3078  ENDIF
3079  CASE(field_data_point_based_interpolation)
3080  CALL flagerror("Not implemented.",err,error,*999)
3081  CASE DEFAULT
3082  local_error="The interpolation type of "//trim(number_to_vstring(field_variable% &
3083  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
3084  & " is invalid for component number "// &
3085  & trim(number_to_vstring(component_number,"*",err,error))// &
3086  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
3087  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3088  CALL flagerror(local_error,err,error,*999)
3089  END SELECT
3090  !Restore the parameter set
3091  CALL distributed_vector_data_restore(field_parameter_set%PARAMETERS,field_parameters,err,error,*999)
3092  ELSE
3093  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
3094  & " has not been created on variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
3095  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3096  CALL flagerror(local_error,err,error,*999)
3097  ENDIF
3098  ELSE
3099  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
3100  & " is invalid. The field parameter set type must be between 1 and "// &
3101  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
3102  CALL flagerror(local_error,err,error,*999)
3103  ENDIF
3104  ELSE
3105  local_error="The field variable component number of "// &
3106  & trim(number_to_vstring(component_number,"*",err,error))//" is invalid for a variable type of "//&
3107  & trim(number_to_vstring(variable_type,"*",err,error))//" on field number "// &
3108  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
3109  & ". The number of components must be between 1 and "// &
3110  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//"."
3111  CALL flagerror(local_error,err,error,*999)
3112  ENDIF
3113  ELSE
3114  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
3115  & " does not match the integer data type of the specified value."
3116  CALL flagerror(local_error,err,error,*999)
3117  ENDIF
3118  ELSE
3119  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3120  & " is not defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3121  CALL flagerror(local_error,err,error,*999)
3122  ENDIF
3123  ELSE
3124  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3125  & " is invalid. The field variable type must be between 1 and "// &
3126  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
3127  CALL flagerror(local_error,err,error,*999)
3128  ENDIF
3129  ELSE
3130 
3131  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
3132  CALL flagerror(local_error,err,error,*999)
3133  ENDIF
3134  ELSE
3135  CALL flagerror("Field is not associated.",err,error,*999)
3136  ENDIF
3137 
3138  exits("FIELD_COMPONENT_VALUES_INITIALISE_INTG")
3139  RETURN
3140 999 errorsexits("FIELD_COMPONENT_VALUES_INITIALISE_INTG",err,error)
3141  RETURN 1
3142  END SUBROUTINE field_component_values_initialise_intg
3143 
3144  !
3145  !================================================================================================================================
3146  !
3147 
3149  SUBROUTINE field_component_values_initialise_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
3150 
3151  !Argument variables
3152  TYPE(field_type), POINTER :: field
3153  INTEGER(INTG), INTENT(IN) :: variable_type
3154  INTEGER(INTG), INTENT(IN) :: field_set_type
3155  INTEGER(INTG), INTENT(IN) :: component_number
3156  REAL(SP), INTENT(IN) :: VALUE
3157  INTEGER(INTG), INTENT(OUT) :: err
3158  TYPE(varying_string), INTENT(OUT) :: error
3159  !Local Variables
3160  INTEGER(INTG) :: element_idx,derivative_idx,version_idx,field_dof,node_idx,partial_deriv_idx,gauss_point_idx,max_ngp
3161  REAL(SP), POINTER :: field_parameters(:)
3162  TYPE(domain_type), POINTER :: component_domain
3163  TYPE(domain_topology_type), POINTER :: domain_topology
3164  TYPE(domain_elements_type), POINTER :: domain_elements
3165  TYPE(domain_nodes_type), POINTER :: domain_nodes
3166  TYPE(field_parameter_set_type), POINTER :: field_parameter_set
3167  TYPE(field_variable_type), POINTER :: field_variable
3168  TYPE(varying_string) :: local_error
3169 
3170  enters("FIELD_COMPONENT_VALUES_INITIALISE_SP",err,error,*999)
3171 
3172  NULLIFY(field_parameters)
3173 
3174  IF(ASSOCIATED(field)) THEN
3175  IF(field%FIELD_FINISHED) THEN
3176  !Check the variable type
3177  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
3178  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
3179  IF(ASSOCIATED(field_variable)) THEN
3180  !Check the data type
3181  IF(field_variable%DATA_TYPE==field_sp_type) THEN
3182  !Check the component number
3183  IF(component_number>0.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
3184  !Check the from set type input
3185  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
3186  field_parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
3187  IF(ASSOCIATED(field_parameter_set)) THEN
3188  !Get the parameters values
3189  CALL distributed_vector_data_get(field_parameter_set%PARAMETERS,field_parameters,err,error,*999)
3190  !Set the field components to give a constant value. Note that as the value is constant we can set the ghost dofs
3191  !and not worry about updating the field parameter set.
3192  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
3193  CASE(field_constant_interpolation)
3194  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
3195  field_parameters(field_dof)=VALUE
3196  CASE(field_element_based_interpolation)
3197  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
3198  IF(ASSOCIATED(component_domain)) THEN
3199  domain_topology=>component_domain%TOPOLOGY
3200  IF(ASSOCIATED(domain_topology)) THEN
3201  domain_elements=>domain_topology%ELEMENTS
3202  IF(ASSOCIATED(domain_elements)) THEN
3203  DO element_idx=1,domain_elements%TOTAL_NUMBER_OF_ELEMENTS
3204  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3205  & element_param2dof_map%ELEMENTS(element_idx)
3206  field_parameters(field_dof)=VALUE
3207  ENDDO !element_idx
3208  ELSE
3209  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
3210  ENDIF
3211  ELSE
3212  CALL flagerror("Domain topology is not associated.",err,error,*999)
3213  ENDIF
3214  ELSE
3215  CALL flagerror("Domain is not associated.",err,error,*999)
3216  ENDIF
3217  CASE(field_node_based_interpolation)
3218  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
3219  IF(ASSOCIATED(component_domain)) THEN
3220  domain_topology=>component_domain%TOPOLOGY
3221  IF(ASSOCIATED(domain_topology)) THEN
3222  domain_nodes=>domain_topology%NODES
3223  IF(ASSOCIATED(domain_nodes)) THEN
3224  DO node_idx=1,domain_nodes%TOTAL_NUMBER_OF_NODES
3225  DO derivative_idx=1,domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
3226  DO version_idx=1,domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
3227  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3228  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(derivative_idx)%VERSIONS(version_idx)
3229  partial_deriv_idx= &
3230  & domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%PARTIAL_DERIVATIVE_INDEX
3231  SELECT CASE(partial_deriv_idx)
3232  CASE(no_part_deriv)
3233  field_parameters(field_dof)=VALUE
3234  CASE(part_deriv_s1)
3235  field_parameters(field_dof)=1.0_sp
3236  CASE(part_deriv_s1_s1)
3237  field_parameters(field_dof)=0.0_sp
3238  CASE(part_deriv_s2)
3239  field_parameters(field_dof)=1.0_sp
3240  CASE(part_deriv_s2_s2)
3241  field_parameters(field_dof)=0.0_sp
3242  CASE(part_deriv_s1_s2)
3243  field_parameters(field_dof)=0.0_sp
3244  CASE(part_deriv_s3)
3245  field_parameters(field_dof)=1.0_sp
3246  CASE(part_deriv_s3_s3)
3247  field_parameters(field_dof)=0.0_sp
3248  CASE(part_deriv_s1_s3)
3249  field_parameters(field_dof)=0.0_sp
3250  CASE(part_deriv_s2_s3)
3251  field_parameters(field_dof)=0.0_sp
3252  CASE(part_deriv_s1_s2_s3)
3253  field_parameters(field_dof)=0.0_sp
3254  CASE DEFAULT
3255  local_error="The partial derivative index of "// &
3256  & trim(number_to_vstring(partial_deriv_idx,"*",err,error))//" for node number "// &
3257  & trim(number_to_vstring(node_idx,"*",err,error))//" and derivative number "// &
3258  & trim(number_to_vstring(derivative_idx,"*",err,error))//" is invalid."
3259  CALL flagerror(local_error,err,error,*999)
3260  END SELECT
3261  ENDDO !version_idx
3262  ENDDO !derivative_idx
3263  ENDDO !node_idx
3264  ELSE
3265  CALL flagerror("Domain topology nodes is not associated.",err,error,*999)
3266  ENDIF
3267  ELSE
3268  CALL flagerror("Domain topology is not associated.",err,error,*999)
3269  ENDIF
3270  ELSE
3271  CALL flagerror("Domain is not associated.",err,error,*999)
3272  ENDIF
3273  CASE(field_grid_point_based_interpolation)
3274  CALL flagerror("Not implemented.",err,error,*999)
3275  CASE(field_gauss_point_based_interpolation)
3276  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
3277  IF(ASSOCIATED(component_domain)) THEN
3278  domain_topology=>component_domain%TOPOLOGY
3279  IF(ASSOCIATED(domain_topology)) THEN
3280  domain_elements=>domain_topology%ELEMENTS
3281  IF(ASSOCIATED(domain_elements)) THEN
3282  !GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS(gauss_point_idx,element_idx)=variable_local_ny
3283  max_ngp=SIZE(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3284  & gauss_point_param2dof_map%GAUSS_POINTS,1)
3285  DO element_idx=1,domain_elements%TOTAL_NUMBER_OF_ELEMENTS
3286  DO gauss_point_idx=1,max_ngp ! could be just element's gauss_point_idx
3287  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3288  & gauss_point_param2dof_map%GAUSS_POINTS(gauss_point_idx,element_idx)
3289  field_parameters(field_dof)=VALUE
3290  ENDDO !gauss_point_idx
3291  ENDDO !element_idx
3292  ELSE
3293  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
3294  ENDIF
3295  ELSE
3296  CALL flagerror("Domain topology is not associated.",err,error,*999)
3297  ENDIF
3298  ELSE
3299  CALL flagerror("Domain is not associated.",err,error,*999)
3300  ENDIF
3301  CASE DEFAULT
3302  local_error="The interpolation type of "//trim(number_to_vstring(field_variable% &
3303  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
3304  & " is invalid for component number "// &
3305  & trim(number_to_vstring(component_number,"*",err,error))// &
3306  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
3307  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3308  CALL flagerror(local_error,err,error,*999)
3309  END SELECT
3310  !Restore the parameter set
3311  CALL distributed_vector_data_restore(field_parameter_set%PARAMETERS,field_parameters,err,error,*999)
3312  ELSE
3313  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
3314  & " has not been created on variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
3315  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3316  CALL flagerror(local_error,err,error,*999)
3317  ENDIF
3318  ELSE
3319  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
3320  & " is invalid. The field parameter set type must be between 1 and "// &
3321  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
3322  CALL flagerror(local_error,err,error,*999)
3323  ENDIF
3324  ELSE
3325  local_error="The field variable component number of "// &
3326  & trim(number_to_vstring(component_number,"*",err,error))//" is invalid for a variable type of "//&
3327  & trim(number_to_vstring(variable_type,"*",err,error))//" on field number "// &
3328  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
3329  & ". The number of components must be between 1 and "// &
3330  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//"."
3331  CALL flagerror(local_error,err,error,*999)
3332  ENDIF
3333  ELSE
3334  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
3335  & " does not match the single precision data type of the specified value."
3336  CALL flagerror(local_error,err,error,*999)
3337  ENDIF
3338  ELSE
3339  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3340  & " is not defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3341  CALL flagerror(local_error,err,error,*999)
3342  ENDIF
3343  ELSE
3344  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3345  & " is invalid. The field variable type must be between 1 and "// &
3346  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
3347  CALL flagerror(local_error,err,error,*999)
3348  ENDIF
3349  ELSE
3350  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
3351  CALL flagerror(local_error,err,error,*999)
3352  ENDIF
3353  ELSE
3354  CALL flagerror("Field is not associated.",err,error,*999)
3355  ENDIF
3356 
3357  exits("FIELD_COMPONENT_VALUES_INITIALISE_SP")
3358  RETURN
3359 999 errorsexits("FIELD_COMPONENT_VALUES_INITIALISE_SP",err,error)
3360  RETURN 1
3361  END SUBROUTINE field_component_values_initialise_sp
3362 
3363  !
3364  !================================================================================================================================
3365  !
3366 
3368  SUBROUTINE field_component_values_initialise_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
3369 
3370  !Argument variables
3371  TYPE(field_type), POINTER :: field
3372  INTEGER(INTG), INTENT(IN) :: variable_type
3373  INTEGER(INTG), INTENT(IN) :: field_set_type
3374  INTEGER(INTG), INTENT(IN) :: component_number
3375  REAL(DP), INTENT(IN) :: VALUE
3376  INTEGER(INTG), INTENT(OUT) :: err
3377  TYPE(varying_string), INTENT(OUT) :: error
3378  !Local Variables
3379  INTEGER(INTG) :: elementidx,derivative_idx,version_idx,field_dof,node_idx,partial_deriv_idx,gauss_point_idx,max_ngp, &
3380  & dataPointIdx,localDataPointNumber
3381  REAL(DP), POINTER :: field_parameters(:)
3382  TYPE(domain_type), POINTER :: component_domain
3383  TYPE(domain_topology_type), POINTER :: domain_topology
3384  TYPE(domain_elements_type), POINTER :: domain_elements
3385  TYPE(domain_nodes_type), POINTER :: domain_nodes
3386  TYPE(decompositiondatapointstype), POINTER :: decompositiondata
3387  TYPE(field_parameter_set_type), POINTER :: field_parameter_set
3388  TYPE(field_variable_type), POINTER :: field_variable
3389  TYPE(varying_string) :: local_error
3390 
3391  enters("FIELD_COMPONENT_VALUES_INITIALISE_DP",err,error,*999)
3392 
3393  NULLIFY(field_parameters)
3394 
3395  IF(ASSOCIATED(field)) THEN
3396  IF(field%FIELD_FINISHED) THEN
3397  !Check the variable type
3398  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
3399  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
3400  IF(ASSOCIATED(field_variable)) THEN
3401  !Check the data type
3402  IF(field_variable%DATA_TYPE==field_dp_type) THEN
3403  !Check the component number
3404  IF(component_number>0.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
3405  !Check the from set type input
3406  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
3407  field_parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
3408  IF(ASSOCIATED(field_parameter_set)) THEN
3409  !Get the parameters values
3410  CALL distributed_vector_data_get(field_parameter_set%PARAMETERS,field_parameters,err,error,*999)
3411  !Set the field components to give a constant value. Note that as the value is constant we can set the ghost dofs
3412  !and not worry about updating the field parameter set.
3413  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
3414  CASE(field_constant_interpolation)
3415  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
3416  field_parameters(field_dof)=VALUE
3417  CASE(field_element_based_interpolation)
3418  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
3419  IF(ASSOCIATED(component_domain)) THEN
3420  domain_topology=>component_domain%TOPOLOGY
3421  IF(ASSOCIATED(domain_topology)) THEN
3422  domain_elements=>domain_topology%ELEMENTS
3423  IF(ASSOCIATED(domain_elements)) THEN
3424  DO elementidx=1,domain_elements%TOTAL_NUMBER_OF_ELEMENTS
3425  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3426  & element_param2dof_map%ELEMENTS(elementidx)
3427  field_parameters(field_dof)=VALUE
3428  ENDDO !elementIdx
3429  ELSE
3430  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
3431  ENDIF
3432  ELSE
3433  CALL flagerror("Domain topology is not associated.",err,error,*999)
3434  ENDIF
3435  ELSE
3436  CALL flagerror("Domain is not associated.",err,error,*999)
3437  ENDIF
3438  CASE(field_node_based_interpolation)
3439  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
3440  IF(ASSOCIATED(component_domain)) THEN
3441  domain_topology=>component_domain%TOPOLOGY
3442  IF(ASSOCIATED(domain_topology)) THEN
3443  domain_nodes=>domain_topology%NODES
3444  IF(ASSOCIATED(domain_nodes)) THEN
3445  DO node_idx=1,domain_nodes%TOTAL_NUMBER_OF_NODES
3446  DO derivative_idx=1,domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
3447  DO version_idx=1,domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
3448  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3449  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(derivative_idx)%VERSIONS(version_idx)
3450  partial_deriv_idx= &
3451  & domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%PARTIAL_DERIVATIVE_INDEX
3452  SELECT CASE(partial_deriv_idx)
3453  CASE(no_part_deriv)
3454  field_parameters(field_dof)=VALUE
3455  CASE(part_deriv_s1)
3456  field_parameters(field_dof)=1.0_dp
3457  CASE(part_deriv_s1_s1)
3458  field_parameters(field_dof)=0.0_dp
3459  CASE(part_deriv_s2)
3460  field_parameters(field_dof)=1.0_dp
3461  CASE(part_deriv_s2_s2)
3462  field_parameters(field_dof)=0.0_dp
3463  CASE(part_deriv_s1_s2)
3464  field_parameters(field_dof)=0.0_dp
3465  CASE(part_deriv_s3)
3466  field_parameters(field_dof)=1.0_dp
3467  CASE(part_deriv_s3_s3)
3468  field_parameters(field_dof)=0.0_dp
3469  CASE(part_deriv_s1_s3)
3470  field_parameters(field_dof)=0.0_dp
3471  CASE(part_deriv_s2_s3)
3472  field_parameters(field_dof)=0.0_dp
3473  CASE(part_deriv_s1_s2_s3)
3474  field_parameters(field_dof)=0.0_dp
3475  CASE DEFAULT
3476  local_error="The partial derivative index of "// &
3477  & trim(number_to_vstring(partial_deriv_idx,"*",err,error))//" for node number "// &
3478  & trim(number_to_vstring(node_idx,"*",err,error))//" and derivative number "// &
3479  & trim(number_to_vstring(derivative_idx,"*",err,error))//" is invalid."
3480  CALL flagerror(local_error,err,error,*999)
3481  END SELECT
3482  ENDDO !version_idx
3483  ENDDO !derivative_idx
3484  ENDDO !node_idx
3485  ELSE
3486  CALL flagerror("Domain topology nodes is not associated.",err,error,*999)
3487  ENDIF
3488  ELSE
3489  CALL flagerror("Domain topology is not associated.",err,error,*999)
3490  ENDIF
3491  ELSE
3492  CALL flagerror("Domain is not associated.",err,error,*999)
3493  ENDIF
3494  CASE(field_grid_point_based_interpolation)
3495  CALL flagerror("Not implemented.",err,error,*999)
3496  CASE(field_gauss_point_based_interpolation)
3497  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
3498  IF(ASSOCIATED(component_domain)) THEN
3499  domain_topology=>component_domain%TOPOLOGY
3500  IF(ASSOCIATED(domain_topology)) THEN
3501  domain_elements=>domain_topology%ELEMENTS
3502  IF(ASSOCIATED(domain_elements)) THEN
3503  !GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS(gauss_point_idx,elementIdx)=variable_local_ny
3504  max_ngp=SIZE(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3505  & gauss_point_param2dof_map%GAUSS_POINTS,1)
3506  DO elementidx=1,domain_elements%TOTAL_NUMBER_OF_ELEMENTS
3507  DO gauss_point_idx=1,max_ngp ! could be just element's gauss_point_idx
3508  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3509  & gauss_point_param2dof_map%GAUSS_POINTS(gauss_point_idx,elementidx)
3510  field_parameters(field_dof)=VALUE
3511  ENDDO !gauss_point_idx
3512  ENDDO !elementIdx
3513  ELSE
3514  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
3515  ENDIF
3516  ELSE
3517  CALL flagerror("Domain topology is not associated.",err,error,*999)
3518  ENDIF
3519  ELSE
3520  CALL flagerror("Domain is not associated.",err,error,*999)
3521  ENDIF
3522  CASE(field_data_point_based_interpolation)
3523  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
3524  IF(ASSOCIATED(component_domain)) THEN
3525  domain_topology=>component_domain%TOPOLOGY
3526  IF(ASSOCIATED(domain_topology)) THEN
3527  domain_elements=>domain_topology%ELEMENTS
3528  IF(ASSOCIATED(domain_elements)) THEN
3529  decompositiondata=>field_variable%COMPONENTS(component_number)%DOMAIN%DECOMPOSITION%TOPOLOGY%dataPoints
3530  IF(ASSOCIATED(decompositiondata)) THEN
3531  DO elementidx=1,domain_elements%TOTAL_NUMBER_OF_ELEMENTS
3532  DO datapointidx=1,decompositiondata%elementDataPoint(elementidx)%numberOfProjectedData
3533  localdatapointnumber=decompositiondata%elementDataPoint(elementidx)%dataIndices(datapointidx)% &
3534  & localnumber
3535  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3536  & data_point_param2dof_map%DATA_POINTS(localdatapointnumber)
3537  field_parameters(field_dof)=VALUE
3538  ENDDO !dataPointIdx
3539  ENDDO !elementIdx
3540  ELSE
3541  CALL flagerror("Decomposition data point topology is not associated.",err,error,*999)
3542  ENDIF
3543 
3544  ELSE
3545  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
3546  ENDIF
3547  ELSE
3548  CALL flagerror("Domain topology is not associated.",err,error,*999)
3549  ENDIF
3550  ELSE
3551  CALL flagerror("Domain is not associated.",err,error,*999)
3552  ENDIF
3553  CASE DEFAULT
3554  local_error="The interpolation type of "//trim(number_to_vstring(field_variable% &
3555  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
3556  & " is invalid for component number "// &
3557  & trim(number_to_vstring(component_number,"*",err,error))// &
3558  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
3559  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3560  CALL flagerror(local_error,err,error,*999)
3561  END SELECT
3562  !Restore the parameter set
3563  CALL distributed_vector_data_restore(field_parameter_set%PARAMETERS,field_parameters,err,error,*999)
3564  ELSE
3565  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
3566  & " has not been created on variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
3567  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3568  CALL flagerror(local_error,err,error,*999)
3569  ENDIF
3570  ELSE
3571  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
3572  & " is invalid. The field parameter set type must be between 1 and "// &
3573  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
3574  CALL flagerror(local_error,err,error,*999)
3575  ENDIF
3576  ELSE
3577  local_error="The field variable component number of "// &
3578  & trim(number_to_vstring(component_number,"*",err,error))//" is invalid for a variable type of "//&
3579  & trim(number_to_vstring(variable_type,"*",err,error))//" on field number "// &
3580  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
3581  & ". The number of components must be between 1 and "// &
3582  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//"."
3583  CALL flagerror(local_error,err,error,*999)
3584  ENDIF
3585  ELSE
3586  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
3587  & " does not match the double precision data type of the specified value."
3588  CALL flagerror(local_error,err,error,*999)
3589  ENDIF
3590  ELSE
3591  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3592  & " is not defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3593  CALL flagerror(local_error,err,error,*999)
3594  ENDIF
3595  ELSE
3596  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3597  & " is invalid. The field variable type must be between 1 and "// &
3598  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
3599  CALL flagerror(local_error,err,error,*999)
3600  ENDIF
3601  ELSE
3602  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
3603  CALL flagerror(local_error,err,error,*999)
3604  ENDIF
3605  ELSE
3606  CALL flagerror("Field is not associated.",err,error,*999)
3607  ENDIF
3608 
3609  exits("FIELD_COMPONENT_VALUES_INITIALISE_DP")
3610  RETURN
3611 999 errorsexits("FIELD_COMPONENT_VALUES_INITIALISE_DP",err,error)
3612  RETURN 1
3613  END SUBROUTINE field_component_values_initialise_dp
3614 
3615  !
3616  !================================================================================================================================
3617  !
3618 
3620  SUBROUTINE field_component_values_initialise_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
3621 
3622  !Argument variables
3623  TYPE(field_type), POINTER :: field
3624  INTEGER(INTG), INTENT(IN) :: variable_type
3625  INTEGER(INTG), INTENT(IN) :: field_set_type
3626  INTEGER(INTG), INTENT(IN) :: component_number
3627  LOGICAL, INTENT(IN) :: VALUE
3628  INTEGER(INTG), INTENT(OUT) :: err
3629  TYPE(varying_string), INTENT(OUT) :: error
3630  !Local Variables
3631  INTEGER(INTG) :: element_idx,derivative_idx,version_idx,field_dof,node_idx,partial_deriv_idx
3632  LOGICAL, POINTER :: field_parameters(:)
3633  TYPE(domain_type), POINTER :: component_domain
3634  TYPE(domain_topology_type), POINTER :: domain_topology
3635  TYPE(domain_elements_type), POINTER :: domain_elements
3636  TYPE(domain_nodes_type), POINTER :: domain_nodes
3637  TYPE(field_parameter_set_type), POINTER :: field_parameter_set
3638  TYPE(field_variable_type), POINTER :: field_variable
3639  TYPE(varying_string) :: local_error
3640 
3641  enters("FIELD_COMPONENT_VALUES_INITIALISE_L",err,error,*999)
3642 
3643  NULLIFY(field_parameters)
3644 
3645  IF(ASSOCIATED(field)) THEN
3646  IF(field%FIELD_FINISHED) THEN
3647  !Check the variable type
3648  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
3649  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
3650  IF(ASSOCIATED(field_variable)) THEN
3651  !Check the data type
3652  IF(field_variable%DATA_TYPE==field_l_type) THEN
3653  !Check the component number
3654  IF(component_number>0.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
3655  !Check the from set type input
3656  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
3657  field_parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
3658  IF(ASSOCIATED(field_parameter_set)) THEN
3659  !Get the parameters values
3660  CALL distributed_vector_data_get(field_parameter_set%PARAMETERS,field_parameters,err,error,*999)
3661  !Set the field components to give a constant value. Note that as the value is constant we can set the ghost dofs
3662  !and not worry about updating the field parameter set.
3663  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
3664  CASE(field_constant_interpolation)
3665  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
3666  field_parameters(field_dof)=VALUE
3667  CASE(field_element_based_interpolation)
3668  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
3669  IF(ASSOCIATED(component_domain)) THEN
3670  domain_topology=>component_domain%TOPOLOGY
3671  IF(ASSOCIATED(domain_topology)) THEN
3672  domain_elements=>domain_topology%ELEMENTS
3673  IF(ASSOCIATED(domain_elements)) THEN
3674  DO element_idx=1,domain_elements%TOTAL_NUMBER_OF_ELEMENTS
3675  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3676  & element_param2dof_map%ELEMENTS(element_idx)
3677  field_parameters(field_dof)=VALUE
3678  ENDDO !element_idx
3679  ELSE
3680  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
3681  ENDIF
3682  ELSE
3683  CALL flagerror("Domain topology is not associated.",err,error,*999)
3684  ENDIF
3685  ELSE
3686  CALL flagerror("Domain is not associated.",err,error,*999)
3687  ENDIF
3688  CASE(field_node_based_interpolation)
3689  component_domain=>field_variable%COMPONENTS(component_number)%DOMAIN
3690  IF(ASSOCIATED(component_domain)) THEN
3691  domain_topology=>component_domain%TOPOLOGY
3692  IF(ASSOCIATED(domain_topology)) THEN
3693  domain_nodes=>domain_topology%NODES
3694  IF(ASSOCIATED(domain_nodes)) THEN
3695  DO node_idx=1,domain_nodes%TOTAL_NUMBER_OF_NODES
3696  DO derivative_idx=1,domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
3697  DO version_idx=1,domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
3698  field_dof=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
3699  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(derivative_idx)%VERSIONS(version_idx)
3700  partial_deriv_idx= &
3701  & domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%PARTIAL_DERIVATIVE_INDEX
3702  SELECT CASE(partial_deriv_idx)
3703  CASE(no_part_deriv)
3704  field_parameters(field_dof)=VALUE
3705  CASE(part_deriv_s1)
3706  field_parameters(field_dof)=.true.
3707  CASE(part_deriv_s1_s1)
3708  field_parameters(field_dof)=.false.
3709  CASE(part_deriv_s2)
3710  field_parameters(field_dof)=.true.
3711  CASE(part_deriv_s2_s2)
3712  field_parameters(field_dof)=.false.
3713  CASE(part_deriv_s1_s2)
3714  field_parameters(field_dof)=.false.
3715  CASE(part_deriv_s3)
3716  field_parameters(field_dof)=.true.
3717  CASE(part_deriv_s3_s3)
3718  field_parameters(field_dof)=.false.
3719  CASE(part_deriv_s1_s3)
3720  field_parameters(field_dof)=.false.
3721  CASE(part_deriv_s2_s3)
3722  field_parameters(field_dof)=.false.
3723  CASE(part_deriv_s1_s2_s3)
3724  field_parameters(field_dof)=.false.
3725  CASE DEFAULT
3726  local_error="The partial derivative index of "// &
3727  & trim(number_to_vstring(partial_deriv_idx,"*",err,error))//" for node number "// &
3728  & trim(number_to_vstring(node_idx,"*",err,error))//" and derivative number "// &
3729  & trim(number_to_vstring(derivative_idx,"*",err,error))//" is invalid."
3730  CALL flagerror(local_error,err,error,*999)
3731  END SELECT
3732  ENDDO !version_idx
3733  ENDDO !derivative_idx
3734  ENDDO !node_idx
3735  ELSE
3736  CALL flagerror("Domain topology nodes is not associated.",err,error,*999)
3737  ENDIF
3738  ELSE
3739  CALL flagerror("Domain topology is not associated.",err,error,*999)
3740  ENDIF
3741  ELSE
3742  CALL flagerror("Domain is not associated.",err,error,*999)
3743  ENDIF
3744  CASE(field_grid_point_based_interpolation)
3745  CALL flagerror("Not implemented.",err,error,*999)
3746  CASE(field_gauss_point_based_interpolation)
3747  CALL flagerror("Not implemented.",err,error,*999)
3748  CASE(field_data_point_based_interpolation)
3749  CALL flagerror("Not implemented.",err,error,*999)
3750  CASE DEFAULT
3751  local_error="The interpolation type of "//trim(number_to_vstring(field_variable% &
3752  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
3753  & " is invalid for component number "// &
3754  & trim(number_to_vstring(component_number,"*",err,error))// &
3755  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
3756  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3757  CALL flagerror(local_error,err,error,*999)
3758  END SELECT
3759  !Restore the parameter set
3760  CALL distributed_vector_data_restore(field_parameter_set%PARAMETERS,field_parameters,err,error,*999)
3761  ELSE
3762  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
3763  & " has not been created on variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
3764  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3765  CALL flagerror(local_error,err,error,*999)
3766  ENDIF
3767  ELSE
3768  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
3769  & " is invalid. The field parameter set type must be between 1 and "// &
3770  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
3771  CALL flagerror(local_error,err,error,*999)
3772  ENDIF
3773  ELSE
3774  local_error="The field variable component number of "// &
3775  & trim(number_to_vstring(component_number,"*",err,error))//" is invalid for a variable type of "//&
3776  & trim(number_to_vstring(variable_type,"*",err,error))//" on field number "// &
3777  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
3778  & ". The number of components must be between 1 and "// &
3779  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//"."
3780  CALL flagerror(local_error,err,error,*999)
3781  ENDIF
3782  ELSE
3783  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
3784  & " does not match the logical data type of the specified value."
3785  CALL flagerror(local_error,err,error,*999)
3786  ENDIF
3787  ELSE
3788  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3789  & " is not defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3790  CALL flagerror(local_error,err,error,*999)
3791  ENDIF
3792  ELSE
3793  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3794  & " is invalid. The field variable type must be between 1 and "// &
3795  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
3796  CALL flagerror(local_error,err,error,*999)
3797  ENDIF
3798  ELSE
3799  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
3800  CALL flagerror(local_error,err,error,*999)
3801  ENDIF
3802  ELSE
3803  CALL flagerror("Field is not associated.",err,error,*999)
3804  ENDIF
3805 
3806  exits("FIELD_COMPONENT_VALUES_INITIALISE_L")
3807  RETURN
3808 999 errorsexits("FIELD_COMPONENT_VALUES_INITIALISE_L",err,error)
3809  RETURN 1
3810  END SUBROUTINE field_component_values_initialise_l
3811 
3812  !
3813  !================================================================================================================================
3814  !
3815 
3817  SUBROUTINE field_coordinate_system_get(FIELD,COORDINATE_SYSTEM,ERR,ERROR,*)
3818 
3819  !Argument variables
3820  TYPE(field_type), POINTER :: field
3821  TYPE(coordinate_system_type), POINTER :: coordinate_system
3822  INTEGER(INTG), INTENT(OUT) :: err
3823  TYPE(varying_string), INTENT(OUT) :: error
3824  !Local Variables
3825  TYPE(interface_type), POINTER :: interface
3826  TYPE(region_type), POINTER :: region
3827  TYPE(varying_string) :: local_error
3828 
3829  enters("FIELD_COORDINATE_SYSTEM_GET",err,error,*999)
3830 
3831  IF(ASSOCIATED(field)) THEN
3832  IF(ASSOCIATED(coordinate_system)) THEN
3833  CALL flagerror("Coordinate system is already associated.",err,error,*999)
3834  ELSE
3835  NULLIFY(coordinate_system)
3836  NULLIFY(interface)
3837  region=>field%REGION
3838  IF(ASSOCIATED(region)) THEN
3839  coordinate_system=>region%COORDINATE_SYSTEM
3840  IF(.NOT.ASSOCIATED(coordinate_system)) THEN
3841  local_error="The coordinate system is not associated for field number "// &
3842  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" of region number "// &
3843  & trim(number_to_vstring(region%USER_NUMBER,"*",err,error))//"."
3844  CALL flagerror(local_error,err,error,*999)
3845  ENDIF
3846  ELSE
3847  interface=>field%INTERFACE
3848  IF(ASSOCIATED(interface)) THEN
3849  coordinate_system=>interface%COORDINATE_SYSTEM
3850  IF(.NOT.ASSOCIATED(coordinate_system)) THEN
3851  local_error="The coordinate system is not associated for field number "// &
3852  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" of interface number "// &
3853  & trim(number_to_vstring(interface%USER_NUMBER,"*",err,error))//"."
3854  CALL flagerror(local_error,err,error,*999)
3855  ENDIF
3856  ELSE
3857  local_error="The region or interface is not associated for field number "// &
3858  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3859  CALL flagerror(local_error,err,error,*999)
3860  ENDIF
3861  ENDIF
3862  ENDIF
3863  ELSE
3864  CALL flagerror("Field is not associated.",err,error,*999)
3865  ENDIF
3866 
3867  exits("FIELD_COORDINATE_SYSTEM_GET")
3868  RETURN
3869 999 errorsexits("FIELD_COORDINATE_SYSTEM_GET",err,error)
3870  RETURN 1
3871  END SUBROUTINE field_coordinate_system_get
3872 
3873  !
3874  !================================================================================================================================
3875  !
3876 
3878  SUBROUTINE field_data_type_check(FIELD,VARIABLE_TYPE,DATA_TYPE,ERR,ERROR,*)
3879 
3880  !Argument variables
3881  TYPE(field_type), POINTER :: field
3882  INTEGER(INTG), INTENT(IN) :: variable_type
3883  INTEGER(INTG), INTENT(IN) :: data_type
3884  INTEGER(INTG), INTENT(OUT) :: err
3885  TYPE(varying_string), INTENT(OUT) :: error
3886  !Local Variables
3887  TYPE(field_variable_type), POINTER :: field_variable
3888  TYPE(varying_string) :: local_error
3889 
3890  enters("FIELD_DATA_TYPE_CHECK",err,error,*999)
3891 
3892  IF(ASSOCIATED(field)) THEN
3893  IF(field%FIELD_FINISHED) THEN
3894  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
3895  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
3896  IF(ASSOCIATED(field_variable)) THEN
3897  SELECT CASE(data_type)
3898  CASE(field_intg_type)
3899  IF(field_variable%DATA_TYPE/=field_intg_type) THEN
3900  local_error="Invalid data type. The data type for variable type "// &
3901  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
3902  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
3903  & trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
3904  & " which is not an integer data type."
3905  CALL flagerror(local_error,err,error,*999)
3906  ENDIF
3907  CASE(field_sp_type)
3908  IF(field_variable%DATA_TYPE/=field_sp_type) THEN
3909  local_error="Invalid data type. The data type for variable type "// &
3910  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
3911  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
3912  & trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
3913  & " which is not a single precision data type."
3914  CALL flagerror(local_error,err,error,*999)
3915 
3916 
3917 
3918 
3919  ENDIF
3920  CASE(field_dp_type)
3921  IF(field_variable%DATA_TYPE/=field_dp_type) THEN
3922  local_error="Invalid data type. The data type for variable type "// &
3923  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
3924  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
3925  & trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
3926  & " which is not a double precision data type."
3927  CALL flagerror(local_error,err,error,*999)
3928  ENDIF
3929  CASE(field_l_type)
3930  IF(field_variable%DATA_TYPE/=field_l_type) THEN
3931  local_error="Invalid data type. The data type for variable type "// &
3932  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
3933  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
3934  & trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
3935  & " which is not a logical data type."
3936  CALL flagerror(local_error,err,error,*999)
3937  ENDIF
3938  CASE DEFAULT
3939  local_error="The specified data type of "//trim(number_to_vstring(data_type,"*",err,error))// &
3940  & " is invalid."
3941  CALL flagerror(local_error,err,error,*999)
3942  END SELECT
3943  ELSE
3944  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3945  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3946  CALL flagerror(local_error,err,error,*999)
3947  ENDIF
3948  ELSE
3949  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3950  & " is invalid. The variable type must be between 1 and "// &
3951  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
3952  CALL flagerror(local_error,err,error,*999)
3953  ENDIF
3954  ELSE
3955  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
3956  & " has not been finished."
3957  CALL flagerror(local_error,err,error,*999)
3958  ENDIF
3959  ELSE
3960  CALL flagerror("Field is not associated.",err,error,*999)
3961  ENDIF
3962 
3963  exits("FIELD_DATA_TYPE_CHECK")
3964  RETURN
3965 999 errorsexits("FIELD_DATA_TYPE_CHECK",err,error)
3966  RETURN 1
3967  END SUBROUTINE field_data_type_check
3968 
3969  !
3970  !================================================================================================================================
3971  !
3972 
3974  SUBROUTINE field_data_type_get(FIELD,VARIABLE_TYPE,DATA_TYPE,ERR,ERROR,*)
3975 
3976  !Argument variables
3977  TYPE(field_type), POINTER :: field
3978  INTEGER(INTG), INTENT(IN) :: variable_type
3979  INTEGER(INTG), INTENT(OUT) :: data_type
3980  INTEGER(INTG), INTENT(OUT) :: err
3981  TYPE(varying_string), INTENT(OUT) :: error
3982  !Local Variables
3983  TYPE(field_variable_type), POINTER :: field_variable
3984  TYPE(varying_string) :: local_error
3985 
3986  enters("FIELD_DATA_TYPE_GET",err,error,*999)
3987 
3988  IF(ASSOCIATED(field)) THEN
3989  IF(field%FIELD_FINISHED) THEN
3990  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
3991  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
3992  IF(ASSOCIATED(field_variable)) THEN
3993  data_type=field_variable%DATA_TYPE
3994  ELSE
3995  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
3996  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
3997  CALL flagerror(local_error,err,error,*999)
3998  ENDIF
3999  ELSE
4000  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4001  & " is invalid. The variable type must be between 1 and "// &
4002  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
4003  CALL flagerror(local_error,err,error,*999)
4004  ENDIF
4005  ELSE
4006  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
4007  & " has not been finished."
4008  CALL flagerror(local_error,err,error,*999)
4009  ENDIF
4010  ELSE
4011  CALL flagerror("Field is not associated.",err,error,*999)
4012  ENDIF
4013 
4014  exits("FIELD_DATA_TYPE_GET")
4015  RETURN
4016 999 errorsexits("FIELD_DATA_TYPE_GET",err,error)
4017  RETURN 1
4018  END SUBROUTINE field_data_type_get
4019 
4020  !
4021  !================================================================================================================================
4022  !
4023 
4025  SUBROUTINE field_data_type_set(FIELD,VARIABLE_TYPE,DATA_TYPE,ERR,ERROR,*)
4026 
4027  !Argument variables
4028  TYPE(field_type), POINTER :: field
4029  INTEGER(INTG), INTENT(IN) :: variable_type
4030  INTEGER(INTG), INTENT(IN) :: data_type
4031  INTEGER(INTG), INTENT(OUT) :: err
4032  TYPE(varying_string), INTENT(OUT) :: error
4033  !Local Variables
4034  TYPE(varying_string) :: local_error
4035 
4036  enters("FIELD_DATA_TYPE_SET",err,error,*999)
4037 
4038  IF(ASSOCIATED(field)) THEN
4039  IF(field%FIELD_FINISHED) THEN
4040  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
4041  CALL flagerror(local_error,err,error,*999)
4042  ELSE
4043  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
4044  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
4045  IF(any(field%CREATE_VALUES_CACHE%VARIABLE_TYPES==variable_type)) THEN
4046  IF(field%CREATE_VALUES_CACHE%DATA_TYPES_LOCKED(variable_type)) THEN
4047  local_error="The data type has been locked for variable type "// &
4048  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
4049  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
4050  CALL flagerror(local_error,err,error,*999)
4051  ELSE
4052  SELECT CASE(data_type)
4053  CASE(field_intg_type)
4054  field%CREATE_VALUES_CACHE%DATA_TYPES(variable_type)=field_intg_type
4055  CASE(field_sp_type)
4056  field%CREATE_VALUES_CACHE%DATA_TYPES(variable_type)=field_sp_type
4057  CASE(field_dp_type)
4058  field%CREATE_VALUES_CACHE%DATA_TYPES(variable_type)=field_dp_type
4059  CASE(field_l_type)
4060  field%CREATE_VALUES_CACHE%DATA_TYPES(variable_type)=field_l_type
4061  CASE DEFAULT
4062  local_error="The specified data type of "//trim(number_to_vstring(data_type,"*",err,error))// &
4063  & " is invalid."
4064  CALL flagerror(local_error,err,error,*999)
4065  END SELECT
4066  ENDIF
4067  ELSE
4068  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4069  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
4070  CALL flagerror(local_error,err,error,*999)
4071  ENDIF
4072  ELSE
4073  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4074  & " is invalid. The variable type must be between 1 and "// &
4075  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
4076  CALL flagerror(local_error,err,error,*999)
4077  ENDIF
4078  ELSE
4079  CALL flagerror("Field create values cache is not associated.",err,error,*999)
4080  ENDIF
4081  ENDIF
4082  ELSE
4083  CALL flagerror("Field is not associated.",err,error,*999)
4084  ENDIF
4085 
4086  exits("FIELD_DATA_TYPE_SET")
4087  RETURN
4088 999 errorsexits("FIELD_DATA_TYPE_SET",err,error)
4089  RETURN 1
4090  END SUBROUTINE field_data_type_set
4091 
4092  !
4093  !================================================================================================================================
4094  !
4095 
4097  SUBROUTINE field_data_type_set_and_lock(FIELD,VARIABLE_TYPE,DATA_TYPE,ERR,ERROR,*)
4098 
4099  !Argument variables
4100  TYPE(field_type), POINTER :: field
4101  INTEGER(INTG), INTENT(IN) :: variable_type
4102  INTEGER(INTG), INTENT(IN) :: data_type
4103  INTEGER(INTG), INTENT(OUT) :: err
4104  TYPE(varying_string), INTENT(OUT) :: error
4105  !Local Variables
4106  TYPE(varying_string) :: local_error
4107 
4108  enters("FIELD_DATA_TYPE_SET_AND_LOCK",err,error,*999)
4109 
4110  CALL field_data_type_set(field,variable_type,data_type,err,error,*999)
4111  IF(ASSOCIATED(field)) THEN
4112  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
4113  field%CREATE_VALUES_CACHE%DATA_TYPES_LOCKED(variable_type)=.true.
4114  ELSE
4115  local_error="Field create values cache is not associated for field number "// &
4116  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
4117  CALL flagerror(local_error,err,error,*999)
4118  ENDIF
4119  ELSE
4120  CALL flagerror("Field is not associated.",err,error,*999)
4121  ENDIF
4122 
4123  exits("FIELD_DATA_TYPE_SET_AND_LOCK")
4124  RETURN
4125 999 errorsexits("FIELD_DATA_TYPE_SET_AND_LOCK",err,error)
4126  RETURN 1
4127  END SUBROUTINE field_data_type_set_and_lock
4128 
4129  !
4130  !================================================================================================================================
4131  !
4132 
4134  SUBROUTINE field_dof_order_type_check(FIELD,VARIABLE_TYPE,DOF_ORDER_TYPE,ERR,ERROR,*)
4135 
4136  !Argument variables
4137  TYPE(field_type), POINTER :: field
4138  INTEGER(INTG), INTENT(IN) :: variable_type
4139  INTEGER(INTG), INTENT(IN) :: dof_order_type
4140  INTEGER(INTG), INTENT(OUT) :: err
4141  TYPE(varying_string), INTENT(OUT) :: error
4142  !Local Variables
4143  TYPE(field_variable_type), POINTER :: field_variable
4144  TYPE(varying_string) :: local_error
4145 
4146  enters("FIELD_DOF_ORDER_TYPE_CHECK",err,error,*999)
4147 
4148  IF(ASSOCIATED(field)) THEN
4149  IF(field%FIELD_FINISHED) THEN
4150  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
4151  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
4152  IF(ASSOCIATED(field_variable)) THEN
4153  SELECT CASE(dof_order_type)
4154  CASE(field_separated_component_dof_order)
4155  IF(field_variable%DOF_ORDER_TYPE/=field_separated_component_dof_order) THEN
4156  local_error="Invalid DOF order type. The DOF order type for variable type "// &
4157  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
4158  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
4159  & trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
4160  & " which is not a separated component DOF order type."
4161  CALL flagerror(local_error,err,error,*999)
4162  ENDIF
4163  CASE(field_contiguous_component_dof_order)
4164  IF(field_variable%DOF_ORDER_TYPE/=field_contiguous_component_dof_order) THEN
4165  local_error="Invalid DOF order type. The DOF order type for variable type "// &
4166  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
4167  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
4168  & trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
4169  & " which is not a contiguous component DOF order type."
4170  CALL flagerror(local_error,err,error,*999)
4171  ENDIF
4172  CASE DEFAULT
4173  local_error="The specified DOF order type of "//trim(number_to_vstring(dof_order_type,"*",err,error))// &
4174  & " is invalid."
4175  CALL flagerror(local_error,err,error,*999)
4176  END SELECT
4177  ELSE
4178  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4179  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
4180  CALL flagerror(local_error,err,error,*999)
4181  ENDIF
4182  ELSE
4183  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4184  & " is invalid. The variable type must be between 1 and "// &
4185  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
4186  CALL flagerror(local_error,err,error,*999)
4187  ENDIF
4188  ELSE
4189  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
4190  & " has not been finished."
4191  CALL flagerror(local_error,err,error,*999)
4192  ENDIF
4193  ELSE
4194  CALL flagerror("Field is not associated.",err,error,*999)
4195  ENDIF
4196 
4197  exits("FIELD_DOF_ORDER_TYPE_CHECK")
4198  RETURN
4199 999 errorsexits("FIELD_DOF_ORDER_TYPE_CHECK",err,error)
4200  RETURN 1
4201  END SUBROUTINE field_dof_order_type_check
4202 
4203  !
4204  !================================================================================================================================
4205  !
4206 
4208  SUBROUTINE field_dof_order_type_get(FIELD,VARIABLE_TYPE,DOF_ORDER_TYPE,ERR,ERROR,*)
4209 
4210  !Argument variables
4211  TYPE(field_type), POINTER :: field
4212  INTEGER(INTG), INTENT(IN) :: variable_type
4213  INTEGER(INTG), INTENT(OUT) :: dof_order_type
4214  INTEGER(INTG), INTENT(OUT) :: err
4215  TYPE(varying_string), INTENT(OUT) :: error
4216  !Local Variables
4217  TYPE(field_variable_type), POINTER :: field_variable
4218  TYPE(varying_string) :: local_error
4219 
4220  enters("FIELD_DOF_ORDER_TYPE_GET",err,error,*999)
4221 
4222  IF(ASSOCIATED(field)) THEN
4223  IF(field%FIELD_FINISHED) THEN
4224  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
4225  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
4226  IF(ASSOCIATED(field_variable)) THEN
4227  dof_order_type=field_variable%DOF_ORDER_TYPE
4228  ELSE
4229  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4230  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
4231  CALL flagerror(local_error,err,error,*999)
4232  ENDIF
4233  ELSE
4234  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4235  & " is invalid. The variable type must be between 1 and "// &
4236  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
4237  CALL flagerror(local_error,err,error,*999)
4238 
4239 
4240 
4241  ENDIF
4242  ELSE
4243  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
4244  & " has not been finished."
4245  CALL flagerror(local_error,err,error,*999)
4246  ENDIF
4247  ELSE
4248  CALL flagerror("Field is not associated.",err,error,*999)
4249  ENDIF
4250 
4251  exits("FIELD_DOF_ORDER_TYPE_GET")
4252  RETURN
4253 999 errorsexits("FIELD_DOF_ORDER_TYPE_GET",err,error)
4254  RETURN 1
4255  END SUBROUTINE field_dof_order_type_get
4256 
4257  !
4258  !================================================================================================================================
4259  !
4260 
4262  SUBROUTINE field_dof_order_type_set(FIELD,VARIABLE_TYPE,DOF_ORDER_TYPE,ERR,ERROR,*)
4263 
4264  !Argument variables
4265  TYPE(field_type), POINTER :: field
4266  INTEGER(INTG), INTENT(IN) :: variable_type
4267  INTEGER(INTG), INTENT(IN) :: dof_order_type
4268  INTEGER(INTG), INTENT(OUT) :: err
4269  TYPE(varying_string), INTENT(OUT) :: error
4270  !Local Variables
4271  INTEGER(INTG) :: component_idx
4272  LOGICAL :: same_interpolation,same_mesh_component
4273  TYPE(varying_string) :: local_error
4274 
4275  enters("FIELD_DOF_ORDER_TYPE_SET",err,error,*999)
4276 
4277  IF(ASSOCIATED(field)) THEN
4278  IF(field%FIELD_FINISHED) THEN
4279  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
4280  CALL flagerror(local_error,err,error,*999)
4281  ELSE
4282  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
4283  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
4284  IF(any(field%CREATE_VALUES_CACHE%VARIABLE_TYPES==variable_type)) THEN
4285  IF(field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES_LOCKED(variable_type)) THEN
4286  local_error="The DOF order type has been locked for variable type "// &
4287  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
4288  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
4289  CALL flagerror(local_error,err,error,*999)
4290  ELSE
4291  SELECT CASE(dof_order_type)
4292  CASE(field_separated_component_dof_order)
4293  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES(variable_type)=field_separated_component_dof_order
4294  CASE(field_contiguous_component_dof_order)
4295  same_interpolation=.true.
4296  same_mesh_component=.true.
4297  DO component_idx=2,field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)
4298  IF(field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(component_idx,variable_type)/= &
4299  & field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(1,variable_type)) THEN
4300  same_interpolation=.false.
4301  EXIT
4302  ENDIF
4303  IF(field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(component_idx,variable_type)/= &
4304  & field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(1,variable_type)) THEN
4305  same_mesh_component=.false.
4306  EXIT
4307  ENDIF
4308  ENDDO !component_idx
4309  IF(same_interpolation.AND.same_mesh_component) THEN
4310  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES(variable_type)=field_contiguous_component_dof_order
4311  ELSE
4312  CALL flagerror("Invalid field variable component set. For continguous component DOF "// &
4313  & "ordering the field variable components must have the same interpolation type and mesh components.", &
4314  & err,error,*999)
4315  ENDIF
4316  CASE DEFAULT
4317  local_error="The specified DOF order type of "//trim(number_to_vstring(dof_order_type,"*",err,error))// &
4318  & " is invalid."
4319  CALL flagerror(local_error,err,error,*999)
4320  END SELECT
4321  ENDIF
4322  ELSE
4323  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4324  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
4325  CALL flagerror(local_error,err,error,*999)
4326  ENDIF
4327  ELSE
4328  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4329  & " is invalid. The variable type must be between 1 and "// &
4330  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
4331  CALL flagerror(local_error,err,error,*999)
4332  ENDIF
4333  ELSE
4334  CALL flagerror("Field create values cache is not associated.",err,error,*999)
4335  ENDIF
4336  ENDIF
4337  ELSE
4338  CALL flagerror("Field is not associated.",err,error,*999)
4339  ENDIF
4340 
4341  exits("FIELD_DOF_ORDER_TYPE_SET")
4342  RETURN
4343 999 errorsexits("FIELD_DOF_ORDER_TYPE_SET",err,error)
4344  RETURN 1
4345  END SUBROUTINE field_dof_order_type_set
4346 
4347  !
4348  !================================================================================================================================
4349  !
4350 
4352  SUBROUTINE field_dof_order_type_set_and_lock(FIELD,VARIABLE_TYPE,DOF_ORDER_TYPE,ERR,ERROR,*)
4353 
4354  !Argument variables
4355  TYPE(field_type), POINTER :: field
4356  INTEGER(INTG), INTENT(IN) :: variable_type
4357  INTEGER(INTG), INTENT(IN) :: dof_order_type
4358  INTEGER(INTG), INTENT(OUT) :: err
4359  TYPE(varying_string), INTENT(OUT) :: error
4360  !Local Variables
4361  TYPE(varying_string) :: local_error
4362 
4363  enters("FIELD_DOF_ORDER_TYPE_SET_AND_LOCK",err,error,*999)
4364 
4365  CALL field_dof_order_type_set(field,variable_type,dof_order_type,err,error,*999)
4366  IF(ASSOCIATED(field)) THEN
4367  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
4368  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES_LOCKED(variable_type)=.true.
4369  ELSE
4370  local_error="Field create values cache is not associated for field number "// &
4371  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
4372  CALL flagerror(local_error,err,error,*999)
4373  ENDIF
4374  ELSE
4375  CALL flagerror("Field is not associated.",err,error,*999)
4376  ENDIF
4377 
4378  exits("FIELD_DOF_ORDER_TYPE_SET_AND_LOCK")
4379  RETURN
4380 999 errorsexits("FIELD_DOF_ORDER_TYPE_SET_AND_LOCK",err,error)
4381  RETURN 1
4382  END SUBROUTINE field_dof_order_type_set_and_lock
4383 
4384  !
4385 
4386  !================================================================================================================================
4387  !
4388 
4390  SUBROUTINE field_variable_component_finalise(FIELD_VARIABLE_COMPONENT,ERR,ERROR,*)
4391 
4392  !Argument variables
4393  TYPE(field_variable_component_type) :: field_variable_component
4394  INTEGER(INTG), INTENT(OUT) :: err
4395  TYPE(varying_string), INTENT(OUT) :: error
4396  !Local Variables
4397 
4398  enters("FIELD_VARIABLE_COMPONENT_FINALISE",err,error,*999)
4399 
4400  field_variable_component%COMPONENT_LABEL=""
4401  CALL fieldvariablecomponent_parametertodofmapfinalise(field_variable_component,err,error,*999)
4402 
4403  exits("FIELD_VARIABLE_COMPONENT_FINALISE")
4404  RETURN
4405 999 errorsexits("FIELD_VARIABLE_COMPONENT_FINALISE",err,error)
4406  RETURN 1
4407  END SUBROUTINE field_variable_component_finalise
4408 
4409  !
4410  !================================================================================================================================
4411  !
4412 
4414  SUBROUTINE field_variable_component_initialise(FIELD_VARIABLE,COMPONENT_NUMBER,ERR,ERROR,*)
4415 
4416  !Argument variables
4417  TYPE(field_variable_type), POINTER :: field_variable
4418  INTEGER(INTG), INTENT(IN) :: component_number
4419  INTEGER(INTG), INTENT(OUT) :: err
4420  TYPE(varying_string), INTENT(OUT) :: error
4421  !Local Variables
4422  INTEGER(INTG) :: comp_number,derivativeidx,dummy_err,ne,variable_type, ngp, maxinterp,globalelementnumber,nodeidx,numparameters
4423  TYPE(basis_type), POINTER :: basis
4424  TYPE(decomposition_type), POINTER :: decomposition
4425  TYPE(domain_type), POINTER :: domain
4426  TYPE(field_type), POINTER :: field
4427  TYPE(mesh_type), POINTER :: mesh
4428  TYPE(varying_string) :: dummy_error,local_error
4429 
4430  enters("FIELD_VARIABLE_COMPONENT_INITIALISE",err,error,*998)
4431 
4432  IF(ASSOCIATED(field_variable)) THEN
4433  field=>field_variable%FIELD
4434  IF(ASSOCIATED(field)) THEN
4435  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
4436  variable_type=field_variable%VARIABLE_TYPE
4437  IF(ALLOCATED(field_variable%COMPONENTS)) THEN
4438  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
4439  field_variable%COMPONENTS(component_number)%COMPONENT_NUMBER=component_number
4440  field_variable%COMPONENTS(component_number)%FIELD_VARIABLE=>field_variable
4441  decomposition=>field%DECOMPOSITION
4442  IF(ASSOCIATED(decomposition)) THEN
4443  mesh=>decomposition%MESH
4444  IF(ASSOCIATED(mesh)) THEN
4445  comp_number=field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(component_number,variable_type)
4446  IF(comp_number>0.AND.comp_number<=mesh%NUMBER_OF_COMPONENTS) THEN
4447  field_variable%COMPONENTS(component_number)%MESH_COMPONENT_NUMBER=comp_number
4448  field_variable%COMPONENTS(component_number)%DOMAIN=>decomposition%DOMAIN(comp_number)%PTR
4449  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
4450  IF(.NOT.ASSOCIATED(domain)) THEN
4451  local_error="Field component "//trim(number_to_vstring(component_number,"*",err,error))// &
4452  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
4453  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
4454  & " does not have a domain associated."
4455  CALL flagerror(local_error,err,error,*999)
4456  ENDIF
4457  ELSE
4458  local_error="The mesh component number of "//trim(number_to_vstring(comp_number,"*",err,error))// &
4459  & " for field component "//trim(number_to_vstring(component_number,"*",err,error))// &
4460  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
4461  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
4462  & " is invalid. The component number must be between 1 and "// &
4463  & trim(number_to_vstring(mesh%NUMBER_OF_COMPONENTS,"*",err,error))//"."
4464  CALL flagerror(local_error,err,error,*999)
4465  ENDIF
4466  ELSE
4467  local_error="Decomposition mesh is not associated for field number "// &
4468  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
4469  CALL flagerror(local_error,err,error,*999)
4470  ENDIF
4471  ELSE
4472  local_error="Decomposition is not associated for field number "// &
4473  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
4474  CALL flagerror(local_error,err,error,*999)
4475  ENDIF
4476  field_variable%COMPONENTS(component_number)%COMPONENT_LABEL=""
4477  field_variable%COMPONENTS(component_number)%COMPONENT_LABEL= &
4478  & field%CREATE_VALUES_CACHE%COMPONENT_LABELS(component_number,variable_type)
4479  field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE= &
4480  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(component_number,variable_type)
4481  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
4482  CASE(field_constant_interpolation)
4483  field_variable%COMPONENTS(component_number)%maxNumberElementInterpolationParameters=1
4484  field_variable%COMPONENTS(component_number)%maxNumberNodeInterpolationParameters=0
4485  CASE(field_element_based_interpolation)
4486  field_variable%COMPONENTS(component_number)%maxNumberElementInterpolationParameters=1
4487  field_variable%COMPONENTS(component_number)%maxNumberNodeInterpolationParameters=0
4488  CASE(field_node_based_interpolation)
4489  field_variable%COMPONENTS(component_number)%maxNumberElementInterpolationParameters=-1
4490  DO ne=1,domain%TOPOLOGY%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS
4491  basis=>domain%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%BASIS
4492  IF(basis%NUMBER_OF_ELEMENT_PARAMETERS>field_variable%COMPONENTS(component_number)% &
4493  & maxnumberelementinterpolationparameters) field_variable%COMPONENTS(component_number)% &
4494  & maxnumberelementinterpolationparameters=basis%NUMBER_OF_ELEMENT_PARAMETERS
4495  ENDDO !ne
4496  field_variable%COMPONENTS(component_number)%maxNumberNodeInterpolationParameters=-1
4497  DO nodeidx=1,domain%TOPOLOGY%NODES%TOTAL_NUMBER_OF_NODES
4498  numparameters=0
4499  DO derivativeidx=1,domain%TOPOLOGY%NODES%NODES(nodeidx)%NUMBER_OF_DERIVATIVES
4500  numparameters=numparameters+domain%TOPOLOGY%NODES%NODES(nodeidx)%DERIVATIVES(derivativeidx)%numberOfVersions
4501  ENDDO !derivativeIdx
4502  IF(numparameters>field_variable%COMPONENTS(component_number)%maxNumberNodeInterpolationParameters) &
4503  & field_variable%COMPONENTS(component_number)%maxNumberNodeInterpolationParameters=numparameters
4504  ENDDO !nodeIdx
4505  CASE(field_grid_point_based_interpolation)
4506  CALL flagerror("Not implemented.",err,error,*999)
4507  CASE(field_gauss_point_based_interpolation) ! ?
4508  maxinterp = -1
4509  DO ne=1,domain%TOPOLOGY%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS
4510  basis=>domain%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%BASIS
4511  ngp = basis%QUADRATURE%QUADRATURE_SCHEME_MAP(basis_default_quadrature_scheme)%PTR%NUMBER_OF_GAUSS
4512  IF(ngp > maxinterp) maxinterp = ngp
4513  ENDDO
4514  field_variable%COMPONENTS(component_number)%maxNumberElementInterpolationParameters = maxinterp
4515  field_variable%COMPONENTS(component_number)%maxNumberNodeInterpolationParameters = 0
4516  CASE(field_data_point_based_interpolation)
4517  WRITE(*,*) "In datapointbasedinterpolation"
4518  field_variable%COMPONENTS(component_number)%maxNumberElementInterpolationParameters=-1
4519  WRITE(*,*) "DOMAIN%TOPOLOGY%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS", domain%TOPOLOGY%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS
4520  DO ne=1,domain%TOPOLOGY%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS
4521  WRITE(*,*) "In forloop", ne
4522  globalelementnumber=decomposition%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%GLOBAL_NUMBER
4523  WRITE(*,*) "DECOMPOSITION%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%GLOBAL_NUMBER", &
4524  & decomposition%TOPOLOGY%ELEMENTS%ELEMENTS(ne)%GLOBAL_NUMBER
4525  WRITE(*,*) "Before if"
4526  IF(ASSOCIATED(decomposition%TOPOLOGY%dataPoints)) THEN
4527  WRITE(*,*) "DECOMPOSITION%TOPOLOGY%dataPoints%numberOfElementDataPoints(globalElementNumber)"
4528  ELSE
4529  WRITE(*,*) "NOT ALLOCATED"
4530  ENDIF
4531  IF(decomposition%TOPOLOGY%dataPoints%numberOfElementDataPoints(globalelementnumber)> &
4532  & field_variable%COMPONENTS(component_number)%maxNumberElementInterpolationParameters) THEN
4533  field_variable%COMPONENTS(component_number)%maxNumberElementInterpolationParameters= &
4534  & decomposition%TOPOLOGY%dataPoints%numberOfElementDataPoints(globalelementnumber)
4535  WRITE(*,*) "In if loop"
4536  ENDIF
4537  ENDDO
4538  field_variable%COMPONENTS(component_number)%maxNumberNodeInterpolationParameters=0
4539  WRITE(*,*) "BEFORE PARAM TO DOF MAP"
4540  CASE DEFAULT
4541  local_error="The interpolation type of "//trim(number_to_vstring(field_variable% &
4542  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
4543  & " for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
4544  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
4545  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is invalid."
4546  END SELECT
4547  CALL fieldvariablecomponent_parametertodofmapinitialise(field_variable%COMPONENTS(component_number), &
4548  & err,error,*999)
4549  ELSE
4550  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
4551  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
4552  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
4553  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
4554  CALL flagerror(local_error,err,error,*998)
4555  ENDIF
4556  ELSE
4557  CALL flagerror("Field variable components have not been allocated.",err,error,*998)
4558  ENDIF
4559  ELSE
4560  CALL flagerror("Field create values cache is not associated.",err,error,*998)
4561  ENDIF
4562  ELSE
4563  CALL flagerror("Field variable field is not associated.",err,error,*998)
4564  ENDIF
4565  ELSE
4566  CALL flagerror("Field variable is is not associated.",err,error,*998)
4567  ENDIF
4568 
4569  exits("FIELD_VARIABLE_COMPONENT_INITIALISE")
4570  RETURN
4571 999 CALL field_variable_component_finalise(field_variable%COMPONENTS(component_number),dummy_err,dummy_error,*998)
4572 998 errorsexits("FIELD_VARIABLE_COMPONENT_INITIALISE",err,error)
4573  RETURN 1
4574  END SUBROUTINE field_variable_component_initialise
4575 
4576  !
4577  !================================================================================================================================
4578  !
4579 
4581  SUBROUTINE fieldvariablecomponent_parametertodofmapfinalise(FIELD_VARIABLE_COMPONENT,ERR,ERROR,*)
4582 
4583  !Argument variables
4584  TYPE(field_variable_component_type) :: field_variable_component
4585  INTEGER(INTG), INTENT(OUT) :: err
4586  TYPE(varying_string), INTENT(OUT) :: error
4587  !Local Variables
4588 
4589  enters("FieldVariableComponent_ParameterToDofMapFinalise",err,error,*999)
4590 
4591  IF(ALLOCATED(field_variable_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES)) &
4592  & DEALLOCATE(field_variable_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES)
4593  IF(ALLOCATED(field_variable_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS)) &
4594  & DEALLOCATE(field_variable_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS)
4595  IF(ALLOCATED(field_variable_component%PARAM_TO_DOF_MAP%GRID_POINT_PARAM2DOF_MAP%GRID_POINTS)) &
4596  & DEALLOCATE(field_variable_component%PARAM_TO_DOF_MAP%GRID_POINT_PARAM2DOF_MAP%GRID_POINTS)
4597  IF(ALLOCATED(field_variable_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS)) &
4598  & DEALLOCATE(field_variable_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS)
4599  IF(ALLOCATED(field_variable_component%PARAM_TO_DOF_MAP%DATA_POINT_PARAM2DOF_MAP%DATA_POINTS)) &
4600  & DEALLOCATE(field_variable_component%PARAM_TO_DOF_MAP%DATA_POINT_PARAM2DOF_MAP%DATA_POINTS)
4601  field_variable_component%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS=0
4602  field_variable_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS=0
4603  field_variable_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS=0
4604  field_variable_component%PARAM_TO_DOF_MAP%GRID_POINT_PARAM2DOF_MAP%NUMBER_OF_GRID_POINT_PARAMETERS=0
4605  field_variable_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%NUMBER_OF_GAUSS_POINT_PARAMETERS=0
4606  field_variable_component%PARAM_TO_DOF_MAP%DATA_POINT_PARAM2DOF_MAP%NUMBER_OF_DATA_POINT_PARAMETERS=0
4607 
4608  exits("FieldVariableComponent_ParameterToDofMapFinalise")
4609  RETURN
4610 999 errors("FieldVariableComponent_ParameterToDofMapFinalise",err,error)
4611  exits("FieldVariableComponent_ParameterToDofMapFinalise")
4612  RETURN 1
4613 
4614  END SUBROUTINE fieldvariablecomponent_parametertodofmapfinalise
4615 
4616  !
4617  !================================================================================================================================
4618  !
4619 
4621  SUBROUTINE fieldvariablecomponent_parametertodofmapinitialise(FIELD_VARIABLE_COMPONENT,ERR,ERROR,*)
4622 
4623  !Argument variables
4624  TYPE(field_variable_component_type) :: field_variable_component
4625  INTEGER(INTG), INTENT(OUT) :: err
4626  TYPE(varying_string), INTENT(OUT) :: error
4627  !Local Variables
4628 
4629  enters("FieldVariableComponent_ParameterToDofMapInitialise",err,error,*999)
4630 
4631  field_variable_component%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS=0
4632  field_variable_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS=0
4633  field_variable_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS=0
4634  field_variable_component%PARAM_TO_DOF_MAP%GRID_POINT_PARAM2DOF_MAP%NUMBER_OF_GRID_POINT_PARAMETERS=0
4635  field_variable_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%NUMBER_OF_GAUSS_POINT_PARAMETERS=0
4636  field_variable_component%PARAM_TO_DOF_MAP%DATA_POINT_PARAM2DOF_MAP%NUMBER_OF_DATA_POINT_PARAMETERS=0
4637 
4638  exits("FieldVariableComponent_ParameterToDofMapInitialise")
4639  RETURN
4640 999 errors("FieldVariableComponent_ParameterToDofMapInitialise",err,error)
4641  exits("FieldVariableComponent_ParameterToDofMapInitialise")
4642  RETURN 1
4643 
4644  END SUBROUTINE fieldvariablecomponent_parametertodofmapinitialise
4645 
4646  !
4647  !================================================================================================================================
4648  !
4649 
4651  SUBROUTINE field_variable_components_finalise(FIELD_VARIABLE,ERR,ERROR,*)
4652 
4653  !Argument variables
4654  TYPE(field_variable_type) :: field_variable
4655  INTEGER(INTG), INTENT(OUT) :: err
4656  TYPE(varying_string), INTENT(OUT) :: error
4657  !Local Variables
4658  INTEGER(INTG) :: component_idx
4659 
4660  enters("FIELD_VARIABLE_COMPONENTS_FINALISE",err,error,*999)
4661 
4662  IF(ALLOCATED(field_variable%COMPONENTS)) THEN
4663  DO component_idx=1,SIZE(field_variable%COMPONENTS,1)
4664  CALL field_variable_component_finalise(field_variable%COMPONENTS(component_idx),err,error,*999)
4665  ENDDO !component_idx
4666  DEALLOCATE(field_variable%COMPONENTS)
4667  ENDIF
4668  field_variable%NUMBER_OF_COMPONENTS=0
4669 
4670  exits("FIELD_VARIABLE_COMPONENTS_FINALISE")
4671  RETURN
4672 999 errorsexits("FIELD_VARIABLE_COMPONENTS_FINALISE",err,error)
4673  RETURN 1
4674  END SUBROUTINE field_variable_components_finalise
4675 
4676  !
4677  !================================================================================================================================
4678  !
4679 
4681  SUBROUTINE field_variable_components_initialise(FIELD,VARIABLE_TYPE,ERR,ERROR,*)
4682 
4683  !Argument variables
4684  TYPE(field_type), POINTER :: field
4685  INTEGER(INTG), INTENT(IN) :: variable_type
4686  INTEGER(INTG), INTENT(OUT) :: err
4687  TYPE(varying_string), INTENT(OUT) :: error
4688  !Local Variables
4689  INTEGER(INTG) :: component_idx
4690  TYPE(field_variable_type), POINTER :: field_variable
4691  TYPE(varying_string) :: local_error
4692 
4693  enters("FIELD_VARIABLE_COMPONENTS_INITIALISE",err,error,*999)
4694 
4695  IF(ASSOCIATED(field)) THEN
4696  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
4697  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
4698  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
4699  IF(ASSOCIATED(field_variable)) THEN
4700  IF(ALLOCATED(field_variable%COMPONENTS)) THEN
4701  CALL flagerror("Field variable already has allocated components.",err,error,*999)
4702  ELSE
4703  ALLOCATE(field_variable%COMPONENTS(field_variable%NUMBER_OF_COMPONENTS),stat=err)
4704  IF(err/=0) CALL flagerror("Could not allocate field variable components.",err,error,*999)
4705  DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
4706  CALL field_variable_component_initialise(field_variable,component_idx,err,error,*999)
4707  ENDDO !component_idx
4708  ENDIF
4709  ELSE
4710  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4711  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
4712  CALL flagerror(local_error,err,error,*999)
4713  ENDIF
4714  ELSE
4715  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
4716  & " is invalid. The variable type must be between 1 and "// &
4717  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
4718  CALL flagerror(local_error,err,error,*999)
4719  ENDIF
4720  ELSE
4721  CALL flagerror("Field create values cache is not associated.",err,error,*999)
4722  ENDIF
4723  ELSE
4724  CALL flagerror("Field is not associated.",err,error,*999)
4725  ENDIF
4726 
4727  exits("FIELD_VARIABLE_COMPONENTS_INITIALISE")
4728  RETURN
4729 999 errorsexits("FIELD_VARIABLE_COMPONENTS_INITIALISE",err,error)
4730  RETURN 1
4731  END SUBROUTINE field_variable_components_initialise
4732 
4733  !
4734  !================================================================================================================================
4735  !
4736 
4738  SUBROUTINE field_create_finish(FIELD,ERR,ERROR,*)
4739 
4740  !Argument variables
4741  TYPE(field_type), POINTER :: field
4742  INTEGER(INTG), INTENT(OUT) :: err
4743  TYPE(varying_string), INTENT(OUT) :: error
4744  !Local Variables
4745  INTEGER(INTG) :: componentidx,parametersetidx,scalingidx,variableidx
4746  TYPE(varying_string) :: local_error
4747 
4748  enters("FIELD_CREATE_FINISH",err,error,*999)
4749 
4750  IF(ASSOCIATED(field)) THEN
4751  IF(field%FIELD_FINISHED) THEN
4752  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has already been finished."
4753  CALL flagerror(local_error,err,error,*999)
4754  ELSE
4755  !Check field has a decomposition associated
4756  IF(ASSOCIATED(field%DECOMPOSITION)) THEN
4757  !Check for field validity
4758  CALL fieldvariablescheck(field,err,error,*999)
4759  !Initialise the components
4760  CALL field_variables_initialise(field,err,error,*999)
4761  IF(ASSOCIATED(field%GEOMETRIC_FIELD)) THEN
4762  CALL field_create_values_cache_finalise(field%CREATE_VALUES_CACHE,err,error,*999)
4763  field%FIELD_FINISHED=.true.
4764  !Calculate dof mappings
4765  CALL field_mappings_calculate(field,err,error,*999)
4766  !Set up the geometric parameters
4767  CALL field_geometric_parameters_initialise(field,err,error,*999)
4768  !Initialise the scalings
4769  CALL field_scalings_initialise(field,err,error,*999)
4770  !Initialise the field parameter sets
4771  CALL field_parameter_sets_initialise(field,err,error,*999)
4772  ELSE
4773  CALL flagerror("Field does not have a geometric field associated.",err,error,*999)
4774  ENDIF
4775  ELSE
4776  CALL flagerror("Field does not have a mesh decomposition associated.",err,error,*999)
4777  ENDIF
4778  ENDIF
4779  ELSE
4780  CALL flagerror("Field is not associated.",err,error,*999)
4781  ENDIF
4782 
4783  IF(diagnostics1) THEN
4784  CALL write_string_value(diagnostic_output_type,"",field%USER_NUMBER,err,error,*999)
4785  CALL write_string_value(diagnostic_output_type,"Field number : ",field%USER_NUMBER,err,error,*999)
4786  CALL write_string_value(diagnostic_output_type," Global number = ",field%GLOBAL_NUMBER,err,error,*999)
4787  CALL write_string_value(diagnostic_output_type," User number = ",field%USER_NUMBER,err,error,*999)
4788  CALL write_string_value(diagnostic_output_type," Label = ",field%LABEL,err,error,*999)
4789  CALL write_string_value(diagnostic_output_type," Dependent type = ",field%DEPENDENT_TYPE,err,error,*999)
4790  CALL write_string_value(diagnostic_output_type," Field type = ",field%TYPE,err,error,*999)
4791  CALL write_string_value(diagnostic_output_type," Number of variables = ",field%NUMBER_OF_VARIABLES,err,error,*999)
4792  IF(diagnostics2) THEN
4793  DO variableidx=1,field%NUMBER_OF_VARIABLES
4794  CALL write_string_value(diagnostic_output_type," Variable : ",variableidx,err,error,*999)
4795  CALL write_string_value(diagnostic_output_type," Variable Type = ",variableidx,err,error,*999)
4796  CALL write_string_value(diagnostic_output_type," Variable Label = ",field%VARIABLES(variableidx)%VARIABLE_LABEL, &
4797  & err,error,*999)
4798  CALL write_string_value(diagnostic_output_type," Dimension = ",field%VARIABLES(variableidx)%DIMENSION, &
4799  & err,error,*999)
4800  CALL write_string_value(diagnostic_output_type," Data type = ",field%VARIABLES(variableidx)%DATA_TYPE, &
4801  & err,error,*999)
4802  CALL write_string_value(diagnostic_output_type," DOF order type = ",field%VARIABLES(variableidx)%DOF_ORDER_TYPE, &
4803  & err,error,*999)
4804  CALL write_string_value(diagnostic_output_type," Max num element interpolation parameters = ",field% &
4805  & variables(variableidx)%maxNumberElementInterpolationParameters,err,error,*999)
4806  CALL write_string_value(diagnostic_output_type," Max num node interpolation parameters = ",field% &
4807  & variables(variableidx)%maxNumberNodeInterpolationParameters,err,error,*999)
4808  CALL write_string_value(diagnostic_output_type," Number of DOFs = ",field%VARIABLES(variableidx)% &
4809  & number_of_dofs,err,error,*999)
4810  CALL write_string_value(diagnostic_output_type," Total number of DOFs = ",field%VARIABLES(variableidx)% &
4811  & total_number_of_dofs,err,error,*999)
4812  CALL write_string_value(diagnostic_output_type," Number of global DOFs = ",field%VARIABLES(variableidx)% &
4813  & number_of_global_dofs,err,error,*999)
4814  CALL write_string_value(diagnostic_output_type," Number of components = ",field%VARIABLES(variableidx)% &
4815  & number_of_components,err,error,*999)
4816  IF(diagnostics3) THEN
4817  DO componentidx=1,field%VARIABLES(variableidx)%NUMBER_OF_COMPONENTS
4818  CALL write_string_value(diagnostic_output_type," Component : ",componentidx,err,error,*999)
4819  CALL write_string_value(diagnostic_output_type," Component label = ",field%VARIABLES(variableidx)% &
4820  components(componentidx)%COMPONENT_LABEL,err,error,*999)
4821  CALL write_string_value(diagnostic_output_type," Interpolation type = ",field%VARIABLES(variableidx)% &
4822  components(componentidx)%INTERPOLATION_TYPE,err,error,*999)
4823  CALL write_string_value(diagnostic_output_type," Mesh component number = ",field%VARIABLES(variableidx)% &
4824  components(componentidx)%MESH_COMPONENT_NUMBER,err,error,*999)
4825  CALL write_string_value(diagnostic_output_type," Scaling index = ",field%VARIABLES(variableidx)% &
4826  components(componentidx)%SCALING_INDEX,err,error,*999)
4827  CALL write_string_value(diagnostic_output_type," Max num element interpolation parameters = ",field% &
4828  & variables(variableidx)%COMPONENTS(componentidx)%maxNumberElementInterpolationParameters,err,error,*999)
4829  CALL write_string_value(diagnostic_output_type," Max num node interpolation parameters = ",field% &
4830  & variables(variableidx)%COMPONENTS(componentidx)%maxNumberNodeInterpolationParameters,err,error,*999)
4831  ENDDO !componentIdx
4832  ENDIF
4833  CALL write_string_value(diagnostic_output_type," Number of parameter sets = ",field%VARIABLES(variableidx)% &
4834  & parameter_sets%NUMBER_OF_PARAMETER_SETS,err,error,*999)
4835  IF(diagnostics3) THEN
4836  DO parametersetidx=1,field%VARIABLES(variableidx)%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS
4837  CALL write_string_value(diagnostic_output_type," Parameter set index : ",parametersetidx,err,error,*999)
4838  CALL write_string_value(diagnostic_output_type," Set type : ",field%VARIABLES(variableidx)% &
4839  & parameter_sets%PARAMETER_SETS(parametersetidx)%PTR%SET_TYPE,err,error,*999)
4840  ENDDO !parameterSetIdx
4841  ENDIF
4842  ENDDO !variableIdx
4843  ENDIF
4844  CALL write_string_value(diagnostic_output_type," Scaling type = ",field%SCALINGS%SCALING_TYPE,err,error,*999)
4845  CALL write_string_value(diagnostic_output_type," Number of scaling indices = ",field%SCALINGS%NUMBER_OF_SCALING_INDICES, &
4846  & err,error,*999)
4847  IF(diagnostics2) THEN
4848  DO scalingidx=1,field%SCALINGS%NUMBER_OF_SCALING_INDICES
4849  CALL write_string_value(diagnostic_output_type," Scaling index : ",scalingidx,err,error,*999)
4850  CALL write_string_value(diagnostic_output_type," Mesh component number : ",field%SCALINGS%SCALINGS(scalingidx)% &
4851  & mesh_component_number,err,error,*999)
4852  ENDDO !scalingIdx
4853  ENDIF
4854  ENDIF
4855 
4856  exits("FIELD_CREATE_FINISH")
4857  RETURN
4858 999 errorsexits("FIELD_CREATE_FINISH",err,error)
4859  RETURN 1
4860  END SUBROUTINE field_create_finish
4861 
4862  !
4863  !================================================================================================================================
4864  !
4865 
4867  SUBROUTINE field_create_start_generic(FIELDS,USER_NUMBER,FIELD,ERR,ERROR,*)
4868 
4869  !Argument variables
4870  TYPE(fields_type), POINTER :: fields
4871  INTEGER(INTG), INTENT(IN) :: user_number
4872  TYPE(field_type), POINTER :: field
4873  INTEGER(INTG), INTENT(OUT) :: err
4874  TYPE(varying_string), INTENT(OUT) :: error
4875  !Local Variables
4876  INTEGER(INTG) :: field_no
4877  TYPE(field_type), POINTER :: new_field
4878  TYPE(field_ptr_type), POINTER :: new_fields(:)
4879 
4880  NULLIFY(new_field)
4881  NULLIFY(new_fields)
4882 
4883  enters("FIELD_CREATE_START_GENERIC",err,error,*998)
4884 
4885  IF(ASSOCIATED(fields)) THEN
4886  IF(ASSOCIATED(field)) THEN
4887  CALL flagerror("Field is already associated.",err,error,*998)
4888  ELSE
4889  !Set default field properties
4890  CALL field_initialise(new_field,err,error,*999)
4891  new_field%GLOBAL_NUMBER=fields%NUMBER_OF_FIELDS+1
4892  new_field%USER_NUMBER=user_number
4893  new_field%LABEL="Field "//trim(number_to_vstring(user_number,"*",err,error))
4894  IF(err/=0) GOTO 999
4895  new_field%FIELDS=>fields
4896  NULLIFY(new_field%REGION)
4897  NULLIFY(new_field%INTERFACE)
4898  new_field%GEOMETRIC_FIELD=>new_field
4899  new_field%NUMBER_OF_VARIABLES=1
4900  new_field%SCALINGS%SCALING_TYPE=field_arithmetic_mean_scaling
4901  new_field%SCALINGS%NUMBER_OF_SCALING_INDICES=0
4902  NULLIFY(new_field%CREATE_VALUES_CACHE)
4903  !Add new field into list of fields
4904  ALLOCATE(new_fields(fields%NUMBER_OF_FIELDS+1),stat=err)
4905  IF(err/=0) CALL flagerror("Could not allocate new fields.",err,error,*999)
4906  DO field_no=1,fields%NUMBER_OF_FIELDS
4907  new_fields(field_no)%PTR=>fields%FIELDS(field_no)%PTR
4908  ENDDO !field_no
4909  new_fields(fields%NUMBER_OF_FIELDS+1)%PTR=>new_field
4910  IF(ASSOCIATED(fields%FIELDS)) DEALLOCATE(fields%FIELDS)
4911  fields%FIELDS=>new_fields
4912  fields%NUMBER_OF_FIELDS=fields%NUMBER_OF_FIELDS+1
4913  field=>new_field
4914  ENDIF
4915  ELSE
4916  CALL flagerror("Fields is not associated.",err,error,*998)
4917  ENDIF
4918 
4919  exits("FIELD_CREATE_START_GENERIC")
4920  RETURN
4921 999 IF(ASSOCIATED(new_field)) DEALLOCATE(new_field)
4922  IF(ASSOCIATED(new_fields)) DEALLOCATE(new_fields)
4923  NULLIFY(field)
4924 998 errorsexits("FIELD_CREATE_START_GENERIC",err,error)
4925  RETURN 1
4926  END SUBROUTINE field_create_start_generic
4927 
4928  !
4929  !================================================================================================================================
4930  !
4931 
4941  SUBROUTINE field_create_start_interface(USER_NUMBER,INTERFACE,FIELD,ERR,ERROR,*)
4942 
4943  !Argument variables
4944  INTEGER(INTG), INTENT(IN) :: user_number
4945  TYPE(interface_type), POINTER :: interface
4946  TYPE(field_type), POINTER :: field
4947  INTEGER(INTG), INTENT(OUT) :: err
4948  TYPE(varying_string), INTENT(OUT) :: error
4949  !Local Variables
4950  TYPE(varying_string) :: local_error
4951 
4952  enters("FIELD_CREATE_START_INTERFACE",err,error,*999)
4953 
4954  IF(ASSOCIATED(interface)) THEN
4955  IF(ASSOCIATED(field)) THEN
4956  CALL flagerror("Field is already associated.",err,error,*999)
4957  ELSE
4958  NULLIFY(field)
4959  IF(ASSOCIATED(interface%FIELDS)) THEN
4960  CALL field_user_number_find_generic(user_number,interface%FIELDS,field,err,error,*999)
4961  IF(ASSOCIATED(field)) THEN
4962  local_error="Field number "//trim(number_to_vstring(user_number,"*",err,error))// &
4963  & " has already been created on interface number "//trim(number_to_vstring(interface%USER_NUMBER,"*",err,error))//"."
4964  CALL flagerror(local_error,err,error,*999)
4965  ELSE
4966  CALL field_create_start_generic(interface%FIELDS,user_number,field,err,error,*999)
4967  field%INTERFACE=>INTERFACE
4968  CALL field_create_values_cache_initialise(field,err,error,*999)
4969  ENDIF
4970  ELSE
4971  local_error="The fields on interface number "//trim(number_to_vstring(interface%USER_NUMBER,"*",err,error))// &
4972  & " are not associated."
4973  CALL flagerror(local_error,err,error,*999)
4974  ENDIF
4975  ENDIF
4976  ELSE
4977  CALL flagerror("Interface is not associated.",err,error,*999)
4978  ENDIF
4979 
4980  exits("FIELD_CREATE_START_INTERFACE")
4981  RETURN
4982 999 errorsexits("FIELD_CREATE_START_INTERFACE",err,error)
4983  RETURN 1
4984 
4985  END SUBROUTINE field_create_start_interface
4986 
4987  !
4988  !================================================================================================================================
4989  !
4990 
5000  SUBROUTINE field_create_start_region(USER_NUMBER,REGION,FIELD,ERR,ERROR,*)
5001 
5002  !Argument variables
5003  INTEGER(INTG), INTENT(IN) :: user_number
5004  TYPE(region_type), POINTER :: region
5005  TYPE(field_type), POINTER :: field
5006  INTEGER(INTG), INTENT(OUT) :: err
5007  TYPE(varying_string), INTENT(OUT) :: error
5008  !Local Variables
5009  TYPE(varying_string) :: local_error
5010 
5011  enters("FIELD_CREATE_START_REGION",err,error,*999)
5012 
5013  IF(ASSOCIATED(region)) THEN
5014  IF(ASSOCIATED(field)) THEN
5015  CALL flagerror("Field is already associated.",err,error,*999)
5016  ELSE
5017  NULLIFY(field)
5018  IF(ASSOCIATED(region%FIELDS)) THEN
5019  CALL field_user_number_find_generic(user_number,region%FIELDS,field,err,error,*999)
5020  IF(ASSOCIATED(field)) THEN
5021  local_error="Field number "//trim(number_to_vstring(user_number,"*",err,error))// &
5022  & " has already been created on region number "//trim(number_to_vstring(region%USER_NUMBER,"*",err,error))//"."
5023  CALL flagerror(local_error,err,error,*999)
5024  ELSE
5025  CALL field_create_start_generic(region%FIELDS,user_number,field,err,error,*999)
5026  field%REGION=>region
5027  CALL field_create_values_cache_initialise(field,err,error,*999)
5028  ENDIF
5029  ELSE
5030  local_error="The fields on region number "//trim(number_to_vstring(region%USER_NUMBER,"*",err,error))// &
5031  & " are not associated."
5032  CALL flagerror(local_error,err,error,*999)
5033  ENDIF
5034  ENDIF
5035  ELSE
5036  CALL flagerror("Region is not associated.",err,error,*999)
5037  ENDIF
5038 
5039  exits("FIELD_CREATE_START_REGION")
5040  RETURN
5041 999 errorsexits("FIELD_CREATE_START_REGION",err,error)
5042  RETURN 1
5043  END SUBROUTINE field_create_start_region
5044 
5045  !
5046  !================================================================================================================================
5047  !
5048 
5050  SUBROUTINE field_create_values_cache_finalise(CREATE_VALUES_CACHE,ERR,ERROR,*)
5051 
5052  !Argument variables
5053  TYPE(field_create_values_cache_type), POINTER :: create_values_cache
5054  INTEGER(INTG), INTENT(OUT) :: err
5055  TYPE(varying_string), INTENT(OUT) :: error
5056  !Local Variables
5057  INTEGER(INTG) :: component_idx,variable_idx
5058 
5059  enters("FIELD_CREATE_VALUES_CACHE_FINALISE",err,error,*999)
5060 
5061  IF(ASSOCIATED(create_values_cache)) THEN
5062  IF(ALLOCATED(create_values_cache%VARIABLE_TYPES)) DEALLOCATE(create_values_cache%VARIABLE_TYPES)
5063  IF(ALLOCATED(create_values_cache%VARIABLE_LABELS)) THEN
5064  DO variable_idx=1,SIZE(create_values_cache%VARIABLE_LABELS,1)
5065  create_values_cache%VARIABLE_LABELS(variable_idx)=""
5066  ENDDO !variable_idx
5067  DEALLOCATE(create_values_cache%VARIABLE_LABELS)
5068  ENDIF
5069  IF(ALLOCATED(create_values_cache%VARIABLE_LABELS_LOCKED)) DEALLOCATE(create_values_cache%VARIABLE_LABELS_LOCKED)
5070  IF(ALLOCATED(create_values_cache%DIMENSION)) DEALLOCATE(create_values_cache%DIMENSION)
5071  IF(ALLOCATED(create_values_cache%DIMENSION_LOCKED)) DEALLOCATE(create_values_cache%DIMENSION_LOCKED)
5072  IF(ALLOCATED(create_values_cache%DATA_TYPES)) DEALLOCATE(create_values_cache%DATA_TYPES)
5073  IF(ALLOCATED(create_values_cache%DATA_TYPES_LOCKED)) DEALLOCATE(create_values_cache%DATA_TYPES_LOCKED)
5074  IF(ALLOCATED(create_values_cache%DOF_ORDER_TYPES)) DEALLOCATE(create_values_cache%DOF_ORDER_TYPES)
5075  IF(ALLOCATED(create_values_cache%DOF_ORDER_TYPES_LOCKED)) DEALLOCATE(create_values_cache%DOF_ORDER_TYPES_LOCKED)
5076  IF(ALLOCATED(create_values_cache%NUMBER_OF_COMPONENTS)) DEALLOCATE(create_values_cache%NUMBER_OF_COMPONENTS)
5077  IF(ALLOCATED(create_values_cache%NUMBER_OF_COMPONENTS_LOCKED)) DEALLOCATE(create_values_cache%NUMBER_OF_COMPONENTS_LOCKED)
5078  IF(ALLOCATED(create_values_cache%COMPONENT_LABELS)) THEN
5079  DO variable_idx=1,SIZE(create_values_cache%COMPONENT_LABELS,2)
5080  DO component_idx=1,SIZE(create_values_cache%COMPONENT_LABELS,1)
5081  create_values_cache%COMPONENT_LABELS(component_idx,variable_idx)=""
5082  ENDDO !component_idx
5083  ENDDO !variable_idx
5084  DEALLOCATE(create_values_cache%COMPONENT_LABELS)
5085  ENDIF
5086  IF(ALLOCATED(create_values_cache%COMPONENT_LABELS_LOCKED)) DEALLOCATE(create_values_cache%COMPONENT_LABELS_LOCKED)
5087  IF(ALLOCATED(create_values_cache%INTERPOLATION_TYPE)) DEALLOCATE(create_values_cache%INTERPOLATION_TYPE)
5088  IF(ALLOCATED(create_values_cache%INTERPOLATION_TYPE_LOCKED)) DEALLOCATE(create_values_cache%INTERPOLATION_TYPE_LOCKED)
5089  IF(ALLOCATED(create_values_cache%MESH_COMPONENT_NUMBER)) DEALLOCATE(create_values_cache%MESH_COMPONENT_NUMBER)
5090  IF(ALLOCATED(create_values_cache%MESH_COMPONENT_NUMBER_LOCKED)) DEALLOCATE(create_values_cache%MESH_COMPONENT_NUMBER_LOCKED)
5091  DEALLOCATE(create_values_cache)
5092  ENDIF
5093 
5094  exits("FIELD_CREATE_VALUES_CACHE_FINALISE")
5095  RETURN
5096 999 errorsexits("FIELD_CREATE_VALUES_CACHE_FINALISE",err,error)
5097  RETURN 1
5098  END SUBROUTINE field_create_values_cache_finalise
5099 
5100  !
5101  !================================================================================================================================
5102  !
5103 
5105  SUBROUTINE field_create_values_cache_initialise(FIELD,ERR,ERROR,*)
5106 
5107  !Argument variables
5108  TYPE(field_type), POINTER :: field
5109  INTEGER(INTG), INTENT(OUT) :: err
5110  TYPE(varying_string), INTENT(OUT) :: error
5111  !Local Variables
5112 
5113  INTEGER(INTG) :: dummy_err,number_of_components,component_idx,variable_idx
5114  TYPE(coordinate_system_type), POINTER :: coordinate_system
5115  TYPE(varying_string) :: dummy_error,local_error
5116 
5117  enters("FIELD_CREATE_VALUES_CACHE_INITIALISE",err,error,*998)
5118 
5119  IF(ASSOCIATED(field)) THEN
5120  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
5121  CALL flagerror("Create values cache is already associated.",err,error,*998)
5122  ELSE
5123  ALLOCATE(field%CREATE_VALUES_CACHE,stat=err)
5124  IF(err/=0) CALL flagerror("Could not allocate create values cache.",err,error,*999)
5125  SELECT CASE(field%TYPE)
5126  CASE(field_geometric_type,field_fibre_type,field_geometric_general_type)
5127  NULLIFY(coordinate_system)
5128  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
5129  number_of_components=coordinate_system%NUMBER_OF_DIMENSIONS
5130  CASE(field_general_type,field_material_type)
5131  number_of_components=1
5132  CASE DEFAULT
5133  local_error="The field type of "//trim(number_to_vstring(field%TYPE,"*",err,error))//" is invalid for field number "// &
5134  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
5135  CALL flagerror(local_error,err,error,*999)
5136  END SELECT
5137  ALLOCATE(field%CREATE_VALUES_CACHE%VARIABLE_TYPES(field%NUMBER_OF_VARIABLES),stat=err)
5138  IF(err/=0) CALL flagerror("Could not allocated create values cache variable types.",err,error,*999)
5139  ALLOCATE(field%CREATE_VALUES_CACHE%VARIABLE_LABELS(field_number_of_variable_types),stat=err)
5140  IF(err/=0) CALL flagerror("Could not allocated create values cache variable labels.",err,error,*999)
5141  ALLOCATE(field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED(field_number_of_variable_types),stat=err)
5142  IF(err/=0) CALL flagerror("Could not allocated create values cache variable labels locked.",err,error,*999)
5143  ALLOCATE(field%CREATE_VALUES_CACHE%DIMENSION(field_number_of_variable_types),stat=err)
5144  IF(err/=0) CALL flagerror("Could not allocated create values cache dimension.",err,error,*999)
5145  ALLOCATE(field%CREATE_VALUES_CACHE%DIMENSION_LOCKED(field_number_of_variable_types),stat=err)
5146  IF(err/=0) CALL flagerror("Could not allocated create values cache dimension locked.",err,error,*999)
5147  ALLOCATE(field%CREATE_VALUES_CACHE%DATA_TYPES(field_number_of_variable_types),stat=err)
5148  IF(err/=0) CALL flagerror("Could not allocated create values cache data types.",err,error,*999)
5149  ALLOCATE(field%CREATE_VALUES_CACHE%DATA_TYPES_LOCKED(field_number_of_variable_types),stat=err)
5150  IF(err/=0) CALL flagerror("Could not allocated create values cache data types locked.",err,error,*999)
5151  ALLOCATE(field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES(field_number_of_variable_types),stat=err)
5152  IF(err/=0) CALL flagerror("Could not allocated create values cache DOF order types.",err,error,*999)
5153  ALLOCATE(field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES_LOCKED(field_number_of_variable_types),stat=err)
5154  IF(err/=0) CALL flagerror("Could not allocated create values cache DOF order types locked.",err,error,*999)
5155  ALLOCATE(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(field_number_of_variable_types),stat=err)
5156  IF(err/=0) CALL flagerror("Could not allocated create values cache number of components.",err,error,*999)
5157  ALLOCATE(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS_LOCKED(field_number_of_variable_types),stat=err)
5158  IF(err/=0) CALL flagerror("Could not allocated create values cache number of components locked.",err,error,*999)
5159  ALLOCATE(field%CREATE_VALUES_CACHE%COMPONENT_LABELS(number_of_components,field_number_of_variable_types),stat=err)
5160  IF(err/=0) CALL flagerror("Could not allocated create values cache component labels.",err,error,*999)
5161  ALLOCATE(field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED(number_of_components,field_number_of_variable_types),stat=err)
5162  IF(err/=0) CALL flagerror("Could not allocated create values cache component labels locked.",err,error,*999)
5163  ALLOCATE(field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(number_of_components,field_number_of_variable_types),stat=err)
5164  IF(err/=0) CALL flagerror("Could not allocated create values cache interpolation type.",err,error,*999)
5165  ALLOCATE(field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED(number_of_components,field_number_of_variable_types),stat=err)
5166  IF(err/=0) CALL flagerror("Could not allocated create values cache interpolation type locked.",err,error,*999)
5167  ALLOCATE(field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(number_of_components,field_number_of_variable_types),stat=err)
5168  IF(err/=0) CALL flagerror("Could not allocated create values cache mesh component type.",err,error,*999)
5169  ALLOCATE(field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED(number_of_components,field_number_of_variable_types), &
5170  & stat=err)
5171  IF(err/=0) CALL flagerror("Could not allocated create values cache mesh component type locked.",err,error,*999)
5172  field%CREATE_VALUES_CACHE%LABEL_LOCKED=.false.
5173  field%CREATE_VALUES_CACHE%DECOMPOSITION_LOCKED=.false.
5174  field%CREATE_VALUES_CACHE%DEPENDENT_TYPE_LOCKED=.false.
5175  field%CREATE_VALUES_CACHE%DIMENSION_LOCKED=.false.
5176  field%CREATE_VALUES_CACHE%NUMBER_OF_VARIABLES_LOCKED=.false.
5177  field%CREATE_VALUES_CACHE%GEOMETRIC_FIELD_LOCKED=.false.
5178  field%CREATE_VALUES_CACHE%SCALING_TYPE_LOCKED=.false.
5179  field%CREATE_VALUES_CACHE%TYPE_LOCKED=.false.
5180  field%CREATE_VALUES_CACHE%VARIABLE_TYPES=0
5181  field%CREATE_VALUES_CACHE%VARIABLE_TYPES_LOCKED=.false.
5182  field%CREATE_VALUES_CACHE%VARIABLE_LABELS=""
5183  field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED=.false.
5184  field%CREATE_VALUES_CACHE%DIMENSION=0
5185  field%CREATE_VALUES_CACHE%DIMENSION_LOCKED=.false.
5186  field%CREATE_VALUES_CACHE%DATA_TYPES=0
5187  field%CREATE_VALUES_CACHE%DATA_TYPES_LOCKED=.false.
5188  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES=0
5189  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES_LOCKED=.false.
5190  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS=0
5191  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS_LOCKED=.false.
5192  field%CREATE_VALUES_CACHE%COMPONENT_LABELS=""
5193  field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED=.false.
5194  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE=0
5195  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED=.false.
5196  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER=0
5197  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED=.false.
5198  field%CREATE_VALUES_CACHE%DataProjectionLocked=.false.
5199  DO variable_idx=1,field%NUMBER_OF_VARIABLES
5200  field%CREATE_VALUES_CACHE%VARIABLE_TYPES(variable_idx)=variable_idx
5201  SELECT CASE(variable_idx)
5202  CASE(field_u_variable_type)
5203  SELECT CASE(field%TYPE)
5204  CASE(field_geometric_type)
5205  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="Coordinate"
5206  CASE(field_fibre_type)
5207  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="Fibre"
5208  CASE(field_material_type)
5209  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="Material"
5210  CASE(field_general_type)
5211  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U"
5212  CASE(field_geometric_general_type)
5213  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U"
5214  CASE DEFAULT
5215  local_error="The field type of "//trim(number_to_vstring(field%TYPE,"*",err,error))// &
5216  & " is invalid for field number "// &
5217  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
5218  CALL flagerror(local_error,err,error,*999)
5219  END SELECT
5220  CASE(field_deludeln_variable_type)
5221  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U/del n"
5222  CASE(field_deludelt_variable_type)
5223  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U/del t"
5224  CASE(field_del2udelt2_variable_type)
5225  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U/del t^2"
5226  CASE(field_v_variable_type)
5227  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="V"
5228  CASE(field_delvdeln_variable_type)
5229  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del V/del n"
5230  CASE(field_delvdelt_variable_type)
5231  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del V/del t"
5232  CASE(field_del2vdelt2_variable_type)
5233  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 V/del t^2"
5234  CASE(field_u1_variable_type)
5235  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U1"
5236  CASE(field_delu1deln_variable_type)
5237  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U1/del n"
5238  CASE(field_delu1delt_variable_type)
5239  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U1/del t"
5240  CASE(field_del2u1delt2_variable_type)
5241  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U1/del t^2"
5242  CASE(field_u2_variable_type)
5243  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U2"
5244  CASE(field_delu2deln_variable_type)
5245  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U2/del n"
5246  CASE(field_delu2delt_variable_type)
5247  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U2/del t"
5248  CASE(field_del2u2delt2_variable_type)
5249  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U2/del t^2"
5250  CASE(field_u3_variable_type)
5251  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U3"
5252  CASE(field_delu3deln_variable_type)
5253  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U3/del n"
5254  CASE(field_delu3delt_variable_type)
5255  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U3/del t"
5256  CASE(field_del2u3delt2_variable_type)
5257  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U3/del t^2"
5258  CASE(field_u4_variable_type)
5259  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U4"
5260  CASE(field_delu4deln_variable_type)
5261  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U4/del n"
5262  CASE(field_delu4delt_variable_type)
5263  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U4/del t"
5264  CASE(field_del2u4delt2_variable_type)
5265  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U4/del t^2"
5266  CASE(field_u5_variable_type)
5267  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U5"
5268  CASE(field_delu5deln_variable_type)
5269  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U5/del n"
5270  CASE(field_delu5delt_variable_type)
5271  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U5/del t"
5272  CASE(field_del2u5delt2_variable_type)
5273  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U5/del t^2"
5274  CASE(field_u6_variable_type)
5275  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U6"
5276  CASE(field_delu6deln_variable_type)
5277  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U6/del n"
5278  CASE(field_delu6delt_variable_type)
5279  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U6/del t"
5280  CASE(field_del2u6delt2_variable_type)
5281  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U6/del t^2"
5282  CASE(field_u7_variable_type)
5283  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U7"
5284  CASE(field_delu7deln_variable_type)
5285  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U7/del n"
5286  CASE(field_delu7delt_variable_type)
5287  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U7/del t"
5288  CASE(field_del2u7delt2_variable_type)
5289  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U7/del t^2"
5290  CASE(field_u8_variable_type)
5291  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U8"
5292  CASE(field_delu8deln_variable_type)
5293  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U8/del n"
5294  CASE(field_delu8delt_variable_type)
5295  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U8/del t"
5296  CASE(field_del2u8delt2_variable_type)
5297  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U8/del t^2"
5298  CASE(field_u9_variable_type)
5299  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U9"
5300  CASE(field_delu9deln_variable_type)
5301  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U9/del n"
5302  CASE(field_delu9delt_variable_type)
5303  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U9/del t"
5304  CASE(field_del2u9delt2_variable_type)
5305  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U/9del t^2"
5306  CASE(field_u10_variable_type)
5307  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="U10"
5308  CASE(field_delu10deln_variable_type)
5309  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U10/del n"
5310  CASE(field_delu10delt_variable_type)
5311  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del U10/del t"
5312  CASE(field_del2u10delt2_variable_type)
5313  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_idx)="del^2 U10/del t^2"
5314  CASE DEFAULT
5315  local_error="The variable type of "//trim(number_to_vstring(variable_idx,"*",err,error))//" is invalid."
5316  CALL flagerror(local_error,err,error,*999)
5317  END SELECT
5318  field%CREATE_VALUES_CACHE%DIMENSION(variable_idx)=field_vector_dimension_type
5319  field%CREATE_VALUES_CACHE%DATA_TYPES(variable_idx)=field_dp_type
5320  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES(variable_idx)=field_separated_component_dof_order
5321  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_idx)=number_of_components
5322  DO component_idx=1,number_of_components
5323  field%CREATE_VALUES_CACHE%COMPONENT_LABELS(component_idx,variable_idx)= &
5324  & trim(number_to_vstring(component_idx,"*",err,error))
5325 
5326 
5327 
5328 
5329 
5330 
5331  IF(err/=0) GOTO 999
5332  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(component_idx,variable_idx)=field_node_based_interpolation
5333  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(component_idx,variable_idx)=1
5334  ENDDO !component_idx
5335  ENDDO !variable_idx
5336  ENDIF
5337  ELSE
5338  CALL flagerror("Field is not associated.",err,error,*998)
5339  ENDIF
5340 
5341  exits("FIELD_CREATE_VALUES_CACHE_INITIALISE")
5342  RETURN
5343 999 CALL field_create_values_cache_finalise(field%CREATE_VALUES_CACHE,dummy_err,dummy_error,*998)
5344 998 errorsexits("FIELD_CREATE_VALUES_CACHE_INITIALISE",err,error)
5345  RETURN 1
5346  END SUBROUTINE field_create_values_cache_initialise
5347 
5348  !
5349  !================================================================================================================================
5350  !
5351 
5355  SUBROUTINE field_geometricgeneralfieldget(field,geometricField,generalFound,err,error,*)
5356 
5357  !Argument variables
5358  TYPE(field_type), POINTER, INTENT(IN) :: field
5359  TYPE(field_type), POINTER, INTENT(OUT) :: geometricfield
5360  LOGICAL, INTENT(OUT) :: generalfound
5361  INTEGER(INTG), INTENT(OUT) :: err
5362  TYPE(varying_string), INTENT(OUT) :: error
5363  !Local Variables
5364  INTEGER(INTG) :: fieldidx
5365  TYPE(field_type), POINTER :: otherfield
5366  TYPE(varying_string) :: localerror
5367 
5368  enters("Field_GeometricGeneralFieldGet",err,error,*999)
5369 
5370  NULLIFY(geometricfield)
5371 
5372  ! Check input parameters
5373  IF(ASSOCIATED(field)) THEN
5374  IF(field%field_finished) THEN
5375  IF(.NOT.ASSOCIATED(field%fields)) THEN
5376  CALL flagerror("Field fields are not associated.",err,error,*999)
5377  END IF
5378  ELSE
5379  localerror="Field number "//trim(number_to_vstring(field%user_number,"*",err,error))// &
5380  & " has not been finished."
5381  CALL flagerror(localerror,err,error,*999)
5382  END IF
5383  ELSE
5384  CALL flagerror("Field is not associated.",err,error,*999)
5385  END IF
5386  IF(ASSOCIATED(geometricfield)) THEN
5387  CALL flagerror("Geometric field is already associated.",err,error,*999)
5388  END IF
5389 
5390  generalfound=.false.
5391  ! Find the geometric general field associated with this field
5392  DO fieldidx=1,field%fields%number_of_fields
5393  otherfield=>field%fields%fields(fieldidx)%ptr
5394  IF(ASSOCIATED(otherfield)) THEN
5395  IF(otherfield%TYPE==field_geometric_general_type) THEN
5396  geometricfield=>otherfield
5397  generalfound=.true.
5398  END IF
5399  ELSE
5400  CALL flagerror("Field number "//trim(number_to_vstring(fieldidx,"*",err,error))// &
5401  & " is not associated.",err,error,*999)
5402  END IF
5403  END DO
5404 
5405  IF(.NOT.generalfound) THEN
5406  ! We couldn't find a geometric general field.
5407  ! Just return the undeformed geometric field.
5408  IF(ASSOCIATED(field%geometric_field)) THEN
5409  geometricfield=>field%geometric_field
5410  ELSE
5411  CALL flagerror("Geometric general field not found and geometric field is not associated.",err,error,*999)
5412  END IF
5413  END IF
5414 
5415  exits("Field_GeometricGeneralFieldGet")
5416  RETURN
5417 999 errorsexits("Field_GeometricGeneralFieldGet",err,error)
5418  RETURN 1
5419  END SUBROUTINE field_geometricgeneralfieldget
5420 
5421  !
5422  !================================================================================================================================
5423  !
5424 
5426  SUBROUTINE field_dependent_type_check(FIELD,DEPENDENT_TYPE,ERR,ERROR,*)
5427 
5428  !Argument variables
5429  TYPE(field_type), POINTER :: field
5430  INTEGER(INTG), INTENT(IN) :: dependent_type
5431  INTEGER(INTG), INTENT(OUT) :: err
5432  TYPE(varying_string), INTENT(OUT) :: error
5433  !Local Variables
5434  TYPE(varying_string) :: local_error
5435 
5436  enters("FIELD_DEPENDENT_TYPE_CHECK",err,error,*999)
5437 
5438  IF(ASSOCIATED(field)) THEN
5439  IF(field%FIELD_FINISHED) THEN
5440  SELECT CASE(dependent_type)
5441  CASE(field_independent_type)
5442  IF(field%DEPENDENT_TYPE/=field_independent_type) THEN
5443  local_error="Invalid dependent type. The dependent type of field number "// &
5444  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
5445  & trim(number_to_vstring(field%DEPENDENT_TYPE,"*",err,error))// &
5446  & " which is not an independent field."
5447  CALL flagerror(local_error,err,error,*999)
5448  ENDIF
5449  CASE(field_dependent_type)
5450  IF(field%DEPENDENT_TYPE/=field_dependent_type) THEN
5451  local_error="Invalid dependent type. The dependent type of field number "// &
5452  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
5453  & trim(number_to_vstring(field%DEPENDENT_TYPE,"*",err,error))// &
5454  & " which is not a dependent field."
5455  CALL flagerror(local_error,err,error,*999)
5456  ENDIF
5457  CASE DEFAULT
5458  local_error="The specified dependent type of "//trim(number_to_vstring(dependent_type,"*",err,error))// &
5459  & " is invalid."
5460  CALL flagerror(local_error,err,error,*999)
5461  END SELECT
5462  ELSE
5463  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
5464  CALL flagerror(local_error,err,error,*999)
5465  ENDIF
5466  ELSE
5467  CALL flagerror("Field is not associated.",err,error,*999)
5468  ENDIF
5469 
5470  exits("FIELD_DEPENDENT_TYPE_CHECK")
5471  RETURN
5472 999 errorsexits("FIELD_DEPENDENT_TYPE_CHECK",err,error)
5473  RETURN 1
5474  END SUBROUTINE field_dependent_type_check
5475 
5476  !
5477  !================================================================================================================================
5478  !
5479 
5481  SUBROUTINE field_dependent_type_get(FIELD,DEPENDENT_TYPE,ERR,ERROR,*)
5482 
5483  !Argument variables
5484  TYPE(field_type), POINTER :: field
5485  INTEGER(INTG), INTENT(OUT) :: dependent_type
5486  INTEGER(INTG), INTENT(OUT) :: err
5487  TYPE(varying_string), INTENT(OUT) :: error
5488  !Local Variables
5489  TYPE(varying_string) :: local_error
5490 
5491  enters("FIELD_DEPENDENT_TYPE_GET",err,error,*999)
5492 
5493  IF(ASSOCIATED(field)) THEN
5494  IF(field%FIELD_FINISHED) THEN
5495  dependent_type=field%DEPENDENT_TYPE
5496  ELSE
5497  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
5498  CALL flagerror(local_error,err,error,*999)
5499  ENDIF
5500  ELSE
5501  CALL flagerror("Field is not associated.",err,error,*999)
5502  ENDIF
5503 
5504  exits("FIELD_DEPENDENT_TYPE_GET")
5505  RETURN
5506 999 errorsexits("FIELD_DEPENDENT_TYPE_GET",err,error)
5507  RETURN 1
5508  END SUBROUTINE field_dependent_type_get
5509 
5510  !
5511  !================================================================================================================================
5512  !
5513 
5515  SUBROUTINE field_dependent_type_set(FIELD,DEPENDENT_TYPE,ERR,ERROR,*)
5516 
5517  !Argument variables
5518  TYPE(field_type), POINTER :: field
5519  INTEGER(INTG), INTENT(IN) :: dependent_type
5520  INTEGER(INTG), INTENT(OUT) :: err
5521  TYPE(varying_string), INTENT(OUT) :: error
5522  !Local Variables
5523  TYPE(varying_string) :: local_error
5524 
5525  enters("FIELD_DEPENDENT_TYPE_SET",err,error,*999)
5526 
5527  IF(ASSOCIATED(field)) THEN
5528  IF(field%FIELD_FINISHED) THEN
5529  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
5530  CALL flagerror(local_error,err,error,*999)
5531  ELSE
5532  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
5533  IF(field%CREATE_VALUES_CACHE%DEPENDENT_TYPE_LOCKED) THEN
5534  local_error="The dependent type has been locked for field number "// &
5535  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
5536  CALL flagerror(local_error,err,error,*999)
5537  ELSE
5538  SELECT CASE(dependent_type)
5539  CASE(field_independent_type)
5540  field%DEPENDENT_TYPE=field_independent_type
5541  CASE(field_dependent_type)
5542  field%DEPENDENT_TYPE=field_dependent_type
5543  CASE DEFAULT
5544  local_error="The supplied dependent type of "//trim(number_to_vstring(dependent_type,"*",err,error))//" is invalid."
5545  CALL flagerror(local_error,err,error,*999)
5546  END SELECT
5547  ENDIF
5548  ELSE
5549  local_error="Field create values cache is not associated for field number "// &
5550  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
5551  CALL flagerror(local_error,err,error,*999)
5552  ENDIF
5553  ENDIF
5554  ELSE
5555  CALL flagerror("Field is not associated.",err,error,*999)
5556  ENDIF
5557 
5558  exits("FIELD_DEPENDENT_TYPE_SET")
5559  RETURN
5560 999 errorsexits("FIELD_DEPENDENT_TYPE_SET",err,error)
5561  RETURN 1
5562  END SUBROUTINE field_dependent_type_set
5563 
5564  !
5565  !================================================================================================================================
5566  !
5567 
5569  SUBROUTINE field_dependent_type_set_and_lock(FIELD,DEPENDENT_TYPE,ERR,ERROR,*)
5570 
5571  !Argument variables
5572  TYPE(field_type), POINTER :: field
5573  INTEGER(INTG), INTENT(IN) :: dependent_type
5574  INTEGER(INTG), INTENT(OUT) :: err
5575  TYPE(varying_string), INTENT(OUT) :: error
5576  !Local Variables
5577  TYPE(varying_string) :: local_error
5578 
5579  enters("FIELD_DEPENDENT_TYPE_SET_AND_LOCK",err,error,*999)
5580 
5581  CALL field_dependent_type_set(field,dependent_type,err,error,*999)
5582  IF(ASSOCIATED(field)) THEN
5583  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
5584  field%CREATE_VALUES_CACHE%DEPENDENT_TYPE_LOCKED=.true.
5585  ELSE
5586  local_error="Field create values cache is not associated for field number "// &
5587  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
5588  CALL flagerror(local_error,err,error,*999)
5589  ENDIF
5590  ELSE
5591  CALL flagerror("Field is not associated.",err,error,*999)
5592  ENDIF
5593 
5594  exits("FIELD_DEPENDENT_TYPE_SET_AND_LOCK")
5595  RETURN
5596 999 errorsexits("FIELD_DEPENDENT_TYPE_SET_AND_LOCK",err,error)
5597  RETURN 1
5598  END SUBROUTINE field_dependent_type_set_and_lock
5599 
5600  !
5601  !================================================================================================================================
5602  !
5603 
5605  SUBROUTINE field_destroy(FIELD,ERR,ERROR,*)
5606 
5607  !Argument variables
5608  TYPE(field_type), POINTER :: field
5609  INTEGER(INTG), INTENT(OUT) :: err
5610  TYPE(varying_string), INTENT(OUT) :: error
5611  !Local Variables
5612  INTEGER(INTG) :: field_idx,field_position,field_position2
5613  TYPE(field_type), POINTER :: field2,geometric_field
5614  TYPE(fields_type), POINTER :: fields
5615  TYPE(field_ptr_type), POINTER :: new_fields(:),new_fields_using(:)
5616 
5617  NULLIFY(new_fields)
5618  NULLIFY(new_fields_using)
5619 
5620  enters("FIELD_DESTROY",err,error,*999)
5621 
5622  IF(ASSOCIATED(field)) THEN
5623  fields=>field%FIELDS
5624  IF(ASSOCIATED(fields)) THEN
5625  field_position=field%GLOBAL_NUMBER
5626  geometric_field=>field%GEOMETRIC_FIELD
5627  IF(ASSOCIATED(geometric_field)) THEN
5628  IF(ASSOCIATED(geometric_field%GEOMETRIC_FIELD_PARAMETERS)) THEN
5629  !Delete this field from the list of fields using the geometric field.
5630  field_position2=0
5631  DO field_idx=1,geometric_field%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_FIELDS_USING
5632  field2=>geometric_field%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING(field_idx)%PTR
5633  IF(field2%USER_NUMBER==field%USER_NUMBER) THEN
5634  field_position2=field_idx
5635  EXIT
5636  ENDIF
5637  ENDDO !field_idx
5638  IF(field_position2/=0) THEN
5639  ALLOCATE(new_fields_using(geometric_field%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_FIELDS_USING+1),stat=err)
5640  IF(err/=0) CALL flagerror("Could not allocate new fields using.",err,error,*999)
5641  DO field_idx=1,geometric_field%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_FIELDS_USING
5642  IF(field_idx<field_position2) THEN
5643  new_fields_using(field_idx)%PTR=>geometric_field%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING(field_idx)%PTR
5644  ELSE IF(field_idx>field_position2) THEN
5645  new_fields_using(field_idx-1)%PTR=>geometric_field%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING(field_idx)%PTR
5646  ENDIF
5647  ENDDO !field_idx
5648  geometric_field%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_FIELDS_USING=geometric_field%GEOMETRIC_FIELD_PARAMETERS% &
5649  & number_of_fields_using-1
5650  IF(ASSOCIATED(geometric_field%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING)) &
5651  & DEALLOCATE(geometric_field%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING)
5652  geometric_field%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING=>new_fields_using
5653  ELSE
5654  !??? Error
5655  ENDIF
5656  ENDIF
5657  ENDIF
5658  CALL field_finalise(field,err,error,*999)
5659  IF(fields%NUMBER_OF_FIELDS>1) THEN
5660  ALLOCATE(new_fields(fields%NUMBER_OF_FIELDS-1),stat=err)
5661  IF(err/=0) CALL flagerror("Could not allocate new fields.",err,error,*999)
5662  DO field_idx=1,fields%NUMBER_OF_FIELDS
5663  IF(field_idx<field_position) THEN
5664  new_fields(field_idx)%PTR=>fields%FIELDS(field_idx)%PTR
5665  ELSE IF(field_idx>field_position) THEN
5666  fields%FIELDS(field_idx)%PTR%GLOBAL_NUMBER=fields%FIELDS(field_idx)%PTR%GLOBAL_NUMBER-1
5667  new_fields(field_idx-1)%PTR=>fields%FIELDS(field_idx)%PTR
5668  ENDIF
5669  ENDDO !field_no
5670  DEALLOCATE(fields%FIELDS)
5671  fields%FIELDS=>new_fields
5672  fields%NUMBER_OF_FIELDS=fields%NUMBER_OF_FIELDS-1
5673  ELSE
5674  DEALLOCATE(fields%FIELDS)
5675  fields%NUMBER_OF_FIELDS=0
5676  ENDIF
5677  ELSE
5678  CALL flagerror("Field fields is not associated.",err,error,*999)
5679  ENDIF
5680  ELSE
5681  CALL flagerror("Field is not associated.",err,error,*999)
5682  ENDIF
5683 
5684  exits("FIELD_DESTROY")
5685  RETURN
5686 999 IF(ASSOCIATED(new_fields)) DEALLOCATE(new_fields)
5687  IF(ASSOCIATED(new_fields_using)) DEALLOCATE(new_fields_using)
5688  errorsexits("FIELD_DESTROY",err,error)
5689  RETURN 1
5690  END SUBROUTINE field_destroy
5691 
5692  !
5693  !================================================================================================================================
5694  !
5695 
5697  SUBROUTINE field_dimension_check(FIELD,VARIABLE_TYPE,DIMENSION_TYPE,ERR,ERROR,*)
5698 
5699  !Argument variables
5700  TYPE(field_type), POINTER :: field
5701  INTEGER(INTG), INTENT(IN) :: variable_type
5702  INTEGER(INTG), INTENT(IN) :: dimension_type
5703  INTEGER(INTG), INTENT(OUT) :: err
5704  TYPE(varying_string), INTENT(OUT) :: error
5705  !Local Variables
5706  TYPE(field_variable_type), POINTER :: field_variable
5707  TYPE(varying_string) :: local_error
5708 
5709  enters("FIELD_DIMENSION_CHECK",err,error,*999)
5710 
5711  IF(ASSOCIATED(field)) THEN
5712  IF(field%FIELD_FINISHED) THEN
5713  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
5714  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
5715  IF(ASSOCIATED(field_variable)) THEN
5716  SELECT CASE(dimension_type)
5717  CASE(field_scalar_dimension_type)
5718  IF(field_variable%DIMENSION/=field_scalar_dimension_type) THEN
5719  local_error="Invalid dimension type. The dimension type for variable type "// &
5720  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
5721  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
5722  & trim(number_to_vstring(field_variable%DIMENSION,"*",err,error))// &
5723  & " which is not a scalar field."
5724  CALL flagerror(local_error,err,error,*999)
5725  ENDIF
5726  CASE(field_vector_dimension_type)
5727  IF(field_variable%DIMENSION/=field_vector_dimension_type) THEN
5728  local_error="Invalid dimension type. The dimension type for variable type "// &
5729  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
5730  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
5731  & trim(number_to_vstring(field_variable%DIMENSION,"*",err,error))// &
5732  & " which is not a vector field."
5733  CALL flagerror(local_error,err,error,*999)
5734  ENDIF
5735  CASE(field_tensor_dimension_type)
5736  IF(field_variable%DIMENSION/=field_tensor_dimension_type) THEN
5737  local_error="Invalid dimension type. The dimension type for variable type "// &
5738  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
5739  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
5740  & trim(number_to_vstring(field_variable%DIMENSION,"*",err,error))// &
5741  & " which is not a tensor field."
5742  CALL flagerror(local_error,err,error,*999)
5743  ENDIF
5744 
5745  CASE DEFAULT
5746  local_error="The specified dimension type of "//trim(number_to_vstring(dimension_type,"*",err,error))// &
5747  & " is invalid."
5748  CALL flagerror(local_error,err,error,*999)
5749  END SELECT
5750  ELSE
5751  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
5752  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
5753  CALL flagerror(local_error,err,error,*999)
5754  ENDIF
5755  ELSE
5756  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
5757  & " is invalid. The variable type must be between 1 and "// &
5758  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
5759  CALL flagerror(local_error,err,error,*999)
5760  ENDIF
5761  ELSE
5762  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
5763  CALL flagerror(local_error,err,error,*999)
5764  ENDIF
5765  ELSE
5766  CALL flagerror("Field is not associated.",err,error,*999)
5767  ENDIF
5768 
5769  exits("FIELD_DIMENSION_CHECK")
5770  RETURN
5771 999 errorsexits("FIELD_DIMENSION_CHECK",err,error)
5772  RETURN 1
5773  END SUBROUTINE field_dimension_check
5774 
5775  !
5776  !================================================================================================================================
5777  !
5778 
5780  SUBROUTINE field_dimension_get(FIELD,VARIABLE_TYPE,DIMENSION,ERR,ERROR,*)
5781 
5782  !Argument variables
5783  TYPE(field_type), POINTER :: field
5784  INTEGER(INTG), INTENT(IN) :: variable_type
5785  INTEGER(INTG), INTENT(OUT) :: dimension
5786  INTEGER(INTG), INTENT(OUT) :: err
5787  TYPE(varying_string), INTENT(OUT) :: error
5788  !Local Variables
5789  TYPE(field_variable_type), POINTER :: field_variable
5790  TYPE(varying_string) :: local_error
5791 
5792  enters("FIELD_DIMENSION_GET",err,error,*999)
5793 
5794  IF(ASSOCIATED(field)) THEN
5795  IF(field%FIELD_FINISHED) THEN
5796  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
5797  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
5798  IF(ASSOCIATED(field_variable)) THEN
5799  dimension=field_variable%DIMENSION
5800  ELSE
5801  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
5802  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
5803  CALL flagerror(local_error,err,error,*999)
5804  ENDIF
5805  ELSE
5806  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
5807  & " is invalid. The variable type must be between 1 and "// &
5808  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
5809  CALL flagerror(local_error,err,error,*999)
5810  ENDIF
5811  ELSE
5812  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
5813  CALL flagerror(local_error,err,error,*999)
5814  ENDIF
5815  ELSE
5816  CALL flagerror("Field is not associated.",err,error,*999)
5817  ENDIF
5818 
5819  exits("FIELD_DIMENSION_GET")
5820  RETURN
5821 999 errorsexits("FIELD_DIMENSION_GET",err,error)
5822  RETURN 1
5823  END SUBROUTINE field_dimension_get
5824 
5825  !
5826  !================================================================================================================================
5827  !
5828 
5830  SUBROUTINE field_dimension_set(FIELD,VARIABLE_TYPE,FIELD_DIMENSION,ERR,ERROR,*)
5831 
5832  !Argument variables
5833  TYPE(field_type), POINTER :: field
5834  INTEGER(INTG), INTENT(IN) :: variable_type
5835  INTEGER(INTG), INTENT(IN) :: field_dimension
5836  INTEGER(INTG), INTENT(OUT) :: err
5837  TYPE(varying_string), INTENT(OUT) :: error
5838  !Local Variables
5839  INTEGER(INTG) :: number_of_components,new_number_of_components,variable_idx
5840  INTEGER(INTG), ALLOCATABLE :: new_interpolation_type(:,:),new_mesh_component_number(:,:)
5841  LOGICAL, ALLOCATABLE :: new_component_labels_locked(:,:),new_interpolation_type_locked(:,:), &
5842  & NEW_MESH_COMPONENT_NUMBER_LOCKED(:,:)
5843  TYPE(varying_string) :: local_error
5844  TYPE(varying_string), ALLOCATABLE :: new_component_labels(:,:)
5845 
5846  enters("FIELD_DIMENSION_SET",err,error,*999)
5847 
5848  IF(ASSOCIATED(field)) THEN
5849  IF(field%FIELD_FINISHED) THEN
5850  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
5851  CALL flagerror(local_error,err,error,*999)
5852  ELSE
5853  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
5854  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
5855  IF(any(field%CREATE_VALUES_CACHE%VARIABLE_TYPES==variable_type)) THEN
5856  IF(field%CREATE_VALUES_CACHE%DIMENSION_LOCKED(variable_type)) THEN
5857  local_error="The field dimension has been locked for for variable type "// &
5858  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
5859  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
5860  CALL flagerror(local_error,err,error,*999)
5861  ELSE
5862  SELECT CASE(field_dimension)
5863  CASE(field_scalar_dimension_type)
5864  IF(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)/=1) THEN
5865  number_of_components=SIZE(field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE,1)
5866  new_number_of_components=1
5867  !Here, new number of components always >= old_number_of_components
5868  DO variable_idx=1,field_number_of_variable_types
5869  IF (field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_idx) > new_number_of_components) THEN
5870  IF (variable_idx /= variable_type) THEN
5871  new_number_of_components=field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_idx)
5872  ENDIF
5873  ENDIF
5874  ENDDO
5875  ALLOCATE(new_component_labels(new_number_of_components,field_number_of_variable_types),stat=err)
5876  IF(err/=0) CALL flagerror("Could not allocate new component labels.",err,error,*999)
5877  ALLOCATE(new_component_labels_locked(new_number_of_components,field_number_of_variable_types),stat=err)
5878  IF(err/=0) CALL flagerror("Could not allocate new component labels locked.",err,error,*999)
5879  ALLOCATE(new_interpolation_type(new_number_of_components,field_number_of_variable_types),stat=err)
5880  IF(err/=0) CALL flagerror("Could not allocate new interpolation type.",err,error,*999)
5881  ALLOCATE(new_interpolation_type_locked(new_number_of_components,field_number_of_variable_types),stat=err)
5882  IF(err/=0) CALL flagerror("Could not allocate new interpolation type locked.",err,error,*999)
5883  ALLOCATE(new_mesh_component_number(new_number_of_components,field_number_of_variable_types),stat=err)
5884  IF(err/=0) CALL flagerror("Could not allocate new mesh component number.",err,error,*999)
5885  ALLOCATE(new_mesh_component_number_locked(new_number_of_components,field_number_of_variable_types),stat=err)
5886  IF(err/=0) CALL flagerror("Could not allocate new mesh component number locked.",err,error,*999)
5887  new_component_labels(1:new_number_of_components,:)= &
5888  & field%CREATE_VALUES_CACHE%COMPONENT_LABELS(1:new_number_of_components,:)
5889  new_component_labels_locked(1:new_number_of_components,:)= &
5890  & field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED(1:new_number_of_components,:)
5891  new_interpolation_type(1:new_number_of_components,:)= &
5892  & field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(1:new_number_of_components,:)
5893  new_interpolation_type_locked(1:new_number_of_components,:)= &
5894  & field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED(1:new_number_of_components,:)
5895  new_mesh_component_number(1:new_number_of_components,:)= &
5896  & field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(1:new_number_of_components,:)
5897  new_mesh_component_number_locked(1:new_number_of_components,:)= &
5898  & field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED(1:new_number_of_components,:)
5899 
5900  CALL move_alloc(new_component_labels,field%CREATE_VALUES_CACHE%COMPONENT_LABELS)
5901  CALL move_alloc(new_component_labels_locked,field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED)
5902  CALL move_alloc(new_interpolation_type,field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE)
5903  CALL move_alloc(new_interpolation_type_locked,field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED)
5904  CALL move_alloc(new_mesh_component_number,field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER)
5905  CALL move_alloc(new_mesh_component_number_locked,field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED)
5906 
5907  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)=1
5908  ENDIF
5909  field%CREATE_VALUES_CACHE%DIMENSION(variable_type)=field_scalar_dimension_type
5910  CASE(field_vector_dimension_type)
5911  field%CREATE_VALUES_CACHE%DIMENSION(variable_type)=field_vector_dimension_type
5912  CASE(field_tensor_dimension_type)
5913  field%CREATE_VALUES_CACHE%DIMENSION(variable_type)=field_tensor_dimension_type
5914  CALL flagerror("Not implemented.",err,error,*999)
5915  CASE DEFAULT
5916  local_error="The specified field dimension of "//trim(number_to_vstring(field_dimension,"*",err,error))// &
5917  & " is invalid."
5918  CALL flagerror(local_error,err,error,*999)
5919  END SELECT
5920  ENDIF
5921  ELSE
5922  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
5923  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
5924  CALL flagerror(local_error,err,error,*999)
5925  ENDIF
5926  ELSE
5927  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
5928  & " is invalid. The variable type must be between 1 and "// &
5929  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
5930  CALL flagerror(local_error,err,error,*999)
5931  ENDIF
5932  ELSE
5933  local_error="Field create values cache is not associated for field number "// &
5934  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
5935  CALL flagerror(local_error,err,error,*999)
5936  ENDIF
5937  ENDIF
5938  ELSE
5939  CALL flagerror("Field is not associated.",err,error,*999)
5940  ENDIF
5941 
5942  exits("FIELD_DIMENSION_SET")
5943  RETURN
5944 999 IF(ALLOCATED(new_component_labels)) DEALLOCATE(new_component_labels)
5945  IF(ALLOCATED(new_component_labels_locked)) DEALLOCATE(new_component_labels_locked)
5946  IF(ALLOCATED(new_interpolation_type)) DEALLOCATE(new_interpolation_type)
5947  IF(ALLOCATED(new_interpolation_type_locked)) DEALLOCATE(new_interpolation_type_locked)
5948  IF(ALLOCATED(new_mesh_component_number)) DEALLOCATE(new_mesh_component_number)
5949  IF(ALLOCATED(new_mesh_component_number_locked)) DEALLOCATE(new_mesh_component_number_locked)
5950  errorsexits("FIELD_DIMENSION_SET",err,error)
5951  RETURN 1
5952  END SUBROUTINE field_dimension_set
5953 
5954  !
5955  !================================================================================================================================
5956  !
5957 
5959  SUBROUTINE field_dimension_set_and_lock(FIELD,VARIABLE_TYPE,FIELD_DIMENSION,ERR,ERROR,*)
5960 
5961  !Argument variables
5962  TYPE(field_type), POINTER :: field
5963  INTEGER(INTG), INTENT(IN) :: variable_type
5964  INTEGER(INTG), INTENT(IN) :: field_dimension
5965  INTEGER(INTG), INTENT(OUT) :: err
5966  TYPE(varying_string), INTENT(OUT) :: error
5967  !Local Variables
5968  TYPE(varying_string) :: local_error
5969 
5970  enters("FIELD_DIMENSION_SET_AND_LOCK",err,error,*999)
5971 
5972  CALL field_dimension_set(field,variable_type,field_dimension,err,error,*999)
5973  IF(ASSOCIATED(field)) THEN
5974  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
5975  field%CREATE_VALUES_CACHE%DIMENSION_LOCKED(variable_type)=.true.
5976  ELSE
5977  local_error="Field create values cache is not associated for field number "// &
5978  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
5979  CALL flagerror(local_error,err,error,*999)
5980  ENDIF
5981  ELSE
5982  CALL flagerror("Field is not associated.",err,error,*999)
5983  ENDIF
5984 
5985  exits("FIELD_DIMENSION_SET_AND_LOCK")
5986  RETURN
5987 999 errorsexits("FIELD_DIMENSION_SET_AND_LOCK",err,error)
5988  RETURN 1
5989  END SUBROUTINE field_dimension_set_and_lock
5990 
5991  !
5992  !================================================================================================================================
5993  !
5994 
5996  SUBROUTINE field_finalise(FIELD,ERR,ERROR,*)
5997 
5998  !Argument variables
5999  TYPE(field_type), POINTER :: field
6000  INTEGER(INTG), INTENT(OUT) :: err
6001  TYPE(varying_string), INTENT(OUT) :: error
6002  !Local Variables
6003 
6004  enters("FIELD_FINALISE",err,error,*999)
6005 
6006  IF(ASSOCIATED(field)) THEN
6007  field%LABEL=""
6008  CALL field_scalings_finalise(field,err,error,*999)
6009  CALL field_variables_finalise(field,err,error,*999)
6010  CALL field_create_values_cache_finalise(field%CREATE_VALUES_CACHE,err,error,*999)
6011  CALL field_geometric_parameters_finalise(field%GEOMETRIC_FIELD_PARAMETERS,err,error,*999)
6012  IF(ALLOCATED(field%VARIABLE_TYPE_MAP)) DEALLOCATE(field%VARIABLE_TYPE_MAP)
6013  DEALLOCATE(field)
6014  ENDIF
6015 
6016  exits("FIELD_FINALISE")
6017  RETURN
6018 999 errorsexits("FIELD_FINALISE",err,error)
6019  RETURN 1
6020  END SUBROUTINE field_finalise
6021 
6022  !
6023  !================================================================================================================================
6024  !
6025 
6027  SUBROUTINE field_initialise(FIELD,ERR,ERROR,*)
6028 
6029  !Argument variables
6030  TYPE(field_type), POINTER :: field
6031  INTEGER(INTG), INTENT(OUT) :: err
6032  TYPE(varying_string), INTENT(OUT) :: error
6033  !Local Variables
6034  INTEGER(INTG) :: dummy_err,variable_type_idx
6035  TYPE(varying_string) :: dummy_error
6036 
6037  enters("FIELD_INITIALISE",err,error,*998)
6038 
6039  IF(ASSOCIATED(field)) THEN
6040  CALL flagerror("Field is already associated.",err,error,*998)
6041  ELSE
6042  ALLOCATE(field,stat=err)
6043  IF(err/=0) CALL flagerror("Could not allocate field.",err,error,*999)
6044  field%GLOBAL_NUMBER=0
6045  field%USER_NUMBER=0
6046  field%LABEL=""
6047  field%FIELD_FINISHED=.false.
6048  NULLIFY(field%FIELDS)
6049  NULLIFY(field%REGION)
6050  field%TYPE=field_geometric_type
6051  field%DEPENDENT_TYPE=field_independent_type
6052  NULLIFY(field%DECOMPOSITION)
6053  field%NUMBER_OF_VARIABLES=0
6054  NULLIFY(field%GEOMETRIC_FIELD)
6055  NULLIFY(field%GEOMETRIC_FIELD_PARAMETERS)
6056  NULLIFY(field%CREATE_VALUES_CACHE)
6057  ALLOCATE(field%VARIABLE_TYPE_MAP(field_number_of_variable_types),stat=err)
6058  IF(err/=0) CALL flagerror("Could not allocate field variable type map.",err,error,*999)
6059  DO variable_type_idx=1,field_number_of_variable_types
6060  NULLIFY(field%VARIABLE_TYPE_MAP(variable_type_idx)%PTR)
6061  ENDDO !variable_type_idx
6062  ENDIF
6063 
6064  exits("FIELD_INITIALISE")
6065  RETURN
6066 999 CALL field_finalise(field,dummy_err,dummy_error,*998)
6067 998 errorsexits("FIELD_INITIALISE",err,error)
6068  RETURN 1
6069 
6070  END SUBROUTINE field_initialise
6071 
6072  !
6073  !================================================================================================================================
6074  !
6075 
6077  SUBROUTINE field_interpolate_gauss(PARTIAL_DERIVATIVE_TYPE,QUADRATURE_SCHEME,GAUSS_POINT_NUMBER,INTERPOLATED_POINT, &
6078  & err,error,*,componenttype)
6079 
6080  !Argument variables
6081  INTEGER(INTG), INTENT(IN) :: partial_derivative_type
6082  INTEGER(INTG), INTENT(IN) :: quadrature_scheme
6083  INTEGER(INTG), INTENT(IN) :: gauss_point_number
6084  TYPE(field_interpolated_point_type), POINTER :: interpolated_point
6085  INTEGER(INTG), INTENT(OUT) :: err
6086  TYPE(varying_string), INTENT(OUT) :: error
6087  INTEGER(INTG), OPTIONAL, INTENT(IN) :: componenttype
6088  !Local Variables
6089  INTEGER(INTG) :: component_idx,ni,nu
6090  INTEGER(INTG) :: startcomponentidx,endcomponentidx
6091  TYPE(coordinate_system_type), POINTER :: coordinate_system
6092  TYPE(field_type), POINTER :: field
6093  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
6094  TYPE(varying_string) :: local_error
6095 
6096  enters("FIELD_INTERPOLATE_GAUSS",err,error,*999)
6097 
6098  IF(ASSOCIATED(interpolated_point)) THEN
6099  interpolation_parameters=>interpolated_point%INTERPOLATION_PARAMETERS
6100  IF(ASSOCIATED(interpolation_parameters)) THEN
6101  field=>interpolation_parameters%FIELD
6102  IF(ASSOCIATED(field)) THEN
6103  NULLIFY(coordinate_system)
6104  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
6105  IF(PRESENT(componenttype)) THEN
6106  SELECT CASE(componenttype)
6107  CASE(field_all_components_type)
6108  startcomponentidx=1
6109  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
6110  CASE(field_geometric_components_type)
6111  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
6112  startcomponentidx=1
6113  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(FIELD_U_VARIABLE_TYPE)%PTR% &
6114  & number_of_components
6115  ELSEIF(interpolation_parameters%FIELD%TYPE==field_geometric_type) THEN
6116  startcomponentidx=1
6117  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
6118  ELSE
6119  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
6120  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
6121  CALL flagerror(local_error,err,error,*999)
6122  ENDIF
6123  CASE(field_nongeometric_components_type)
6124  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
6125  startcomponentidx=-interpolation_parameters%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(field_u_variable_type)% &
6126  & ptr%NUMBER_OF_COMPONENTS+1
6127  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
6128  ELSE
6129  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
6130  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
6131  CALL flagerror(local_error,err,error,*999)
6132  ENDIF
6133  CASE DEFAULT
6134  local_error="Interpolation component type "//trim(number_to_vstring(componenttype,"*",err,error))//" is not valid."
6135  CALL flagerror(local_error,err,error,*999)
6136  END SELECT
6137  ELSE
6138  startcomponentidx=1
6139  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
6140  ENDIF
6141  SELECT CASE(partial_derivative_type)
6142  CASE(no_part_deriv)
6143  DO component_idx=startcomponentidx,endcomponentidx
6144  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6145  CASE(field_constant_interpolation)
6146  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
6147  CASE(field_element_based_interpolation)
6148  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
6149  CASE(field_node_based_interpolation)
6150  interpolated_point%VALUES(component_idx,1)=basis_interpolate_gauss(interpolation_parameters%BASES( &
6151  & component_idx)%PTR,no_part_deriv,quadrature_scheme,gauss_point_number,interpolation_parameters% &
6152  & parameters(:,component_idx),err,error)
6153  IF(err/=0) GOTO 999
6154  CASE(field_grid_point_based_interpolation)
6155  CALL flagerror("Not implemented.",err,error,*999)
6156  CASE(field_gauss_point_based_interpolation)
6157  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(gauss_point_number, &
6158  & component_idx)
6159  CASE DEFAULT
6160  local_error="The field component interpolation type of "//trim(number_to_vstring(interpolation_parameters% &
6161  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
6162  & " is invalid for component index "//trim(number_to_vstring(component_idx,"*",err,error))//"."
6163  END SELECT
6164  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
6165  & err,error,*999)
6166  ENDdo! component_idx
6167  interpolated_point%PARTIAL_DERIVATIVE_TYPE=no_part_deriv
6168  CASE(first_part_deriv)
6169  DO component_idx=startcomponentidx,endcomponentidx
6170  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6171  CASE(field_constant_interpolation)
6172  !Handle the first case of no partial derivative
6173  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
6174  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
6175  & err,error,*999)
6176  !Now process all the first partial derivatives
6177  DO ni=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
6178  nu=partial_derivative_first_derivative_map(ni)
6179  interpolated_point%VALUES(component_idx,nu)=0.0_dp
6180  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
6181  & err,error,*999)
6182  ENDDO !ni
6183  CASE(field_element_based_interpolation)
6184  !Handle the first case of no partial derivative
6185  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
6186  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
6187  & err,error,*999)
6188  !Now process all the first partial derivatives
6189  DO ni=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
6190  nu=partial_derivative_first_derivative_map(ni)
6191  interpolated_point%VALUES(component_idx,nu)=0.0_dp
6192  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
6193  & err,error,*999)
6194  ENDDO !ni
6195  CASE(field_node_based_interpolation)
6196  !Handle the first case of no partial derivative
6197  interpolated_point%VALUES(component_idx,1)=basis_interpolate_gauss(interpolation_parameters%BASES( &
6198  & component_idx)%PTR,no_part_deriv,quadrature_scheme,gauss_point_number,interpolation_parameters% &
6199  & parameters(:,component_idx),err,error)
6200  IF(err/=0) GOTO 999
6201  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
6202  & err,error,*999)
6203  !Now process all the first partial derivatives
6204  DO ni=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
6205  nu=partial_derivative_first_derivative_map(ni)
6206  interpolated_point%VALUES(component_idx,nu)=basis_interpolate_gauss(interpolation_parameters% &
6207  & bases(component_idx)%PTR,nu,quadrature_scheme,gauss_point_number, &
6208  & interpolation_parameters%PARAMETERS(:,component_idx),err,error)
6209  IF(err/=0) GOTO 999
6210  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
6211  & err,error,*999)
6212  ENDDO !ni
6213  CASE(field_grid_point_based_interpolation)
6214  CALL flagerror("Not implemented.",err,error,*999)
6215  CASE(field_gauss_point_based_interpolation)
6216  CALL flagerror("Not implemented.",err,error,*999)
6217  CASE DEFAULT
6218  local_error="The field component interpolation type of "//trim(number_to_vstring(interpolation_parameters% &
6219  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
6220  & " is invalid for component index "//trim(number_to_vstring(component_idx,"*",err,error))//"."
6221  END SELECT
6222  ENDdo! component_idx
6223  interpolated_point%PARTIAL_DERIVATIVE_TYPE=first_part_deriv
6224  CASE(second_part_deriv)
6225  DO component_idx=startcomponentidx,endcomponentidx
6226  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6227  CASE(field_constant_interpolation)
6228  !Handle the first case of no partial derivative
6229  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
6230  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
6231  & err,error,*999)
6232  !Now process the rest of partial derivatives
6233  DO nu=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_PARTIAL_DERIVATIVES
6234  interpolated_point%VALUES(component_idx,nu)=0.0_dp
6235  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
6236  & err,error,*999)
6237  ENDDO !nu
6238  CASE(field_element_based_interpolation)
6239  !Handle the first case of no partial derivative
6240  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
6241  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
6242  & err,error,*999)
6243  !Now process the rest of partial derivatives
6244  DO nu=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_PARTIAL_DERIVATIVES
6245  interpolated_point%VALUES(component_idx,nu)=0.0_dp
6246  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
6247  & err,error,*999)
6248  ENDDO !nu
6249  CASE(field_node_based_interpolation)
6250  DO nu=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_PARTIAL_DERIVATIVES
6251  interpolated_point%VALUES(component_idx,nu)=basis_interpolate_gauss(interpolation_parameters% &
6252  & bases(component_idx)%PTR,nu,quadrature_scheme,gauss_point_number, &
6253  & interpolation_parameters%PARAMETERS(:,component_idx),err,error)
6254  IF(err/=0) GOTO 999
6255  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
6256  & err,error,*999)
6257  ENDdo! nu
6258  CASE(field_grid_point_based_interpolation)
6259  CALL flagerror("Not implemented.",err,error,*999)
6260  CASE(field_gauss_point_based_interpolation)
6261  CALL flagerror("Not implemented.",err,error,*999)
6262  CASE DEFAULT
6263  local_error="The field component interpolation type of "//trim(number_to_vstring(interpolation_parameters% &
6264  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
6265  & " is invalid for component index "//trim(number_to_vstring(component_idx,"*",err,error))//"."
6266  END SELECT
6267  ENDDO !component_idx
6268  interpolated_point%PARTIAL_DERIVATIVE_TYPE=second_part_deriv
6269  CASE DEFAULT
6270  local_error="The partial derivative type of "//trim(number_to_vstring(partial_derivative_type,"*",err,error))// &
6271  & " is invalid."
6272  CALL flagerror(local_error,err,error,*999)
6273  END SELECT
6274  ELSE
6275  CALL flagerror("The interpolation parameters field is not associated.",err,error,*999)
6276  ENDIF
6277  ELSE
6278  CALL flagerror("Interpolated point interpolation parameters is not associated.",err,error,*999)
6279  ENDIF
6280  ELSE
6281  CALL flagerror("Interpolated point is not associated.",err,error,*999)
6282  ENDIF
6283 
6284  exits("FIELD_INTERPOLATE_GAUSS")
6285  RETURN
6286 999 errorsexits("FIELD_INTERPOLATE_GAUSS",err,error)
6287  RETURN 1
6288  END SUBROUTINE field_interpolate_gauss
6289 
6290  !
6291  !================================================================================================================================
6292  !
6293 
6295  SUBROUTINE field_interpolate_node(PHYSICAL_DERIVATIVE_TYPE,PARAMETER_SET_TYPE,COMPONENT_NUMBER,NODE_NUMBER, &
6296  & physical_point,err,error,*)
6297 
6298  !Argument variables
6299  INTEGER(INTG), INTENT(IN) :: physical_derivative_type
6300  INTEGER(INTG), INTENT(IN) :: parameter_set_type
6301  INTEGER(INTG), INTENT(IN) :: component_number
6302  INTEGER(INTG), INTENT(IN) :: node_number
6303  TYPE(field_physical_point_type), POINTER :: physical_point
6304  INTEGER(INTG), INTENT(OUT) :: err
6305  TYPE(varying_string), INTENT(OUT) :: error
6306  !Local Variables
6307  INTEGER(INTG) :: component_idx,element,elem_idx,local_node_number,local_node_idx,number_of_surrounding_elements, &
6308  & partial_deriv_idx,xi_idx
6309  REAL(DP) :: xi(3),dx_dxi(3,3),dxi_dx(3,3),det_dx_dxi
6310  TYPE(basis_type), POINTER :: basis
6311  TYPE(coordinate_system_type), POINTER :: coordinate_system
6312  TYPE(domain_type), POINTER :: domain
6313  TYPE(domain_elements_type), POINTER :: elem_topology
6314  TYPE(domain_nodes_type), POINTER :: nodes_topology
6315  TYPE(domain_topology_type), POINTER :: domain_topology
6316  TYPE(field_type), POINTER :: field
6317  TYPE(field_interpolated_point_type), POINTER :: field_interpolated_point,geometric_interpolated_point
6318  TYPE(field_interpolation_parameters_type), POINTER :: field_interpolation_parameters,geometric_interpolation_parameters
6319  TYPE(field_variable_type), POINTER :: field_variable,geometric_variable
6320  TYPE(varying_string) :: local_error
6321 
6322  enters("FIELD_INTERPOLATE_NODE",err,error,*999)
6323 
6324  IF(ASSOCIATED(physical_point)) THEN
6325  field_interpolated_point=>physical_point%FIELD_INTERPOLATED_POINT
6326  IF(ASSOCIATED(field_interpolated_point)) THEN
6327  geometric_interpolated_point=>physical_point%GEOMETRIC_INTERPOLATED_POINT
6328  IF(ASSOCIATED(geometric_interpolated_point)) THEN
6329  field_interpolation_parameters=>field_interpolated_point%INTERPOLATION_PARAMETERS
6330  IF(ASSOCIATED(field_interpolation_parameters)) THEN
6331  geometric_interpolation_parameters=>geometric_interpolated_point%INTERPOLATION_PARAMETERS
6332  IF(ASSOCIATED(geometric_interpolation_parameters)) THEN
6333  field_variable=>field_interpolation_parameters%FIELD_VARIABLE
6334  IF(ASSOCIATED(field_variable)) THEN
6335  geometric_variable=>geometric_interpolation_parameters%FIELD_VARIABLE
6336  IF(ASSOCIATED(geometric_variable)) THEN
6337  field=>field_variable%FIELD
6338  IF(ASSOCIATED(field)) THEN
6339  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
6340  IF(component_number>0.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
6341  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
6342  IF(ASSOCIATED(domain)) THEN
6343  domain_topology=>domain%TOPOLOGY
6344  IF(ASSOCIATED(domain_topology)) THEN
6345  nodes_topology=>domain_topology%NODES
6346  IF(ASSOCIATED(nodes_topology)) THEN
6347  IF(node_number>0.AND.node_number<=nodes_topology%NUMBER_OF_NODES) THEN
6348  elem_topology=>domain_topology%ELEMENTS
6349  IF(ASSOCIATED(elem_topology)) THEN
6350  physical_point%VALUES=0.0_dp
6351  IF(physical_derivative_type==no_physical_deriv) THEN
6352  number_of_surrounding_elements=1
6353  ELSE
6354  number_of_surrounding_elements=nodes_topology%NODES(node_number)% &
6355  & number_of_surrounding_elements
6356  physical_point%VALUES=0.0_dp
6357  ENDIF
6358  !Loop over the elements surrounding the node
6359  DO elem_idx=1,number_of_surrounding_elements
6360  element=nodes_topology%NODES(node_number)%SURROUNDING_ELEMENTS(elem_idx)
6361  CALL field_interpolation_parameters_element_get(parameter_set_type,element, &
6362  & field_interpolation_parameters,err,error,*999)
6363  basis=>elem_topology%ELEMENTS(element)%BASIS
6364  IF(ASSOCIATED(basis)) THEN
6365  local_node_number=0
6366  DO local_node_idx=1,basis%NUMBER_OF_NODES
6367  IF(elem_topology%ELEMENTS(element)%ELEMENT_NODES(local_node_idx)==node_number) THEN
6368  local_node_number=local_node_idx
6369  EXIT
6370  ENDIF
6371  ENDDO
6372  IF(local_node_number/=0) THEN
6373  CALL basis_local_node_xi_calculate(basis,local_node_number,xi,err,error,*999)
6374  SELECT CASE(physical_derivative_type)
6375  CASE(no_physical_deriv)
6376  DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
6377  SELECT CASE(field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6378  CASE(field_constant_interpolation)
6379  physical_point%VALUES(component_idx)=field_interpolation_parameters% &
6380  & parameters(1,component_idx)
6381  CASE(field_element_based_interpolation)
6382  physical_point%VALUES(component_idx)=field_interpolation_parameters% &
6383  & parameters(1,component_idx)
6384  CASE(field_node_based_interpolation)
6385  physical_point%VALUES(component_idx)=basis_interpolate_xi( &
6386  & field_interpolation_parameters%BASES(component_idx)%PTR,no_part_deriv, &
6387  & xi,field_interpolation_parameters%PARAMETERS(:,component_idx),err,error)
6388  IF(err/=0) GOTO 999
6389  CASE(field_grid_point_based_interpolation)
6390  CALL flagerror("Not implemented.",err,error,*999)
6391  CASE(field_gauss_point_based_interpolation)
6392  CALL flagerror("Not implemented.",err,error,*999)
6393  CASE(field_data_point_based_interpolation)
6394  CALL flagerror("Not implemented.",err,error,*999)
6395  CASE DEFAULT
6396  local_error="The field component interpolation type of "// &
6397  & trim(number_to_vstring(field_variable%COMPONENTS(component_idx)% &
6398  & interpolation_type,"*",err,error))//" is invalid for component index "// &
6399  & trim(number_to_vstring(component_idx,"*",err,error))//"."
6400  END SELECT
6401  ENDdo! component_idx
6402  physical_point%PHYSICAL_DERIVATIVE_TYPE=no_physical_deriv
6403  CASE(gradient_physical_deriv)
6404  DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
6405  SELECT CASE(field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6406  CASE(field_constant_interpolation)
6407  !There is no gradient for constant interpolation
6408  physical_point%VALUES(component_idx)=0.0_dp
6409  CASE(field_element_based_interpolation)
6410  !There is no graident for element interpolation
6411  physical_point%VALUES(component_idx)=0.0_dp
6412  CASE(field_node_based_interpolation)
6413  CALL field_interpolation_parameters_element_get(field_values_set_type,element, &
6414  & geometric_interpolation_parameters,err,error,*999)
6415  !Now process all the first partial derivatives
6416  DO xi_idx=1,field_interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
6417  partial_deriv_idx=partial_derivative_first_derivative_map(xi_idx)
6418  !Interpolate the field
6419  field_interpolated_point%VALUES(component_idx,partial_deriv_idx) = &
6420  & basis_interpolate_xi(field_interpolation_parameters%BASES(component_idx)%PTR, &
6421  & partial_deriv_idx,xi,field_interpolation_parameters%PARAMETERS(:, &
6422  & component_idx),err,error)
6423  IF(err/=0) GOTO 999
6424  CALL coordinate_interpolation_adjust(coordinate_system,partial_deriv_idx, &
6425  & field_interpolated_point%VALUES(component_idx,partial_deriv_idx),err,error,*999)
6426  geometric_interpolated_point%VALUES(component_idx,partial_deriv_idx) = &
6427  & basis_interpolate_xi(geometric_interpolation_parameters%BASES(component_idx)% &
6428  & ptr,partial_deriv_idx,xi,geometric_interpolation_parameters%PARAMETERS(:, &
6429  & component_idx),err,error)
6430  IF(err/=0) GOTO 999
6431  CALL coordinate_interpolation_adjust(coordinate_system,partial_deriv_idx, &
6432  & geometric_interpolated_point%VALUES(component_idx,partial_deriv_idx), &
6433  & err,error,*999)
6434  dx_dxi(component_idx,xi_idx)=geometric_interpolated_point% &
6435  & values(component_idx,partial_deriv_idx)
6436  ENDDO !xi_idx
6437  CASE(field_grid_point_based_interpolation)
6438  CALL flagerror("Not implemented.",err,error,*999)
6439  CASE(field_gauss_point_based_interpolation)
6440  CALL flagerror("Not implemented.",err,error,*999)
6441  CASE(field_data_point_based_interpolation)
6442  CALL flagerror("Not implemented.",err,error,*999)
6443  CASE DEFAULT
6444  local_error="The field component interpolation type of "// &
6445  & trim(number_to_vstring(field_interpolation_parameters% &
6446  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
6447  & " is invalid for component index "// &
6448  & trim(number_to_vstring(component_idx,"*",err,error))//"."
6449  END SELECT
6450  ENDdo! component_idx
6451  !Form the physical derivative
6452  CALL invert(dx_dxi,dxi_dx,det_dx_dxi,err,error,*999)
6453  DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
6454  DO xi_idx=1,field_interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
6455  partial_deriv_idx=partial_derivative_first_derivative_map(xi_idx)
6456  physical_point%VALUES(component_idx)=physical_point%VALUES(component_idx)+ &
6457  & field_interpolated_point%VALUES(component_idx,partial_deriv_idx)* &
6458  & dxi_dx(xi_idx,component_idx)
6459  ENDDO !xi_idx
6460  ENDDO !component_idx
6461  physical_point%PHYSICAL_DERIVATIVE_TYPE=gradient_physical_deriv
6462  CASE DEFAULT
6463  local_error="The physical derivative type of "// &
6464  & trim(number_to_vstring(physical_derivative_type,"*",err,error))//" is invalid."
6465  CALL flagerror(local_error,err,error,*999)
6466  END SELECT
6467  ELSE
6468  local_error="Could not find the local node for node "// &
6469  & trim(number_to_vstring(node_number,"*",err,error))//" in element number "// &
6470  & trim(number_to_vstring(element,"*",err,error))//"."
6471  CALL flagerror(local_error,err,error,*999)
6472  ENDIF
6473  ELSE
6474  local_error="The basis for element "//trim(number_to_vstring(element,"*",err,error))// &
6475  & " is not associated."
6476  CALL flagerror(local_error,err,error,*999)
6477  ENDIF
6478  ENDDO !elem_idx
6479  IF(physical_derivative_type==no_physical_deriv) THEN
6480  !Now calculate the average of the interpolated physical point
6481  DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
6482  SELECT CASE(field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6483  CASE(field_constant_interpolation)
6484  !Do nothing
6485  CASE(field_element_based_interpolation)
6486  !Do nothing
6487  CASE(field_node_based_interpolation)
6488  physical_point%VALUES(component_idx)=physical_point%VALUES(component_idx)/ &
6489  & REAL(number_of_surrounding_elements,dp)
6490  CASE(field_grid_point_based_interpolation)
6491  CALL flagerror("Not implemented.",err,error,*999)
6492  CASE(field_gauss_point_based_interpolation)
6493  CALL flagerror("Not implemented.",err,error,*999)
6494  CASE(field_data_point_based_interpolation)
6495  CALL flagerror("Not implemented.",err,error,*999)
6496  CASE DEFAULT
6497  local_error="The field component interpolation type of "// &
6498  & trim(number_to_vstring(field_interpolation_parameters% &
6499  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
6500  & " is invalid for component index "// &
6501  & trim(number_to_vstring(component_idx,"*",err,error))//"."
6502  END SELECT
6503  ENDDO !component_idx
6504  ENDIF
6505  ELSE
6506  CALL flagerror("Domain element topology is not associated.",err,error,*999)
6507  ENDIF
6508  ELSE
6509  local_error="The specified node number of "//trim(number_to_vstring(node_number,"*",err,error))// &
6510  & " is invalid. The node number needs to be > 0 and <= "// &
6511  & trim(number_to_vstring(nodes_topology%NUMBER_OF_NODES,"*",err,error))//"."
6512  CALL flagerror(local_error,err,error,*999)
6513  ENDIF
6514  ELSE
6515  CALL flagerror("Nodes topology is not associated.",err,error,*999)
6516  ENDIF
6517  ELSE
6518  CALL flagerror("Domain topology is not associated.",err,error,*999)
6519  ENDIF
6520  ELSE
6521  CALL flagerror("Domain is not associated.",err,error,*999)
6522  ENDIF
6523  ELSE
6524  local_error="The specified component number of "//trim(number_to_vstring(component_number,"*",err,error))// &
6525  & " is invalid. The component number must be > 0 and <= "// &
6526  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//"."
6527  CALL flagerror(local_error,err,error,*999)
6528  ENDIF
6529  ELSE
6530  CALL flagerror("The field variable field is not associated.",err,error,*999)
6531  ENDIF
6532  ELSE
6533  CALL flagerror("The geometric interpolation parameters field variable is not associated.",err,error,*999)
6534  ENDIF
6535  ELSE
6536  CALL flagerror("The field interpolation parameters field variable is not associated.",err,error,*999)
6537  ENDIF
6538  ELSE
6539  CALL flagerror("Geometric interpolated point interpolation parameters is not associated.",err,error,*999)
6540  ENDIF
6541  ELSE
6542  CALL flagerror("Field interpolated point interpolation parameters is not associated.",err,error,*999)
6543  ENDIF
6544  ELSE
6545  CALL flagerror("Physical point geometric interpolated point is not associated.",err,error,*999)
6546  ENDIF
6547  ELSE
6548  CALL flagerror("Physical point field interpolated point is not associated.",err,error,*999)
6549  ENDIF
6550  ELSE
6551  CALL flagerror("Physical point is not associated.",err,error,*999)
6552  ENDIF
6553 
6554  exits("FIELD_INTERPOLATE_NODE")
6555  RETURN
6556 999 errorsexits("FIELD_INTERPOLATE_NODE",err,error)
6557  RETURN 1
6558 
6559  END SUBROUTINE field_interpolate_node
6560 
6561  !
6562  !================================================================================================================================
6563  !
6564 
6566  SUBROUTINE field_interpolate_field_node(PHYSICAL_DERIVATIVE_TYPE,PARAMETER_SET_TYPE,FIELD,VARIABLE_TYPE,COMPONENT_NUMBER, &
6567  & node_number,physical_point,err,error,*)
6568 
6569  !Argument variables
6570  INTEGER(INTG), INTENT(IN) :: physical_derivative_type
6571  INTEGER(INTG), INTENT(IN) :: parameter_set_type
6572  TYPE(field_type), POINTER :: field
6573  INTEGER(INTG), INTENT(IN) :: variable_type
6574  INTEGER(INTG), INTENT(IN) :: component_number
6575  INTEGER(INTG), INTENT(IN) :: node_number
6576  TYPE(field_physical_point_type), POINTER :: physical_point
6577  INTEGER(INTG), INTENT(OUT) :: err
6578  TYPE(varying_string), INTENT(OUT) :: error
6579  !Local Variables
6580  INTEGER(INTG) :: component_idx,element,elem_idx,local_node_number,local_node_idx,number_of_surrounding_elements, &
6581  & partial_deriv_idx,xi_idx
6582  REAL(DP) :: xi(3),dx_dxi(3,3),dxi_dx(3,3),det_dx_dxi
6583  TYPE(basis_type), POINTER :: basis
6584  TYPE(coordinate_system_type), POINTER :: coordinate_system
6585  TYPE(domain_type), POINTER :: domain
6586  TYPE(domain_elements_type), POINTER :: elem_topology
6587  TYPE(domain_nodes_type), POINTER :: nodes_topology
6588  TYPE(domain_topology_type), POINTER :: domain_topology
6589  TYPE(field_type), POINTER :: interp_field
6590  TYPE(field_interpolated_point_type), POINTER :: field_interpolated_point,geometric_interpolated_point
6591  TYPE(field_interpolation_parameters_type), POINTER :: field_interpolation_parameters,geometric_interpolation_parameters
6592  TYPE(field_variable_type), POINTER :: field_variable,interp_variable,geometric_variable
6593  TYPE(varying_string) :: local_error
6594 
6595  enters("FIELD_INTERPOLATE_FIELD_NODE",err,error,*999)
6596 
6597  IF(ASSOCIATED(physical_point)) THEN
6598  field_interpolated_point=>physical_point%FIELD_INTERPOLATED_POINT
6599  IF(ASSOCIATED(field_interpolated_point)) THEN
6600  geometric_interpolated_point=>physical_point%GEOMETRIC_INTERPOLATED_POINT
6601  IF(ASSOCIATED(geometric_interpolated_point)) THEN
6602  field_interpolation_parameters=>field_interpolated_point%INTERPOLATION_PARAMETERS
6603  IF(ASSOCIATED(field_interpolation_parameters)) THEN
6604  geometric_interpolation_parameters=>geometric_interpolated_point%INTERPOLATION_PARAMETERS
6605  IF(ASSOCIATED(geometric_interpolation_parameters)) THEN
6606  interp_variable=>field_interpolation_parameters%FIELD_VARIABLE
6607  IF(ASSOCIATED(interp_variable)) THEN
6608  geometric_variable=>geometric_interpolation_parameters%FIELD_VARIABLE
6609  IF(ASSOCIATED(geometric_variable)) THEN
6610  interp_field=>interp_variable%FIELD
6611  IF(ASSOCIATED(interp_field)) THEN
6612  NULLIFY(coordinate_system)
6613  CALL field_coordinate_system_get(interp_field,coordinate_system,err,error,*999)
6614  IF(ASSOCIATED(field)) THEN
6615  NULLIFY(field_variable)
6616  CALL field_variable_get(field,variable_type,field_variable,err,error,*999)
6617  IF(component_number>0.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
6618  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
6619  IF(ASSOCIATED(domain)) THEN
6620  domain_topology=>domain%TOPOLOGY
6621  IF(ASSOCIATED(domain_topology)) THEN
6622  nodes_topology=>domain_topology%NODES
6623  IF(ASSOCIATED(nodes_topology)) THEN
6624  IF(node_number>0.AND.node_number<=nodes_topology%NUMBER_OF_NODES) THEN
6625  elem_topology=>domain_topology%ELEMENTS
6626  IF(ASSOCIATED(elem_topology)) THEN
6627  physical_point%VALUES=0.0_dp
6628  IF(physical_derivative_type==no_physical_deriv) THEN
6629  number_of_surrounding_elements=1
6630  ELSE
6631  number_of_surrounding_elements=nodes_topology%NODES(node_number)% &
6632  & number_of_surrounding_elements
6633  physical_point%VALUES=0.0_dp
6634  ENDIF
6635  !Loop over the elements surrounding the node
6636  DO elem_idx=1,number_of_surrounding_elements
6637  element=nodes_topology%NODES(node_number)%SURROUNDING_ELEMENTS(elem_idx)
6638  CALL field_interpolation_parameters_element_get(parameter_set_type,element, &
6639  & field_interpolation_parameters,err,error,*999)
6640  basis=>elem_topology%ELEMENTS(element)%BASIS
6641  IF(ASSOCIATED(basis)) THEN
6642  local_node_number=0
6643  DO local_node_idx=1,basis%NUMBER_OF_NODES
6644  IF(elem_topology%ELEMENTS(element)%ELEMENT_NODES(local_node_idx)==node_number) THEN
6645  local_node_number=local_node_idx
6646  EXIT
6647  ENDIF
6648  ENDDO
6649  IF(local_node_number/=0) THEN
6650  CALL basis_local_node_xi_calculate(basis,local_node_number,xi,err,error,*999)
6651  SELECT CASE(physical_derivative_type)
6652  CASE(no_physical_deriv)
6653  DO component_idx=1,interp_variable%NUMBER_OF_COMPONENTS
6654  SELECT CASE(interp_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6655  CASE(field_constant_interpolation)
6656  physical_point%VALUES(component_idx)=field_interpolation_parameters% &
6657  & parameters(1,component_idx)
6658  CASE(field_element_based_interpolation)
6659  physical_point%VALUES(component_idx)=field_interpolation_parameters% &
6660  & parameters(1,component_idx)
6661  CASE(field_node_based_interpolation)
6662  physical_point%VALUES(component_idx)=basis_interpolate_xi( &
6663  & field_interpolation_parameters%BASES(component_idx)%PTR,no_part_deriv, &
6664  & xi,field_interpolation_parameters%PARAMETERS(:,component_idx),err,error)
6665  IF(err/=0) GOTO 999
6666  CASE(field_grid_point_based_interpolation)
6667  CALL flagerror("Not implemented.",err,error,*999)
6668  CASE(field_gauss_point_based_interpolation)
6669  CALL flagerror("Not implemented.",err,error,*999)
6670  CASE(field_data_point_based_interpolation)
6671  CALL flagerror("Not implemented.",err,error,*999)
6672  CASE DEFAULT
6673  local_error="The field component interpolation type of "// &
6674  & trim(number_to_vstring(interp_variable%COMPONENTS(component_idx)% &
6675  & interpolation_type,"*",err,error))//" is invalid for component index "// &
6676  & trim(number_to_vstring(component_idx,"*",err,error))//"."
6677  END SELECT
6678  ENDdo! component_idx
6679  physical_point%PHYSICAL_DERIVATIVE_TYPE=no_physical_deriv
6680  CASE(gradient_physical_deriv)
6681  DO component_idx=1,interp_variable%NUMBER_OF_COMPONENTS
6682  SELECT CASE(interp_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6683  CASE(field_constant_interpolation)
6684  !There is no gradient for constant interpolation
6685  physical_point%VALUES(component_idx)=0.0_dp
6686  CASE(field_element_based_interpolation)
6687  !There is no graident for element interpolation
6688  physical_point%VALUES(component_idx)=0.0_dp
6689  CASE(field_node_based_interpolation)
6690  CALL field_interpolation_parameters_element_get(field_values_set_type,element, &
6691  & geometric_interpolation_parameters,err,error,*999)
6692  !Now process all the first partial derivatives
6693  DO xi_idx=1,field_interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
6694  partial_deriv_idx=partial_derivative_first_derivative_map(xi_idx)
6695  !Interpolate the field
6696  field_interpolated_point%VALUES(component_idx,partial_deriv_idx) = &
6697  & basis_interpolate_xi(field_interpolation_parameters%BASES(component_idx)%PTR, &
6698  & partial_deriv_idx,xi,field_interpolation_parameters%PARAMETERS(:, &
6699  & component_idx),err,error)
6700  IF(err/=0) GOTO 999
6701  CALL coordinate_interpolation_adjust(coordinate_system,partial_deriv_idx, &
6702  & field_interpolated_point%VALUES(component_idx,partial_deriv_idx),err,error,*999)
6703  geometric_interpolated_point%VALUES(component_idx,partial_deriv_idx) = &
6704  & basis_interpolate_xi(geometric_interpolation_parameters%BASES(component_idx)% &
6705  & ptr,partial_deriv_idx,xi,geometric_interpolation_parameters%PARAMETERS(:, &
6706  & component_idx),err,error)
6707  IF(err/=0) GOTO 999
6708  CALL coordinate_interpolation_adjust(coordinate_system,partial_deriv_idx, &
6709  & geometric_interpolated_point%VALUES(component_idx,partial_deriv_idx), &
6710  & err,error,*999)
6711  dx_dxi(component_idx,xi_idx)=geometric_interpolated_point% &
6712  & values(component_idx,partial_deriv_idx)
6713  ENDDO !xi_idx
6714  CASE(field_grid_point_based_interpolation)
6715  CALL flagerror("Not implemented.",err,error,*999)
6716  CASE(field_gauss_point_based_interpolation)
6717  CALL flagerror("Not implemented.",err,error,*999)
6718  CASE(field_data_point_based_interpolation)
6719  CALL flagerror("Not implemented.",err,error,*999)
6720  CASE DEFAULT
6721  local_error="The field component interpolation type of "// &
6722  & trim(number_to_vstring(field_interpolation_parameters% &
6723  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
6724  & " is invalid for component index "// &
6725  & trim(number_to_vstring(component_idx,"*",err,error))//"."
6726  END SELECT
6727  ENDdo! component_idx
6728  !Form the physical derivative
6729  CALL invert(dx_dxi,dxi_dx,det_dx_dxi,err,error,*999)
6730  DO component_idx=1,interp_variable%NUMBER_OF_COMPONENTS
6731  DO xi_idx=1,field_interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
6732  partial_deriv_idx=partial_derivative_first_derivative_map(xi_idx)
6733  physical_point%VALUES(component_idx)=physical_point%VALUES(component_idx)+ &
6734  & field_interpolated_point%VALUES(component_idx,partial_deriv_idx)* &
6735  & dxi_dx(xi_idx,component_idx)
6736  ENDDO !xi_idx
6737  ENDDO !component_idx
6738  physical_point%PHYSICAL_DERIVATIVE_TYPE=gradient_physical_deriv
6739  CASE DEFAULT
6740  local_error="The physical derivative type of "// &
6741  & trim(number_to_vstring(physical_derivative_type,"*",err,error))//" is invalid."
6742  CALL flagerror(local_error,err,error,*999)
6743  END SELECT
6744  ELSE
6745  local_error="Could not find the local node for node "// &
6746  & trim(number_to_vstring(node_number,"*",err,error))//" in element number "// &
6747  & trim(number_to_vstring(element,"*",err,error))//"."
6748  CALL flagerror(local_error,err,error,*999)
6749  ENDIF
6750  ELSE
6751  local_error="The basis for element "//trim(number_to_vstring(element,"*",err,error))// &
6752  & " is not associated."
6753  CALL flagerror(local_error,err,error,*999)
6754  ENDIF
6755  ENDDO !elem_idx
6756  IF(physical_derivative_type==no_physical_deriv) THEN
6757  !Now calculate the average of the interpolated physical point
6758  DO component_idx=1,interp_variable%NUMBER_OF_COMPONENTS
6759  SELECT CASE(interp_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6760  CASE(field_constant_interpolation)
6761  !Do nothing
6762  CASE(field_element_based_interpolation)
6763  !Do nothing
6764  CASE(field_node_based_interpolation)
6765  physical_point%VALUES(component_idx)=physical_point%VALUES(component_idx)/ &
6766  & REAL(number_of_surrounding_elements,dp)
6767  CASE(field_grid_point_based_interpolation)
6768  CALL flagerror("Not implemented.",err,error,*999)
6769  CASE(field_gauss_point_based_interpolation)
6770  CALL flagerror("Not implemented.",err,error,*999)
6771  CASE(field_data_point_based_interpolation)
6772  CALL flagerror("Not implemented.",err,error,*999)
6773  CASE DEFAULT
6774  local_error="The field component interpolation type of "// &
6775  & trim(number_to_vstring(interp_variable%COMPONENTS(component_idx)% &
6776  & interpolation_type,"*",err,error))// &
6777  & " is invalid for component index "// &
6778  & trim(number_to_vstring(component_idx,"*",err,error))//"."
6779  END SELECT
6780  ENDDO !component_idx
6781  ENDIF
6782  ELSE
6783  CALL flagerror("Domain element topology is not associated.",err,error,*999)
6784  ENDIF
6785  ELSE
6786  local_error="The specified node number of "//trim(number_to_vstring(node_number,"*",err,error))// &
6787  & " is invalid. The node number needs to be > 0 and <= "// &
6788  & trim(number_to_vstring(nodes_topology%NUMBER_OF_NODES,"*",err,error))//"."
6789  CALL flagerror(local_error,err,error,*999)
6790  ENDIF
6791  ELSE
6792  CALL flagerror("Nodes topology is not associated.",err,error,*999)
6793  ENDIF
6794  ELSE
6795  CALL flagerror("Domain topology is not associated.",err,error,*999)
6796  ENDIF
6797  ELSE
6798  CALL flagerror("Domain is not associated.",err,error,*999)
6799  ENDIF
6800  ELSE
6801  local_error="The specified component number of "// &
6802  & trim(number_to_vstring(component_number,"*",err,error))// &
6803  & " is invalid. The component number must be > 0 and <= "// &
6804  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//"."
6805  CALL flagerror(local_error,err,error,*999)
6806  ENDIF
6807  ELSE
6808  CALL flagerror("Field is not associated.",err,error,*999)
6809  ENDIF
6810  ELSE
6811  CALL flagerror("The field variable field is not associated.",err,error,*999)
6812  ENDIF
6813  ELSE
6814  CALL flagerror("The geometric interpolation parameters field variable is not associated.",err,error,*999)
6815  ENDIF
6816  ELSE
6817  CALL flagerror("The field interpolation parameters field variable is not associated.",err,error,*999)
6818  ENDIF
6819  ELSE
6820  CALL flagerror("Geometric interpolated point interpolation parameters is not associated.",err,error,*999)
6821  ENDIF
6822  ELSE
6823  CALL flagerror("Field interpolated point interpolation parameters is not associated.",err,error,*999)
6824  ENDIF
6825  ELSE
6826  CALL flagerror("Physical point geometric interpolated point is not associated.",err,error,*999)
6827  ENDIF
6828  ELSE
6829  CALL flagerror("Physical point field interpolated point is not associated.",err,error,*999)
6830  ENDIF
6831  ELSE
6832  CALL flagerror("Physical point is not associated.",err,error,*999)
6833  ENDIF
6834 
6835  exits("FIELD_INTERPOLATE_FIELD_NODE")
6836  RETURN
6837 999 errorsexits("FIELD_INTERPOLATE_FIELD_NODE",err,error)
6838  RETURN 1
6839 
6840  END SUBROUTINE field_interpolate_field_node
6841 
6842  !
6843  !================================================================================================================================
6844  !
6845 
6847  SUBROUTINE field_interpolate_local_face_gauss(PARTIAL_DERIVATIVE_TYPE,QUADRATURE_SCHEME,LOCAL_FACE_NUMBER, &
6848  & gauss_point_number,interpolated_point,err,error,*,componenttype)
6849 
6850  !Argument variables
6851  INTEGER(INTG), INTENT(IN) :: partial_derivative_type
6852  INTEGER(INTG), INTENT(IN) :: quadrature_scheme
6853  INTEGER(INTG), INTENT(IN) :: local_face_number
6854  INTEGER(INTG), INTENT(IN) :: gauss_point_number
6855  TYPE(field_interpolated_point_type), POINTER :: interpolated_point
6856  INTEGER(INTG), INTENT(OUT) :: err
6857  TYPE(varying_string), INTENT(OUT) :: error
6858  INTEGER(INTG), OPTIONAL, INTENT(IN) :: componenttype
6859  !Local Variables
6860  INTEGER(INTG) :: component_idx,ni,nu,startcomponentidx,endcomponentidx
6861  TYPE(coordinate_system_type), POINTER :: coordinate_system
6862  TYPE(field_type), POINTER :: field
6863  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
6864  TYPE(varying_string) :: local_error
6865 
6866  enters("FIELD_INTERPOLATE_LOCAL_FACE_GAUSS",err,error,*999)
6867 
6868  IF(ASSOCIATED(interpolated_point)) THEN
6869  interpolation_parameters=>interpolated_point%INTERPOLATION_PARAMETERS
6870  IF(ASSOCIATED(interpolation_parameters)) THEN
6871  field=>interpolation_parameters%FIELD
6872  IF(ASSOCIATED(field)) THEN
6873  NULLIFY(coordinate_system)
6874  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
6875  IF(PRESENT(componenttype)) THEN
6876  SELECT CASE(componenttype)
6877  CASE(field_all_components_type)
6878  startcomponentidx=1
6879  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
6880  CASE(field_geometric_components_type)
6881  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
6882  startcomponentidx=1
6883  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(FIELD_U_VARIABLE_TYPE)%PTR% &
6884  & number_of_components
6885  ELSEIF(interpolation_parameters%FIELD%TYPE==field_geometric_type) THEN
6886  startcomponentidx=1
6887  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
6888  ELSE
6889  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
6890  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
6891  CALL flagerror(local_error,err,error,*999)
6892  ENDIF
6893  CASE(field_nongeometric_components_type)
6894  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
6895  startcomponentidx=-interpolation_parameters%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(field_u_variable_type)% &
6896  & ptr%NUMBER_OF_COMPONENTS+1
6897  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
6898  ELSE
6899  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
6900  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
6901  CALL flagerror(local_error,err,error,*999)
6902  ENDIF
6903  CASE DEFAULT
6904  local_error="Interpolation component type "//trim(number_to_vstring(componenttype,"*",err,error))//" is not valid."
6905  CALL flagerror(local_error,err,error,*999)
6906  END SELECT
6907  ELSE
6908  startcomponentidx=1
6909  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
6910  ENDIF
6911  SELECT CASE(partial_derivative_type)
6912  CASE(no_part_deriv)
6913  DO component_idx=startcomponentidx,endcomponentidx
6914  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6915  CASE(field_constant_interpolation)
6916  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
6917  CASE(field_element_based_interpolation)
6918  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
6919  CASE(field_node_based_interpolation)
6920 ! INTERPOLATED_POINT%VALUES(component_idx,1)=BASIS_INTERPOLATE_GAUSS(INTERPOLATION_PARAMETERS%BASES( &
6921 ! & component_idx)%PTR,NO_PART_DERIV,QUADRATURE_SCHEME,GAUSS_POINT_NUMBER,INTERPOLATION_PARAMETERS% &
6922 ! & PARAMETERS(:,component_idx),ERR,ERROR)
6923  interpolated_point%VALUES(component_idx,1)=basis_interpolate_local_face_gauss(interpolation_parameters%BASES( &
6924  & component_idx)%PTR,no_part_deriv,quadrature_scheme,local_face_number,gauss_point_number, &
6925  & interpolation_parameters%PARAMETERS(:,component_idx),err,error)
6926  IF(err/=0) GOTO 999
6927  CASE(field_grid_point_based_interpolation)
6928  CALL flagerror("Not implemented.",err,error,*999)
6929  CASE(field_gauss_point_based_interpolation)
6930  CALL flagerror("Not implemented.",err,error,*999)
6931  CASE(field_data_point_based_interpolation)
6932  CALL flagerror("Not implemented.",err,error,*999)
6933  CASE DEFAULT
6934  local_error="The field component interpolation type of "//trim(number_to_vstring(interpolation_parameters% &
6935  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
6936  & " is invalid for component index "//trim(number_to_vstring(component_idx,"*",err,error))//"."
6937  END SELECT
6938  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
6939  & err,error,*999)
6940  ENDdo! component_idx
6941  interpolated_point%PARTIAL_DERIVATIVE_TYPE=no_part_deriv
6942  CASE(first_part_deriv)
6943  DO component_idx=startcomponentidx,endcomponentidx
6944  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
6945  CASE(field_constant_interpolation)
6946  !Handle the first case of no partial derivative
6947  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
6948  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
6949  & err,error,*999)
6950  !Now process all the first partial derivatives
6951  DO ni=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
6952  nu=partial_derivative_first_derivative_map(ni)
6953  interpolated_point%VALUES(component_idx,nu)=0.0_dp
6954  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
6955  & err,error,*999)
6956  ENDDO !ni
6957  CASE(field_element_based_interpolation)
6958  !Handle the first case of no partial derivative
6959  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
6960  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
6961  & err,error,*999)
6962  !Now process all the first partial derivatives
6963  DO ni=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
6964  nu=partial_derivative_first_derivative_map(ni)
6965  interpolated_point%VALUES(component_idx,nu)=0.0_dp
6966  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
6967  & err,error,*999)
6968  ENDDO !ni
6969  CASE(field_node_based_interpolation)
6970  !Handle the first case of no partial derivative
6971 ! INTERPOLATED_POINT%VALUES(component_idx,1)=BASIS_INTERPOLATE_GAUSS(INTERPOLATION_PARAMETERS%BASES( &
6972 ! & component_idx)%PTR,NO_PART_DERIV,QUADRATURE_SCHEME,GAUSS_POINT_NUMBER,INTERPOLATION_PARAMETERS% &
6973 ! & PARAMETERS(:,component_idx),ERR,ERROR)
6974  interpolated_point%VALUES(component_idx,1)=basis_interpolate_local_face_gauss(interpolation_parameters%BASES( &
6975  & component_idx)%PTR,no_part_deriv,quadrature_scheme,local_face_number,gauss_point_number, &
6976  & interpolation_parameters%PARAMETERS(:,component_idx),err,error)
6977  IF(err/=0) GOTO 999
6978  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
6979  & err,error,*999)
6980  !Now process all the first partial derivatives
6981  DO ni=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
6982  nu=partial_derivative_first_derivative_map(ni)
6983 ! INTERPOLATED_POINT%VALUES(component_idx,nu)=BASIS_INTERPOLATE_GAUSS(INTERPOLATION_PARAMETERS% &
6984 ! & BASES(component_idx)%PTR,nu,QUADRATURE_SCHEME,GAUSS_POINT_NUMBER, &
6985 ! & INTERPOLATION_PARAMETERS%PARAMETERS(:,component_idx),ERR,ERROR)
6986  interpolated_point%VALUES(component_idx,nu)=basis_interpolate_local_face_gauss(interpolation_parameters%BASES( &
6987  & component_idx)%PTR,nu,quadrature_scheme,local_face_number,gauss_point_number, &
6988  & interpolation_parameters%PARAMETERS(:,component_idx),err,error)
6989  IF(err/=0) GOTO 999
6990  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
6991  & err,error,*999)
6992  ENDDO !ni
6993  CASE(field_grid_point_based_interpolation)
6994  CALL flagerror("Not implemented.",err,error,*999)
6995  CASE(field_gauss_point_based_interpolation)
6996  CALL flagerror("Not implemented.",err,error,*999)
6997  CASE(field_data_point_based_interpolation)
6998  CALL flagerror("Not implemented.",err,error,*999)
6999  CASE DEFAULT
7000  local_error="The field component interpolation type of "//trim(number_to_vstring(interpolation_parameters% &
7001  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
7002  & " is invalid for component index "//trim(number_to_vstring(component_idx,"*",err,error))//"."
7003  END SELECT
7004  ENDdo! component_idx
7005  interpolated_point%PARTIAL_DERIVATIVE_TYPE=first_part_deriv
7006  CASE(second_part_deriv)
7007  DO component_idx=startcomponentidx,endcomponentidx
7008  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
7009  CASE(field_constant_interpolation)
7010  !Handle the first case of no partial derivative
7011  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
7012  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
7013  & err,error,*999)
7014  !Now process the rest of partial derivatives
7015  DO nu=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_PARTIAL_DERIVATIVES
7016  interpolated_point%VALUES(component_idx,nu)=0.0_dp
7017  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
7018  & err,error,*999)
7019  ENDDO !nu
7020  CASE(field_element_based_interpolation)
7021  !Handle the first case of no partial derivative
7022  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
7023  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
7024  & err,error,*999)
7025  !Now process the rest of partial derivatives
7026  DO nu=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_PARTIAL_DERIVATIVES
7027  interpolated_point%VALUES(component_idx,nu)=0.0_dp
7028  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
7029  & err,error,*999)
7030  ENDDO !nu
7031  CASE(field_node_based_interpolation)
7032  DO nu=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_PARTIAL_DERIVATIVES
7033 ! INTERPOLATED_POINT%VALUES(component_idx,nu)=BASIS_INTERPOLATE_GAUSS(INTERPOLATION_PARAMETERS% &
7034 ! & BASES(component_idx)%PTR,nu,QUADRATURE_SCHEME,GAUSS_POINT_NUMBER, &
7035 ! & INTERPOLATION_PARAMETERS%PARAMETERS(:,component_idx),ERR,ERROR)
7036  interpolated_point%VALUES(component_idx,nu)=basis_interpolate_local_face_gauss(interpolation_parameters%BASES( &
7037  & component_idx)%PTR,nu,quadrature_scheme,local_face_number,gauss_point_number, &
7038  & interpolation_parameters%PARAMETERS(:,component_idx),err,error)
7039  IF(err/=0) GOTO 999
7040  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
7041  & err,error,*999)
7042  ENDdo! nu
7043  CASE(field_grid_point_based_interpolation)
7044  CALL flagerror("Not implemented.",err,error,*999)
7045  CASE(field_gauss_point_based_interpolation)
7046  CALL flagerror("Not implemented.",err,error,*999)
7047  CASE(field_data_point_based_interpolation)
7048  CALL flagerror("Not implemented.",err,error,*999)
7049  CASE DEFAULT
7050  local_error="The field component interpolation type of "//trim(number_to_vstring(interpolation_parameters% &
7051  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
7052  & " is invalid for component index "//trim(number_to_vstring(component_idx,"*",err,error))//"."
7053  END SELECT
7054  ENDDO !component_idx
7055  interpolated_point%PARTIAL_DERIVATIVE_TYPE=second_part_deriv
7056  CASE DEFAULT
7057  local_error="The partial derivative type of "//trim(number_to_vstring(partial_derivative_type,"*",err,error))// &
7058  & " is invalid."
7059  CALL flagerror(local_error,err,error,*999)
7060  END SELECT
7061  ELSE
7062  CALL flagerror("The interpolation parameters field is not associated.",err,error,*999)
7063  ENDIF
7064  ELSE
7065  CALL flagerror("Interpolated point interpolation parameters is not associated.",err,error,*999)
7066  ENDIF
7067  ELSE
7068  CALL flagerror("Interpolated point is not associated.",err,error,*999)
7069  ENDIF
7070 
7071  exits("FIELD_INTERPOLATE_LOCAL_FACE_GAUSS")
7072  RETURN
7073 999 errorsexits("FIELD_INTERPOLATE_LOCAL_FACE_GAUSS",err,error)
7074  RETURN 1
7075  END SUBROUTINE field_interpolate_local_face_gauss
7076 
7077  !
7078  !================================================================================================================================
7079  !
7080 
7082  SUBROUTINE field_interpolate_xi(PARTIAL_DERIVATIVE_TYPE,XI,INTERPOLATED_POINT,ERR,ERROR,*,componentType)
7083 
7084  !Argument variables
7085  INTEGER(INTG), INTENT(IN) :: partial_derivative_type
7086  REAL(DP), INTENT(IN) :: xi(:)
7087  TYPE(field_interpolated_point_type), POINTER :: interpolated_point
7088  INTEGER(INTG), INTENT(OUT) :: err
7089  TYPE(varying_string), INTENT(OUT) :: error
7090  INTEGER(INTG), OPTIONAL, INTENT(IN) :: componenttype
7091  !Local Variables
7092  INTEGER(INTG) :: component_idx,ni,nu,startcomponentidx,endcomponentidx
7093  TYPE(coordinate_system_type), POINTER :: coordinate_system
7094  TYPE(field_type), POINTER :: field
7095  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
7096  TYPE(varying_string) :: local_error
7097 
7098  enters("FIELD_INTERPOLATE_XI",err,error,*999)
7099 
7100  IF(ASSOCIATED(interpolated_point)) THEN
7101  interpolation_parameters=>interpolated_point%INTERPOLATION_PARAMETERS
7102  IF(ASSOCIATED(interpolation_parameters)) THEN
7103  !!TODO: Fix this check. You can have less Xi directions than the mesh number of dimensions e.g., interpolating a line
7104  !IF(SIZE(XI,1)>=INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%MESH%NUMBER_OF_DIMENSIONS) THEN
7105  field=>interpolation_parameters%FIELD
7106  IF(ASSOCIATED(field)) THEN
7107  NULLIFY(coordinate_system)
7108  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
7109  IF(PRESENT(componenttype)) THEN
7110  SELECT CASE(componenttype)
7111  CASE(field_all_components_type)
7112  startcomponentidx=1
7113  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
7114  CASE(field_geometric_components_type)
7115  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
7116  startcomponentidx=1
7117  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(FIELD_U_VARIABLE_TYPE)%PTR% &
7118  & number_of_components
7119  ELSEIF(interpolation_parameters%FIELD%TYPE==field_geometric_type) THEN
7120  startcomponentidx=1
7121  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
7122  ELSE
7123  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
7124  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
7125  CALL flagerror(local_error,err,error,*999)
7126  ENDIF
7127  CASE(field_nongeometric_components_type)
7128  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
7129  startcomponentidx=-interpolation_parameters%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(field_u_variable_type)% &
7130  & ptr%NUMBER_OF_COMPONENTS+1
7131  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
7132  ELSE
7133  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
7134  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
7135  CALL flagerror(local_error,err,error,*999)
7136  ENDIF
7137  CASE DEFAULT
7138  local_error="Interpolation component type "//trim(number_to_vstring(componenttype,"*",err,error))//" is not valid."
7139  CALL flagerror(local_error,err,error,*999)
7140  END SELECT
7141  ELSE
7142  startcomponentidx=1
7143  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
7144  ENDIF
7145  SELECT CASE(partial_derivative_type)
7146  CASE(no_part_deriv)
7147  DO component_idx=startcomponentidx,endcomponentidx
7148  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
7149  CASE(field_constant_interpolation)
7150  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
7151  CASE(field_element_based_interpolation)
7152  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
7153  CASE(field_node_based_interpolation)
7154  interpolated_point%VALUES(component_idx,1)=basis_interpolate_xi(interpolation_parameters% &
7155  & bases(component_idx)%PTR,no_part_deriv,xi,interpolation_parameters%PARAMETERS(:,component_idx),err,error)
7156  IF(err/=0) GOTO 999
7157  CASE(field_grid_point_based_interpolation)
7158  CALL flagerror("Not implemented.",err,error,*999)
7159  CASE(field_gauss_point_based_interpolation)
7160  CALL flagerror("Not implemented.",err,error,*999)
7161  CASE(field_data_point_based_interpolation)
7162  CALL flagerror("Not implemented.",err,error,*999)
7163  CASE DEFAULT
7164  local_error="The field component interpolation type of "//trim(number_to_vstring(interpolation_parameters% &
7165  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
7166  & " is invalid for component index "//trim(number_to_vstring(component_idx,"*",err,error))//"."
7167  END SELECT
7168  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
7169  & err,error,*999)
7170  ENDDO !component_idx
7171  interpolated_point%PARTIAL_DERIVATIVE_TYPE=no_part_deriv
7172  CASE(first_part_deriv)
7173  DO component_idx=startcomponentidx,endcomponentidx
7174  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
7175  CASE(field_constant_interpolation)
7176  !Handle the first case of no partial derivative
7177  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
7178  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
7179  & err,error,*999)
7180  !Now process all the first partial derivatives
7181  DO ni=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
7182  nu=partial_derivative_first_derivative_map(ni)
7183  interpolated_point%VALUES(component_idx,nu)=0.0_dp
7184  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
7185  & err,error,*999)
7186  ENDDO !ni
7187  CASE(field_element_based_interpolation)
7188  !Handle the first case of no partial derivative
7189  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
7190  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
7191  & err,error,*999)
7192  !Now process all the first partial derivatives
7193  DO ni=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
7194  nu=partial_derivative_first_derivative_map(ni)
7195  interpolated_point%VALUES(component_idx,nu)=0.0_dp
7196  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
7197  & err,error,*999)
7198  ENDDO !ni
7199  CASE(field_node_based_interpolation)
7200  !Handle the first case of no partial derivative
7201  interpolated_point%VALUES(component_idx,1)=basis_interpolate_xi(interpolation_parameters% &
7202  & bases(component_idx)%PTR,no_part_deriv,xi,interpolation_parameters%PARAMETERS(:,component_idx),err,error)
7203  IF(err/=0) GOTO 999
7204  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
7205  & err,error,*999)
7206  !Now process all the first partial derivatives
7207  DO ni=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_XI
7208  nu=partial_derivative_first_derivative_map(ni)
7209  interpolated_point%VALUES(component_idx,nu)=basis_interpolate_xi(interpolation_parameters% &
7210  & bases(component_idx)%PTR,nu,xi,interpolation_parameters%PARAMETERS(:,component_idx), &
7211  & err,error)
7212  IF(err/=0) GOTO 999
7213  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
7214  & err,error,*999)
7215  ENDDO !ni
7216  CASE(field_grid_point_based_interpolation)
7217  CALL flagerror("Not implemented.",err,error,*999)
7218  CASE(field_gauss_point_based_interpolation)
7219  CALL flagerror("Not implemented.",err,error,*999)
7220  CASE(field_data_point_based_interpolation)
7221  CALL flagerror("Not implemented.",err,error,*999)
7222  CASE DEFAULT
7223  local_error="The field component interpolation type of "//trim(number_to_vstring(interpolation_parameters% &
7224  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
7225  & " is invalid for component index "//trim(number_to_vstring(component_idx,"*",err,error))//"."
7226  END SELECT
7227  ENDDO !component_idx
7228  interpolated_point%PARTIAL_DERIVATIVE_TYPE=first_part_deriv
7229  CASE(second_part_deriv)
7230  DO component_idx=startcomponentidx,endcomponentidx
7231  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
7232  CASE(field_constant_interpolation)
7233  !Handle the first case of no partial derivative
7234  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
7235  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
7236  & err,error,*999)
7237  !Now process the rest of partial derivatives
7238  DO nu=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_PARTIAL_DERIVATIVES
7239  interpolated_point%VALUES(component_idx,nu)=0.0_dp
7240  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
7241  & err,error,*999)
7242  ENDDO !nu
7243  CASE(field_element_based_interpolation)
7244  !Handle the first case of no partial derivative
7245  interpolated_point%VALUES(component_idx,1)=interpolation_parameters%PARAMETERS(1,component_idx)
7246  CALL coordinate_interpolation_adjust(coordinate_system,no_part_deriv,interpolated_point%VALUES(component_idx,1), &
7247  & err,error,*999)
7248  !Now process the rest of partial derivatives
7249  DO nu=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_PARTIAL_DERIVATIVES
7250  interpolated_point%VALUES(component_idx,nu)=0.0_dp
7251  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
7252  & err,error,*999)
7253  ENDDO !nu
7254  CASE(field_node_based_interpolation)
7255  DO nu=1,interpolation_parameters%BASES(component_idx)%PTR%NUMBER_OF_PARTIAL_DERIVATIVES
7256  interpolated_point%VALUES(component_idx,nu)=basis_interpolate_xi(interpolation_parameters% &
7257  & bases(component_idx)%PTR,nu,xi,interpolation_parameters%PARAMETERS(:,component_idx), &
7258  & err,error)
7259  IF(err/=0) GOTO 999
7260  CALL coordinate_interpolation_adjust(coordinate_system,nu,interpolated_point%VALUES(component_idx,nu), &
7261  & err,error,*999)
7262  ENDdo! nu
7263  CASE(field_grid_point_based_interpolation)
7264  CALL flagerror("Not implemented.",err,error,*999)
7265  CASE(field_gauss_point_based_interpolation)
7266  CALL flagerror("Not implemented.",err,error,*999)
7267  CASE(field_data_point_based_interpolation)
7268  CALL flagerror("Not implemented.",err,error,*999)
7269  CASE DEFAULT
7270  local_error="The field component interpolation type of "//trim(number_to_vstring(interpolation_parameters% &
7271  & field_variable%COMPONENTS(component_idx)%INTERPOLATION_TYPE,"*",err,error))// &
7272  & " is invalid for component index "//trim(number_to_vstring(component_idx,"*",err,error))//"."
7273  END SELECT
7274  ENDDO !component_idx
7275  interpolated_point%PARTIAL_DERIVATIVE_TYPE=second_part_deriv
7276  CASE DEFAULT
7277  local_error="The partial derivative type of "//trim(number_to_vstring(partial_derivative_type,"*",err,error))// &
7278  & " is invalid."
7279  CALL flagerror(local_error,err,error,*999)
7280  END SELECT
7281  ELSE
7282  CALL flagerror("The interpolation parameters field is not associated.",err,error,*999)
7283  ENDIF
7284  !ELSE
7285  ! LOCAL_ERROR="Invalid number of Xi directions. The supplied Xi has "// &
7286  ! & TRIM(NUMBER_TO_VSTRING(SIZE(XI,1),"*",ERR,ERROR))//" directions and the required number of directions is "// &
7287  ! & TRIM(NUMBER_TO_VSTRING(INTERPOLATED_POINT%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%MESH%NUMBER_OF_DIMENSIONS, &
7288  ! & "*",ERR,ERROR))
7289  ! CALL FlagError(LOCAL_ERROR,ERR,ERROR,*999)
7290  !ENDIF
7291  ELSE
7292  CALL flagerror("Interpolated point interpolation parameters is not associated.",err,error,*999)
7293  ENDIF
7294  ELSE
7295  CALL flagerror("Interpolated point is not associated.",err,error,*999)
7296  ENDIF
7297 
7298  exits("FIELD_INTERPOLATE_XI")
7299  RETURN
7300 999 errorsexits("FIELD_INTERPOLATE_XI",err,error)
7301  RETURN 1
7302  END SUBROUTINE field_interpolate_xi
7303 
7304  !
7305  !================================================================================================================================
7306  !
7307 
7309  SUBROUTINE field_positionnormaltangentscalculateintptmetric(INTERPOLATED_POINT_METRICS,reverseNormal, &
7310  & position,normal,tangents,err,error,*)
7311 
7312  !Argument variables
7313  TYPE(field_interpolated_point_metrics_type), POINTER, INTENT(IN) :: interpolated_point_metrics
7314  LOGICAL, INTENT(IN) :: reversenormal
7315  REAL(DP), INTENT(OUT) :: position(:)
7316  REAL(DP), INTENT(OUT) :: normal(:)
7317  REAL(DP), INTENT(OUT) :: tangents(:,:)
7318  INTEGER(INTG), INTENT(OUT) :: err
7319  TYPE(varying_string), INTENT(OUT) :: error
7320  !Local Variables
7321  INTEGER(INTG) :: dimension_idx,xi_idx
7322  TYPE(field_interpolated_point_type), POINTER :: interpolated_point
7323  TYPE(varying_string) :: local_error
7324 
7325  enters("Field_PositionNormalTangentsCalculateIntPtMetric",err,error,*999)
7326 
7327  IF(ASSOCIATED(interpolated_point_metrics)) THEN
7328  IF(SIZE(position,1)>=interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS) THEN
7329  IF(SIZE(normal,1)>=interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS) THEN
7330  IF(SIZE(tangents,1)>=interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS) THEN
7331  IF(SIZE(tangents,2)>=interpolated_point_metrics%NUMBER_OF_XI_DIMENSIONS) THEN
7332  interpolated_point=>interpolated_point_metrics%INTERPOLATED_POINT
7333  IF(ASSOCIATED(interpolated_point)) THEN
7334  position=interpolated_point%VALUES(1:interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,no_part_deriv)
7335  SELECT CASE(interpolated_point_metrics%NUMBER_OF_XI_DIMENSIONS)
7336  CASE(1) !For lines
7337  normal=0.0_dp
7338  DO dimension_idx=1,interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS
7339  tangents(dimension_idx,1)=interpolated_point_metrics%DX_DXI &
7340  & (dimension_idx,1)
7341  ENDDO !dimension_idx
7342  tangents(1:interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,1)= &
7343  & normalise(tangents(1:interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,1),err,error)
7344  normal(1)=tangents(2,1)
7345  normal(2)=tangents(1,1)
7346  IF(err/=0) GOTO 999
7347  CASE(2) !For faces
7348  normal=0.0_dp
7349  DO xi_idx=1,interpolated_point_metrics%NUMBER_OF_XI_DIMENSIONS
7350  DO dimension_idx=1,interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS
7351  tangents(dimension_idx,xi_idx)=interpolated_point_metrics%DX_DXI(dimension_idx,xi_idx)
7352  ENDDO !dimension_idx
7353  tangents(1:interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,xi_idx)= &
7354  & normalise(tangents(1:interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,xi_idx),err,error)
7355  IF(err/=0) GOTO 999
7356  ENDDO !xi_idx
7357  CALL cross_product(tangents(1:interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,1), &
7358  & tangents(1:interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,2),normal,err,error,*999)
7359  IF(reversenormal) normal=-normal
7360  CASE DEFAULT
7361  local_error="The interpolated metrics must be for lines/faces, dimension of " &
7362  & //trim(number_to_vstring(interpolated_point_metrics%NUMBER_OF_XI_DIMENSIONS,"*",err,error))//" is invalid."
7363  CALL flagerror(local_error,err,error,*999)
7364  END SELECT
7365  ELSE
7366  CALL flagerror("Interpolated point metrics interpolated point is not associted.",err,error,*999)
7367  ENDIF
7368  ELSE
7369  local_error="The size of the 2nd dimension of tangents of "// &
7370  & trim(number_to_vstring(SIZE(tangents,2),"*",err,error))//" is too small. The size must be >= "// &
7371  & trim(number_to_vstring(interpolated_point_metrics%NUMBER_OF_XI_DIMENSIONS,"*",err,error))//"."
7372  CALL flagerror(local_error,err,error,*999)
7373  ENDIF
7374  ELSE
7375  local_error="The size of the 1st dimension of tangents of "// &
7376  & trim(number_to_vstring(SIZE(tangents,1),"*",err,error))//" is too small. The size must be >= "// &
7377  & trim(number_to_vstring(interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,"*",err,error))//"."
7378  CALL flagerror(local_error,err,error,*999)
7379  ENDIF
7380  ELSE
7381  local_error="The size of normal of "//trim(number_to_vstring(SIZE(normal,1),"*",err,error))// &
7382  & " is too small. The size must be >= "// &
7383  & trim(number_to_vstring(interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,"*",err,error))//"."
7384  CALL flagerror(local_error,err,error,*999)
7385  ENDIF
7386  ELSE
7387  local_error="The size of position of "//trim(number_to_vstring(SIZE(position,1),"*",err,error))// &
7388  & " is too small. The size must be >= "// &
7389  & trim(number_to_vstring(interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,"*",err,error))//"."
7390  CALL flagerror(local_error,err,error,*999)
7391  ENDIF
7392  ELSE
7393  CALL flagerror("Interpolated point metrics is not associated.",err,error,*999)
7394  ENDIF
7395 
7396  IF(diagnostics1) THEN
7397  CALL write_string(diagnostic_output_type,"Interpolated point metrics data:",err,error,*999)
7398  CALL write_string_value(diagnostic_output_type," Number of X dimensions = ", &
7399  & interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,err,error,*999)
7400  CALL write_string_value(diagnostic_output_type," Number of Xi dimensions = ", &
7401  & interpolated_point_metrics%NUMBER_OF_XI_DIMENSIONS,err,error,*999)
7402  CALL write_string_vector(general_output_type,1,1,interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,3,3, &
7403  & position,'(" Position :",3(X,E13.6))','(15X,3(X,E13.6))',err,error,*999)
7404  CALL write_string_vector(general_output_type,1,1,interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,3,3, &
7405  & normal,'(" Normal :",3(X,E13.6))','(15X,3(X,E13.6))',err,error,*999)
7406  CALL write_string(diagnostic_output_type," Tangents:",err,error,*999)
7407  DO xi_idx=1,interpolated_point_metrics%NUMBER_OF_XI_DIMENSIONS
7408  CALL write_string_value(diagnostic_output_type," Tangent : ",xi_idx,err,error,*999)
7409  CALL write_string_vector(general_output_type,1,1,interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS,3,3, &
7410  & tangents(:,xi_idx),'(" Tangent :",3(X,E13.6))','(15X,3(X,E13.6))',err,error,*999)
7411  ENDDO !xi_idx
7412  ENDIF
7413 
7414  exits("Field_PositionNormalTangentsCalculateIntPtMetric")
7415  RETURN
7416 999 errors("Field_PositionNormalTangentsCalculateIntPtMetric",err,error)
7417  exits("Field_PositionNormalTangentsCalculateIntPtMetric")
7418  RETURN 1
7419 
7420  END SUBROUTINE field_positionnormaltangentscalculateintptmetric
7421 
7422  !
7423  !================================================================================================================================
7424  !
7425 
7427  SUBROUTINE field_positionnormaltangentscalculatenode(FIELD,VARIABLE_TYPE,COMPONENT_NUMBER,LOCAL_NODE_NUMBER, &
7428  & position,normal,tangents,err,error,*)
7429 
7430  !Argument variables
7431  TYPE(field_type), POINTER, INTENT(IN) :: field
7432  INTEGER(INTG), INTENT(IN) :: variable_type
7433  INTEGER(INTG), INTENT(IN) :: component_number
7434  INTEGER(INTG), INTENT(IN) :: local_node_number
7435  REAL(DP), INTENT(OUT) :: position(:)
7436  REAL(DP), INTENT(OUT) :: normal(:)
7437  REAL(DP), INTENT(OUT) :: tangents(:,:)
7438  INTEGER(INTG), INTENT(OUT) :: err
7439  TYPE(varying_string), INTENT(OUT) :: error
7440  !Local Variables
7441  INTEGER(INTG) :: dims,index_match
7442  INTEGER(INTG) :: nic,component_idx,derivative_idx,xi_idx,element,element_idx,local_node,local_node_idx
7443  REAL(DP) :: xi(3), vec(3), dxdxi(3,3) ! Note VEC, DXDXI sizes are fixed, but it doesn't matter so much
7444  INTEGER(INTG) :: tangent_idx,tangent_xi_idx
7445  TYPE(basis_type), POINTER :: basis
7446  TYPE(domain_type), POINTER :: domain
7447  TYPE(domain_elements_type), POINTER :: domain_elements
7448  TYPE(domain_nodes_type), POINTER :: domain_nodes
7449  TYPE(domain_topology_type), POINTER :: topology
7450  TYPE(decomposition_type), POINTER :: decomposition
7451  TYPE(decomposition_topology_type), POINTER :: decomp_topology
7452  TYPE(decomposition_elements_type), POINTER :: decomp_elements
7453  TYPE(field_type), POINTER :: geometric_field
7454  TYPE(field_variable_type), POINTER :: field_variable
7455  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolation_parameters(:)
7456  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolated_points(:)
7457  TYPE(varying_string) :: local_error
7458 
7459  enters("Field_PositionNormalTangentsCalculateNode",err,error,*999)
7460 
7461  NULLIFY(field_variable)
7462 
7463  IF(ASSOCIATED(field)) THEN
7464  IF(field%FIELD_FINISHED) THEN
7465  geometric_field=>field%GEOMETRIC_FIELD
7466  IF(ASSOCIATED(geometric_field)) THEN
7467  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
7468  CALL field_variable_get(field,variable_type,field_variable,err,error,*999)
7469  IF(ASSOCIATED(field_variable)) THEN
7470  dims=geometric_field%VARIABLES(1)%NUMBER_OF_COMPONENTS !\TODO: clean this up
7471 ! DIMS=FIELD_VARIABLE%NUMBER_OF_COMPONENTS !\TODO: clean this up
7472  IF(component_number>=1.AND.component_number<=dims) THEN
7473  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
7474  IF(ASSOCIATED(domain)) THEN
7475  topology=>domain%TOPOLOGY
7476  IF(ASSOCIATED(topology)) THEN
7477  decomposition=>field%DECOMPOSITION
7478  IF(ASSOCIATED(decomposition)) THEN
7479  decomp_topology=>decomposition%TOPOLOGY
7480  IF(ASSOCIATED(decomp_topology)) THEN
7481  decomp_elements=>decomp_topology%ELEMENTS
7482  IF(ASSOCIATED(decomp_elements)) THEN
7483  IF(SIZE(position,1)>=dims) THEN
7484  IF(SIZE(normal,1)>=dims) THEN
7485  IF(SIZE(tangents,1)>=dims) THEN
7486  IF(SIZE(dxdxi,1)>=dims) THEN
7487  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
7488  CASE(field_constant_interpolation)
7489  local_error="Cannot compute the normal at a node for component number "// &
7490  & trim(number_to_vstring(component_number,"*",err,error))//" for variable type "// &
7491  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
7492  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
7493  & " which has constant interpolation."
7494  CALL flagerror(local_error,err,error,*999)
7495  CASE(field_element_based_interpolation)
7496  local_error="Cannot compute the normal at a node for component number "// &
7497  & trim(number_to_vstring(component_number,"*",err,error))//" for variable type "// &
7498  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
7499  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based&
7500  & interpolation."
7501  CALL flagerror(local_error,err,error,*999)
7502  CASE(field_node_based_interpolation)
7503  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
7504  IF(ASSOCIATED(domain)) THEN
7505  topology=>domain%TOPOLOGY
7506  IF(ASSOCIATED(topology)) THEN
7507  domain_elements=>topology%ELEMENTS
7508  IF(ASSOCIATED(domain_elements)) THEN
7509  domain_nodes=>topology%NODES
7510  IF(ASSOCIATED(domain_nodes)) THEN
7511  IF(local_node_number>0.AND.local_node_number<=domain_nodes%NUMBER_OF_NODES) THEN
7512  !Normal & tangent will be calculated as averages in all surrounding elements. This is
7513  !because there could be discontinuity in the surface gradients across elements.
7514  position(1:dims)=0.0_dp
7515  dxdxi=0.0_dp
7516  normal(1:dims)=0.0_dp
7517  CALL field_interpolation_parameters_initialise(geometric_field, &
7518  & interpolation_parameters,err,error,*999)
7519  CALL field_interpolated_points_initialise(interpolation_parameters, &
7520  & interpolated_points,err,error,*999)
7521  DO element_idx=1,domain_nodes%NODES(local_node_number)%NUMBER_OF_SURROUNDING_ELEMENTS
7522  element=domain_nodes%NODES(local_node_number)%SURROUNDING_ELEMENTS(element_idx)
7523  basis=>domain_elements%ELEMENTS(element)%BASIS
7524  !Find local node number in the basis
7525  local_node=0
7526  DO local_node_idx=1,basis%NUMBER_OF_NODES
7527  IF(domain_elements%ELEMENTS(element)%ELEMENT_NODES(local_node_idx)== &
7528  & local_node_number) THEN
7529  local_node=local_node_idx
7530  EXIT
7531  ENDIF
7532  ENDDO !local_node_idx
7533  !Find the xi position of the node in the element. In most cases this will be 0,1.0 etc
7534  ! but in some cases the geometric field may not contain this node in which case xi can be
7535  ! arbitrary
7536  CALL basis_local_node_xi_calculate(basis,local_node,xi,err,error,*999)
7537  !Interpolate the geometric field at the xi position.
7538  CALL field_interpolation_parameters_element_get(field_values_set_type,element, &
7539  & interpolation_parameters(field_u_variable_type)%PTR,err,error,*999)
7540  CALL field_interpolate_xi(first_part_deriv,xi(1:basis%NUMBER_OF_XI), &
7541  & interpolated_points(field_u_variable_type)%PTR,err,error,*999)
7542  !Grab the position. This shouldn't vary between elements so do it once only
7543  IF(element_idx==1) position(1:dims)=interpolated_points(field_u_variable_type)% &
7544  & ptr%VALUES(1:dims,no_part_deriv)
7545  !Get DXDXI
7546  !\todo: What if the surrounding elements have different number of xi? then DXDXI will be different in size.
7547  ! Which one do we return in that case?
7548  DO component_idx=1,dims
7549  DO xi_idx=1,basis%NUMBER_OF_XI
7550  derivative_idx=partial_derivative_first_derivative_map(xi_idx) !2,4,7
7551  dxdxi(component_idx,xi_idx)=interpolated_points(field_u_variable_type)%PTR% &
7552  & values(component_idx,derivative_idx) !dx/dxi
7553  ENDDO
7554  ENDDO
7555  !Calculate the tangents and normal vectors
7556  IF(domain_nodes%NODES(local_node_number)%BOUNDARY_NODE) THEN
7557  SELECT CASE(basis%TYPE)
7558  CASE(basis_lagrange_hermite_tp_type)
7559  DO nic=-basis%NUMBER_OF_XI_COORDINATES,basis%NUMBER_OF_XI_COORDINATES
7560  IF(decomp_elements%ELEMENTS(element)%ADJACENT_ELEMENTS(abs(nic))% &
7561  & number_of_adjacent_elements==0) THEN
7562  IF(nic>0) THEN
7563  index_match=basis%NUMBER_OF_NODES_XIC(abs(nic))
7564  ELSEIF(nic<0) THEN
7565  index_match=1
7566  ENDIF
7567  IF(basis%NODE_POSITION_INDEX(local_node,abs(nic))==index_match) THEN
7568  !1D/2D/3D: tangents and normal
7569  SELECT CASE(basis%NUMBER_OF_XI)
7570  CASE(1)
7571  !There are no tangents. We can provide a normal, but no need to sum and average,
7572  ! since in a 1D mesh, a boundary node won't be share with other elements.
7573  normal(1:dims)=dxdxi(1:dims,1)
7574  CASE(2)
7575  !One tangent vector, one normal vector
7576  tangents=0.0_dp
7577  tangent_xi_idx=other_xi_directions2(abs(nic))
7578  vec(1:dims)=dxdxi(1:dims,tangent_xi_idx)
7579  vec(1:dims)=normalise(vec(1:dims),err,error)
7580  tangents(1:dims,1)=tangents(1:dims,1)+ &
7581  & vec(1:dims)
7582  !Normal is the other component in DXDXI (correct?) Ensure the direction is outward
7583  vec(1:dims)=dxdxi(1:dims,abs(nic))
7584  IF(nic<0) vec=-vec
7585  normal(1:dims)=normal(1:dims)+ &
7586  & normalise(vec(1:dims),err,error)
7587  CASE(3)
7588  !Two tangent vectors, one normal vector
7589  tangents=0.0_dp
7590  DO tangent_idx=1,2
7591  tangent_xi_idx=other_xi_directions3(abs(nic),tangent_idx+1,1)
7592  vec(1:dims)=dxdxi(1:dims,tangent_xi_idx)
7593  vec(1:dims)=normalise(vec(1:dims),err,error)
7594  tangents(1:dims,tangent_idx)= &
7595  & tangents(1:dims,tangent_idx)+vec(1:dims)
7596  ENDDO
7597  !Calculate the normal vector
7598  CALL cross_product(tangents(1:dims,1),tangents(1:dims,2), &
7599  & vec(1:dims),err,error,*999)
7600  !Yes below is compicated, but that's what it takes to get the normals pointing outwards
7601  IF(nic<0) vec=-vec
7602  IF(abs(nic)==2) vec=-vec
7603  normal(1:dims)=normal(1:dims)+vec(1:dims)
7604  CASE DEFAULT
7605  !Should never happen anyway
7606  END SELECT
7607  ENDIF
7608  ENDIF
7609  ENDDO !nic
7610  CASE(basis_simplex_type)
7611  CALL flagerror("Not implemented.",err,error,*999)
7612  ! DO nic=1,BASIS%NUMBER_OF_XI_COORDINATES
7613  ! IF(DOMAIN_ELEMENTS%ELEMENTS(element)%ADJACENT_ELEMENTS(nic)% &
7614  ! & NUMBER_OF_ADJACENT_ELEMENTS==0) THEN
7615  ! IF(BASIS%NODE_POSITION_INDEX(local_node,nic)==1) THEN
7616  ! !Area coordinates
7617  ! SELECT CASE(BASIS%NUMBER-OF_XI)
7618  ! CASE(1)
7619  !
7620  ! CASE(2)
7621  !
7622  ! CASE(3)
7623  !
7624  ! CASE DEFAULT
7625  ! !Will never happen anyway
7626  ! END SELECT
7627  ! ENDIF
7628  ! ENDIF
7629  ! ENDDO !nic
7630  CASE(basis_serendipity_type)
7631  CALL flagerror("Not implemented.",err,error,*999)
7632  CASE(basis_auxilliary_type)
7633  CALL flagerror("Not implemented.",err,error,*999)
7634  CASE(basis_b_spline_tp_type)
7635  CALL flagerror("Not implemented.",err,error,*999)
7636  CASE(basis_fourier_lagrange_hermite_tp_type)
7637  CALL flagerror("Not implemented.",err,error,*999)
7638  CASE(basis_extended_lagrange_tp_type)
7639  CALL flagerror("Not implemented.",err,error,*999)
7640  CASE DEFAULT
7641  local_error="The basis type of "//trim(number_to_vstring(basis%TYPE, &
7642  & "*",err,error))//" is invalid."
7643  CALL flagerror(local_error,err,error,*999)
7644  END SELECT
7645  ELSE
7646  !Node is internal to the mesh. Assign zero normal and tangents
7647  !Actually, they were already assigned to be zero at the start so do nothing.
7648  ENDIF
7649  !Calculate tangents from DXDXI: which xi corresponds to normal direction?
7650  ENDDO !element_idx
7651  CALL field_interpolated_points_finalise(interpolated_points,err,error,*999)
7652  CALL field_interpolation_parameters_finalise(interpolation_parameters,err,error,*999)
7653 
7654  !Normalise the normal vector
7655  normal(1:dims)=normalise(normal(1:dims),err,error)
7656  !Normalise the tangent vectors
7657  DO tangent_idx=1,basis%NUMBER_OF_XI-1
7658  tangents(1:dims,tangent_idx)=normalise(tangents(1:dims,tangent_idx),err,error)
7659  ENDDO
7660  ELSE
7661  local_error="The local node number of "// &
7662  & trim(number_to_vstring(local_node_number,"*",err,error))// &
7663  & " is invalid for component number "// &
7664  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
7665  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
7666  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
7667  & ". The local node number must be > 0 and <="// &
7668  & trim(number_to_vstring(domain_nodes%NUMBER_OF_NODES,"*",err,error))//"."
7669  CALL flagerror(local_error,err,error,*999)
7670  ENDIF
7671  ELSE
7672  local_error="The domain topology nodes for component number "// &
7673  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
7674  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
7675  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is not associated."
7676  CALL flagerror(local_error,err,error,*999)
7677  ENDIF
7678  ELSE
7679  local_error="The domain topology elements for component number "// &
7680  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
7681  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
7682  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is not associated."
7683  CALL flagerror(local_error,err,error,*999)
7684  ENDIF
7685  ELSE
7686  local_error="The domain topology for component number "// &
7687  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
7688  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
7689  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is not associated."
7690  CALL flagerror(local_error,err,error,*999)
7691  ENDIF
7692  ELSE
7693  local_error="The domain for component number "// &
7694  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
7695  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
7696  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is not associated."
7697  CALL flagerror(local_error,err,error,*999)
7698  ENDIF
7699  CASE(field_grid_point_based_interpolation)
7700  local_error="Cannot compute the normal at a node for component number "// &
7701  & trim(number_to_vstring(component_number,"*",err,error))//" for variable type "// &
7702  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
7703  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
7704  & " which has grid point based interpolation."
7705  CALL flagerror(local_error,err,error,*999)
7706  CASE(field_gauss_point_based_interpolation)
7707  local_error="Cannot compute the normal at a node for component number "// &
7708  & trim(number_to_vstring(component_number,"*",err,error))//" for variable type "// &
7709  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
7710  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
7711  & " which has Gauss point based interpolation."
7712  CALL flagerror(local_error,err,error,*999)
7713  CASE(field_data_point_based_interpolation)
7714  local_error="Cannot compute the normal at a node for component number "// &
7715  & trim(number_to_vstring(component_number,"*",err,error))//" for variable type "// &
7716  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
7717  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
7718  & " which has data point based interpolation."
7719  CALL flagerror(local_error,err,error,*999)
7720  CASE DEFAULT
7721  local_error="The interpolation type of "//trim(number_to_vstring &
7722  & (field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
7723  & " is invalid for component number "//trim(number_to_vstring(component_number,"*", &
7724  & err,error))//" for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
7725  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
7726  CALL flagerror(local_error,err,error,*999)
7727  END SELECT
7728  ELSE
7729  local_error="The first dimension of the supplied dx/dxi array of "// &
7730  & trim(number_to_vstring(SIZE(dxdxi,1),"*",err,error))// &
7731  & " is too small. The first dimension of the supplied array must be >= "// &
7732  & trim(number_to_vstring(dims,"*",err,error))//"."
7733  CALL flagerror(local_error,err,error,*999)
7734  ENDIF
7735  ELSE
7736  local_error="The first dimension of the supplied tangent array of "// &
7737  & trim(number_to_vstring(SIZE(tangents,1),"*",err,error))// &
7738  & " is too small. The first dimension of the supplied array must be >= "// &
7739  & trim(number_to_vstring(dims,"*",err,error))//"."
7740  CALL flagerror(local_error,err,error,*999)
7741  ENDIF
7742  ELSE
7743  local_error="The size of the supplied normal array of "//trim(number_to_vstring(SIZE(normal,1), &
7744  & "*",err,error))//" is too small. The size of the supplied array must be >= "// &
7745  & trim(number_to_vstring(dims,"*",err,error))//"."
7746  CALL flagerror(local_error,err,error,*999)
7747  ENDIF
7748  ELSE
7749  local_error="The size of the supplied position array of "//trim(number_to_vstring(SIZE(position,1), &
7750  & "*",err,error))//" is too small. The size of the supplied array must be >= "// &
7751  & trim(number_to_vstring(dims,"*",err,error))//"."
7752  CALL flagerror(local_error,err,error,*999)
7753  ENDIF
7754  ELSE
7755  CALL flagerror("Decomposition elements is not associated.",err,error,*999)
7756  ENDIF
7757  ELSE
7758  CALL flagerror("Decomposition topology is not associated.",err,error,*999)
7759  ENDIF
7760  ELSE
7761  CALL flagerror("Decomposition is not associated.",err,error,*999)
7762  ENDIF
7763  ELSE
7764  CALL flagerror("Domain topology is not associated.",err,error,*999)
7765  ENDIF
7766  ELSE
7767  CALL flagerror("Domain is not associated.",err,error,*999)
7768  ENDIF
7769  ELSE
7770  local_error="The field component number of "//trim(number_to_vstring(component_number,"*",err,error))// &
7771  & " for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
7772  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
7773  & " is invalid. The component number must be > 0 and <= "// &
7774  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//"."
7775  CALL flagerror(local_error,err,error,*999)
7776  ENDIF
7777  ELSE
7778  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
7779  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
7780  CALL flagerror(local_error,err,error,*999)
7781  ENDIF
7782  ELSE
7783  local_error="The supplied variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
7784  & " is invalid. The field variable type must be > 1 and <= "// &
7785  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
7786  CALL flagerror(local_error,err,error,*999)
7787  ENDIF
7788  ELSE
7789  local_error="The geometric field is not associated for field number "// &
7790  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
7791  CALL flagerror(local_error,err,error,*999)
7792  ENDIF
7793  ELSE
7794  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
7795  CALL flagerror(local_error,err,error,*999)
7796  ENDIF
7797  ELSE
7798  CALL flagerror("Field is not associated.",err,error,*999)
7799  ENDIF
7800 
7801  IF(diagnostics1) THEN
7802  CALL write_string(diagnostic_output_type,"Field normal at a node:",err,error,*999)
7803  CALL write_string_value(diagnostic_output_type," Field number = ",field%USER_NUMBER,err,error,*999)
7804  CALL write_string_value(diagnostic_output_type," Variable type = ",variable_type,err,error,*999)
7805  CALL write_string_value(diagnostic_output_type," Component number = ",component_number,err,error,*999)
7806  CALL write_string_value(diagnostic_output_type," Local node number = ",local_node_number,err,error,*999)
7807  CALL write_string_vector(diagnostic_output_type,1,1,dims,3,3,position, &
7808  & '(" Position :",3(X,E13.6))','(21X,3(X,E13.6))',err,error,*999)
7809  CALL write_string_vector(diagnostic_output_type,1,1,dims,3,3,normal, &
7810  & '(" Normal :",3(X,E13.6))','(21X,3(X,E13.6))',err,error,*999)
7811  ENDIF
7812 
7813  exits("Field_PositionNormalTangentsCalculateNode")
7814  RETURN
7815 999 errors("Field_PositionNormalTangentsCalculateNode",err,error)
7816  exits("Field_PositionNormalTangentsCalculateNode")
7817  RETURN 1
7818 
7819  END SUBROUTINE field_positionnormaltangentscalculatenode
7820 
7821  !
7822  !================================================================================================================================
7823  !
7824 
7826  SUBROUTINE field_interpolated_point_finalise(INTERPOLATED_POINT,ERR,ERROR,*)
7827 
7828  !Argument variables
7829  TYPE(field_interpolated_point_type), POINTER :: interpolated_point
7830  INTEGER(INTG), INTENT(OUT) :: err
7831  TYPE(varying_string), INTENT(OUT) :: error
7832  !Local Variables
7833 
7834  enters("FIELD_INTERPOLATED_POINT_FINALISE",err,error,*999)
7835 
7836  IF(ASSOCIATED(interpolated_point)) THEN
7837  IF(ALLOCATED(interpolated_point%VALUES)) DEALLOCATE(interpolated_point%VALUES)
7838  DEALLOCATE(interpolated_point)
7839  ENDIF
7840 
7841  exits("FIELD_INTERPOLATED_POINT_FINALISE")
7842  RETURN
7843 999 errorsexits("FIELD_INTERPOLATED_POINT_FINALISE",err,error)
7844  RETURN 1
7845  END SUBROUTINE field_interpolated_point_finalise
7846 
7847  !
7848  !================================================================================================================================
7849  !
7850 
7852  SUBROUTINE field_interpolated_point_initialise(INTERPOLATION_PARAMETERS,INTERPOLATED_POINT,ERR,ERROR,*,componentType)
7853 
7854  !Argument variables
7855  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
7856  TYPE(field_interpolated_point_type), POINTER :: interpolated_point
7857  INTEGER(INTG), INTENT(OUT) :: err
7858  TYPE(varying_string), INTENT(OUT) :: error
7859  INTEGER(INTG), OPTIONAL, INTENT(IN) :: componenttype
7860  !Local Variables
7861  INTEGER(INTG) :: dummy_err,number_of_dimensions,numberofcomponents
7862  TYPE(varying_string) :: dummy_error,localerror
7863 
7864  enters("FIELD_INTERPOLATED_POINT_INITIALISE",err,error,*999)
7865 
7866  IF(ASSOCIATED(interpolation_parameters)) THEN
7867  IF(ASSOCIATED(interpolation_parameters%FIELD)) THEN
7868  IF(ASSOCIATED(interpolated_point)) THEN
7869  CALL flagerror("Interpolated point is already associated.",err,error,*998)
7870  ELSE
7871  ALLOCATE(interpolated_point,stat=err)
7872  IF(err/=0) CALL flagerror("Could not allocate interpolated point",err,error,*999)
7873  interpolated_point%INTERPOLATION_PARAMETERS=>interpolation_parameters
7874  number_of_dimensions=interpolation_parameters%FIELD%DECOMPOSITION%MESH%NUMBER_OF_DIMENSIONS
7875  interpolated_point%MAX_PARTIAL_DERIVATIVE_INDEX=partial_derivative_maximum_map(number_of_dimensions)
7876  !Calculate the number of components for the interpolated point
7877  IF(PRESENT(componenttype)) THEN
7878  SELECT CASE(componenttype)
7879  CASE(field_all_components_type)
7880  numberofcomponents=interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
7881  CASE(field_geometric_components_type)
7882  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
7883  numberofcomponents=interpolation_parameters%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(field_u_variable_type)%PTR% &
7884  & number_of_components
7885  ELSEIF(interpolation_parameters%FIELD%TYPE==field_geometric_type) THEN
7886  numberofcomponents=interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
7887  ELSE
7888  localerror="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
7889  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
7890  CALL flagerror(localerror,err,error,*999)
7891  ENDIF
7892  CASE(field_nongeometric_components_type)
7893  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
7894  numberofcomponents=interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS-interpolation_parameters% &
7895  & field%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(field_u_variable_type)%PTR%NUMBER_OF_COMPONENTS
7896  ELSE
7897  localerror="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
7898  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
7899  CALL flagerror(localerror,err,error,*999)
7900  ENDIF
7901  CASE DEFAULT
7902  localerror="Interpolation component type "//trim(number_to_vstring(componenttype,"*",err,error))//" is not valid."
7903  CALL flagerror(localerror,err,error,*999)
7904  END SELECT
7905  ELSE !.NOT.(PRESENT(componentType)) -default all components
7906  numberofcomponents=interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
7907  ENDIF
7908  ALLOCATE(interpolated_point%VALUES(numberofcomponents,interpolated_point%MAX_PARTIAL_DERIVATIVE_INDEX),stat=err)
7909  IF(err/=0) CALL flagerror("Could not allocate interpolated point values.",err,error,*999)
7910  interpolated_point%VALUES=0.0_dp
7911  ENDIF
7912  ELSE
7913  CALL flagerror("Interpolation parameters field is not associated.",err,error,*998)
7914  ENDIF
7915  ELSE
7916  CALL flagerror("Interpolation parameters is not associated.",err,error,*998)
7917  ENDIF
7918 
7919  exits("FIELD_INTERPOLATED_POINT_INITIALISE")
7920  RETURN
7921 999 CALL field_interpolated_point_finalise(interpolated_point,dummy_err,dummy_error,*998)
7922 998 errorsexits("FIELD_INTERPOLATED_POINT_INITIALISE",err,error)
7923  RETURN 1
7924  END SUBROUTINE field_interpolated_point_initialise
7925 
7926  !
7927  !================================================================================================================================
7928  !
7929 
7931  SUBROUTINE field_interpolated_points_finalise(INTERPOLATED_POINTS,ERR,ERROR,*)
7932 
7933  !Argument variables
7934  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolated_points(:)
7935  INTEGER(INTG), INTENT(OUT) :: err
7936  TYPE(varying_string), INTENT(OUT) :: error
7937  !Local Variables
7938  INTEGER(INTG) :: var_type_idx
7939 
7940  enters("FIELD_INTERPOLATED_POINTS_FINALISE",err,error,*999)
7941 
7942  IF(ASSOCIATED(interpolated_points)) THEN
7943  DO var_type_idx=1,SIZE(interpolated_points,1)
7944  CALL field_interpolated_point_finalise(interpolated_points(var_type_idx)%PTR,err,error,*999)
7945  ENDDO !var_type_idx
7946  DEALLOCATE(interpolated_points)
7947  ENDIF
7948 
7949  exits("FIELD_INTERPOLATED_POINTS_FINALISE")
7950  RETURN
7951 999 errorsexits("FIELD_INTERPOLATED_POINTS_FINALISE",err,error)
7952  RETURN 1
7953  END SUBROUTINE field_interpolated_points_finalise
7954 
7955  !
7956  !================================================================================================================================
7957  !
7958 
7960  SUBROUTINE field_interpolated_points_initialise(INTERPOLATION_PARAMETERS,INTERPOLATED_POINTS,ERR,ERROR,*,componentType)
7961 
7962  !Argument variables
7963  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolation_parameters(:)
7964  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolated_points(:)
7965  INTEGER(INTG), INTENT(OUT) :: err
7966  TYPE(varying_string), INTENT(OUT) :: error
7967  INTEGER(INTG), OPTIONAL, INTENT(IN) :: componenttype
7968  !Local Variables
7969  INTEGER(INTG) :: dummy_err,var_type_idx
7970  TYPE(varying_string) :: dummy_error
7971 
7972  enters("FIELD_INTERPOLATED_POINTS_INITIALISE",err,error,*998)
7973 
7974  IF(ASSOCIATED(interpolation_parameters)) THEN
7975  IF(ASSOCIATED(interpolated_points)) THEN
7976  CALL flagerror("Interpolated point is already associated.",err,error,*998)
7977  ELSE
7978  ALLOCATE(interpolated_points(field_number_of_variable_types),stat=err)
7979  IF(err/=0) CALL flagerror("Could not allocate interpolated points",err,error,*999)
7980  DO var_type_idx=1,field_number_of_variable_types
7981  NULLIFY(interpolated_points(var_type_idx)%PTR)
7982  IF(ASSOCIATED(interpolation_parameters(var_type_idx)%PTR)) THEN
7983  IF(PRESENT(componenttype)) THEN
7984  CALL field_interpolated_point_initialise(interpolation_parameters(var_type_idx)%PTR, &
7985  & interpolated_points(var_type_idx)%PTR,err,error,*999,componenttype)
7986  ELSE
7987  CALL field_interpolated_point_initialise(interpolation_parameters(var_type_idx)%PTR, &
7988  & interpolated_points(var_type_idx)%PTR,err,error,*999)
7989  ENDIF
7990  ENDIF
7991  ENDDO !var_type_idx
7992  ENDIF
7993  ELSE
7994  CALL flagerror("Interpolation parameters is not associated.",err,error,*998)
7995  ENDIF
7996 
7997  exits("FIELD_INTERPOLATED_POINTS_INITIALISE")
7998  RETURN
7999 999 CALL field_interpolated_points_finalise(interpolated_points,dummy_err,dummy_error,*998)
8000 998 errorsexits("FIELD_INTERPOLATED_POINTS_INITIALISE",err,error)
8001  RETURN 1
8002  END SUBROUTINE field_interpolated_points_initialise
8003 
8004  !
8005  !================================================================================================================================
8006  !
8007 
8009  SUBROUTINE field_interpolated_point_metrics_calculate(JACOBIAN_TYPE,INTERPOLATED_POINT_METRICS,ERR,ERROR,*)
8010 
8011  !Argument variables
8012  TYPE(field_interpolated_point_metrics_type), POINTER :: interpolated_point_metrics
8013  INTEGER(INTG), INTENT(IN) :: jacobian_type
8014  INTEGER(INTG), INTENT(OUT) :: err
8015  TYPE(varying_string), INTENT(OUT) :: error
8016  !Local Variables
8017  TYPE(coordinate_system_type), POINTER :: coordinate_system
8018  TYPE(field_type), POINTER :: field
8019  TYPE(field_interpolated_point_type), POINTER :: interpolated_point
8020  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
8021 
8022  enters("FIELD_INTERPOLATED_POINT_METRICS_CALCULATE",err,error,*999)
8023 
8024  IF(ASSOCIATED(interpolated_point_metrics)) THEN
8025  interpolated_point=>interpolated_point_metrics%INTERPOLATED_POINT
8026  interpolation_parameters=>interpolated_point%INTERPOLATION_PARAMETERS
8027  interpolated_point_metrics%NUMBER_OF_XI_DIMENSIONS=interpolation_parameters%NUMBER_OF_XI
8028  field=>interpolation_parameters%FIELD
8029  IF(field%TYPE==field_geometric_type.OR.field%TYPE==field_fibre_type.OR.field%TYPE==field_general_type &
8030  & .OR.field%TYPE==field_geometric_general_type) THEN
8031  NULLIFY(coordinate_system)
8032  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
8033  CALL coordinate_metrics_calculate(coordinate_system,jacobian_type,interpolated_point_metrics,err,error,*999)
8034  ELSE
8035  CALL flagerror("The field is not a geometric or fibre field.",err,error,*999)
8036  ENDIF
8037  ELSE
8038  CALL flagerror("Interpolated point metrics is not associated.",err,error,*999)
8039  ENDIF
8040 
8041  exits("FIELD_INTERPOLATED_POINT_METRICS_CALCULATE")
8042  RETURN
8043 999 errorsexits("FIELD_INTERPOLATED_POINT_METRICS_CALCULATE",err,error)
8044  RETURN 1
8045  END SUBROUTINE field_interpolated_point_metrics_calculate
8046 
8047  !
8048  !================================================================================================================================
8049  !
8050 
8052  SUBROUTINE field_interpolated_point_metrics_finalise(INTERPOLATED_POINT_METRICS,ERR,ERROR,*)
8053 
8054  !Argument variables
8055  TYPE(field_interpolated_point_metrics_type), POINTER :: interpolated_point_metrics
8056  INTEGER(INTG), INTENT(OUT) :: err
8057  TYPE(varying_string), INTENT(OUT) :: error
8058  !Local Variables
8059 
8060  enters("FIELD_INTERPOLATED_POINT_METRICS_FINALISE",err,error,*999)
8061 
8062  IF(ASSOCIATED(interpolated_point_metrics)) THEN
8063  IF(ALLOCATED(interpolated_point_metrics%GL)) DEALLOCATE(interpolated_point_metrics%GL)
8064  IF(ALLOCATED(interpolated_point_metrics%GU)) DEALLOCATE(interpolated_point_metrics%GU)
8065  IF(ALLOCATED(interpolated_point_metrics%DX_DXI)) DEALLOCATE(interpolated_point_metrics%DX_DXI)
8066  IF(ALLOCATED(interpolated_point_metrics%DXI_DX)) DEALLOCATE(interpolated_point_metrics%DXI_DX)
8067  DEALLOCATE(interpolated_point_metrics)
8068  ENDIF
8069 
8070  exits("FIELD_INTERPOLATED_POINT_METRICS_FINALISE")
8071  RETURN
8072 999 errorsexits("FIELD_INTERPOLATED_POINT_METRICS_FINALISE",err,error)
8073  RETURN 1
8074  END SUBROUTINE field_interpolated_point_metrics_finalise
8075 
8076  !
8077  !================================================================================================================================
8078  !
8079 
8081  SUBROUTINE field_interpolated_point_metrics_initialise(INTERPOLATED_POINT,INTERPOLATED_POINT_METRICS,ERR,ERROR,*)
8082 
8083  !Argument variables
8084  TYPE(field_interpolated_point_type), POINTER :: interpolated_point !A pointer to the interpolated point to initliase the interpolated point metrics for
8085  TYPE(field_interpolated_point_metrics_type), POINTER :: interpolated_point_metrics
8086  INTEGER(INTG), INTENT(OUT) :: err
8087  TYPE(varying_string), INTENT(OUT) :: error
8088  !Local Variables
8089  INTEGER(INTG) :: number_of_xi_dimensions,number_of_x_dimensions
8090  INTEGER(INTG) :: dummy_err
8091  TYPE(coordinate_system_type), POINTER :: coordinate_system
8092  TYPE(varying_string) :: dummy_error !,LOCAL_ERROR
8093 
8094  enters("FIELD_INTERPOLATED_POINT_METRICS_INITIALISE",err,error,*999)
8095 
8096  IF(ASSOCIATED(interpolated_point)) THEN
8097  IF(ASSOCIATED(interpolated_point_metrics)) THEN
8098  CALL flagerror("Interpolated point metrics is already associated.",err,error,*998)
8099  ELSE
8100  NULLIFY(coordinate_system)
8101  CALL field_coordinate_system_get(interpolated_point%INTERPOLATION_PARAMETERS%FIELD,coordinate_system,err,error,*999)
8102  number_of_x_dimensions=coordinate_system%NUMBER_OF_DIMENSIONS
8103  number_of_xi_dimensions=interpolated_point%INTERPOLATION_PARAMETERS%FIELD%DECOMPOSITION%MESH%NUMBER_OF_DIMENSIONS
8104  !Size of interpolated point values may be greater than number of x dimensions, as FIELD_GEOMETRIC_GENERAL_TYPE
8105  !fields can have geometric components and then other non-geometric components, eg. for dependent fields with
8106  !geometric components.
8107  IF(number_of_x_dimensions<=SIZE(interpolated_point%VALUES,1)) THEN
8108  ALLOCATE(interpolated_point_metrics,stat=err)
8109  IF(err/=0) CALL flagerror("Could not allocate interpolated point metrics.",err,error,*999)
8110  ALLOCATE(interpolated_point_metrics%GL(number_of_xi_dimensions,number_of_xi_dimensions),stat=err)
8111  IF(err/=0) CALL flagerror("Could not allocate interpolated point metrics convariant tensor.",err,error,*999)
8112  ALLOCATE(interpolated_point_metrics%GU(number_of_xi_dimensions,number_of_xi_dimensions),stat=err)
8113  IF(err/=0) CALL flagerror("Could not allocate interpolated point metrics contravariant tensor.",err,error,*999)
8114  ALLOCATE(interpolated_point_metrics%DX_DXI(number_of_x_dimensions,number_of_xi_dimensions),stat=err)
8115  IF(err/=0) CALL flagerror("Could not allocate interpolated point metrics dX_dXi.",err,error,*999)
8116  ALLOCATE(interpolated_point_metrics%DXI_DX(number_of_xi_dimensions,number_of_x_dimensions),stat=err)
8117  IF(err/=0) CALL flagerror("Could not allocate interpolated point metrics dXi_dX.",err,error,*999)
8118  interpolated_point_metrics%INTERPOLATED_POINT=>interpolated_point
8119  interpolated_point_metrics%NUMBER_OF_X_DIMENSIONS=number_of_x_dimensions
8120  interpolated_point_metrics%NUMBER_OF_XI_DIMENSIONS=number_of_xi_dimensions
8121  interpolated_point_metrics%GL=0.0_dp
8122  interpolated_point_metrics%GU=0.0_dp
8123  interpolated_point_metrics%DX_DXI=0.0_dp
8124  interpolated_point_metrics%DXI_DX=0.0_dp
8125  interpolated_point_metrics%JACOBIAN=0.0_dp
8126  interpolated_point_metrics%JACOBIAN_TYPE=0
8127  !For now don't flag an error if the number of xi dimensions doesn't match the number of x dimensions.
8128  !Simply do not allocate the metrics information.
8129 ! ELSE
8130 ! LOCAL_ERROR="The number of coordinate dimensions ("//TRIM(NUMBER_TO_VSTRING(NUMBER_OF_X_DIMENSIONS,"*",ERR,ERROR))// &
8131 ! & ") does not match the number of components of the interpolated point ("// &
8132 ! & TRIM(NUMBER_TO_VSTRING(SIZE(INTERPOLATED_POINT%VALUES,1),"*",ERR,ERROR))//")."
8133 ! CALL FlagError(LOCAL_ERROR,ERR,ERROR,*998)
8134  ENDIF
8135  ENDIF
8136  ELSE
8137  CALL flagerror("Interpolation point is not associated.",err,error,*998)
8138  ENDIF
8139 
8140  exits("FIELD_INTERPOLATED_POINT_METRICS_INITIALISE")
8141  RETURN
8142 999 CALL field_interpolated_point_metrics_finalise(interpolated_point_metrics,dummy_err,dummy_error,*998)
8143 998 errorsexits("FIELD_INTERPOLATED_POINT_METRICS_INITIALISE",err,error)
8144  RETURN 1
8145  END SUBROUTINE field_interpolated_point_metrics_initialise
8146 
8147  !
8148  !================================================================================================================================
8149  !
8150 
8152  SUBROUTINE field_interpolatedpointsmetricsfinalise(INTERPOLATED_POINTS_METRICS,ERR,ERROR,*)
8153 
8154  !Argument variables
8155  TYPE(field_interpolated_point_metrics_ptr_type), POINTER :: interpolated_points_metrics(:)
8156  INTEGER(INTG), INTENT(OUT) :: err
8157  TYPE(varying_string), INTENT(OUT) :: error
8158  !Local Variables
8159  INTEGER(INTG) :: var_type_idx
8160 
8161  enters("Field_InterpolatedPointsMetricsFinalise",err,error,*999)
8162 
8163  IF(ASSOCIATED(interpolated_points_metrics)) THEN
8164  DO var_type_idx=1,SIZE(interpolated_points_metrics,1)
8165  CALL field_interpolated_point_metrics_finalise(interpolated_points_metrics(var_type_idx)%PTR,err,error,*999)
8166  ENDDO !var_type_idx
8167  DEALLOCATE(interpolated_points_metrics)
8168  ENDIF
8169 
8170  exits("Field_InterpolatedPointsMetricsFinalise")
8171  RETURN
8172 999 errorsexits("Field_InterpolatedPointsMetricsFinalise",err,error)
8173  RETURN 1
8174  END SUBROUTINE field_interpolatedpointsmetricsfinalise
8175 
8176  !
8177  !================================================================================================================================
8178  !
8179 
8181  SUBROUTINE field_interpolatedpointsmetricsinitialise(INTERPOLATED_POINTS,INTERPOLATED_POINTS_METRICS,ERR,ERROR,*)
8182 
8183  !Argument variables
8184  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolated_points(:) !A pointer to the interpolated pointS to initliase the interpolated point metrics for
8185  TYPE(field_interpolated_point_metrics_ptr_type), POINTER :: interpolated_points_metrics(:)
8186  INTEGER(INTG), INTENT(OUT) :: err
8187  TYPE(varying_string), INTENT(OUT) :: error
8188  !Local Variables
8189  INTEGER(INTG) :: variabletypeidx,dummy_err
8190  TYPE(varying_string) :: dummy_error
8191 
8192  enters("Field_InterpolatedPointsMetricsInitialise",err,error,*999)
8193 
8194  IF(ASSOCIATED(interpolated_points)) THEN
8195  IF(ASSOCIATED(interpolated_points_metrics)) THEN
8196  CALL flagerror("Interpolated point metrics is already associated.",err,error,*998)
8197  ELSE
8198  ALLOCATE(interpolated_points_metrics(field_number_of_variable_types),stat=err)
8199  IF(err/=0) CALL flagerror("Could not allocate interpolated points metrics.",err,error,*999)
8200  !Nullify all pointers first so that finalise does not fail on error condition half way through the next loop
8201  DO variabletypeidx=1,field_number_of_variable_types
8202  NULLIFY(interpolated_points_metrics(variabletypeidx)%PTR)
8203  ENDDO !variableTypeIdx
8204  DO variabletypeidx=1,field_number_of_variable_types
8205  IF(ASSOCIATED(interpolated_points(variabletypeidx)%PTR)) &
8206  & CALL field_interpolated_point_metrics_initialise(interpolated_points(variabletypeidx)%PTR, &
8207  & interpolated_points_metrics(variabletypeidx)%PTR,err,error,*999)
8208  ENDDO !variableTypeIdx
8209  ENDIF
8210  ELSE
8211  CALL flagerror("Interpolation points is not associated.",err,error,*998)
8212  ENDIF
8213 
8214  exits("Field_InterpolatedPointsMetricsInitialise")
8215  RETURN
8216 999 CALL field_interpolatedpointsmetricsfinalise(interpolated_points_metrics,dummy_err,dummy_error,*998)
8217 998 errorsexits("Field_InterpolatedPointsMetricsInitialise",err,error)
8218  RETURN 1
8219  END SUBROUTINE field_interpolatedpointsmetricsinitialise
8220 
8221  !
8222  !================================================================================================================================
8223  !
8224 
8226  SUBROUTINE field_interpolation_parameter_finalise(INTERPOLATION_PARAMETERS,ERR,ERROR,*)
8227 
8228  !Argument variables
8229  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
8230  INTEGER(INTG), INTENT(OUT) :: err
8231  TYPE(varying_string), INTENT(OUT) :: error
8232  !Local Variables
8233 
8234  enters("FIELD_INTERPOLATION_PARAMETER_FINALISE",err,error,*999)
8235 
8236  IF(ASSOCIATED(interpolation_parameters)) THEN
8237  IF(ALLOCATED(interpolation_parameters%BASES)) DEALLOCATE(interpolation_parameters%BASES)
8238  IF(ALLOCATED(interpolation_parameters%NUMBER_OF_PARAMETERS)) DEALLOCATE(interpolation_parameters%NUMBER_OF_PARAMETERS)
8239  IF(ALLOCATED(interpolation_parameters%PARAMETERS)) DEALLOCATE(interpolation_parameters%PARAMETERS)
8240  IF(ALLOCATED(interpolation_parameters%SCALE_FACTORS)) DEALLOCATE(interpolation_parameters%SCALE_FACTORS)
8241  DEALLOCATE(interpolation_parameters)
8242  ENDIF
8243 
8244  exits("FIELD_INTERPOLATION_PARAMETER_FINALISE")
8245  RETURN
8246 999 errorsexits("FIELD_INTERPOLATION_PARAMETER_FINALISE",err,error)
8247  RETURN 1
8248  END SUBROUTINE field_interpolation_parameter_finalise
8249 
8250  !
8251  !================================================================================================================================
8252  !
8253 
8255  SUBROUTINE field_interpolation_parameter_initialise(FIELD_VARIABLE,INTERPOLATION_PARAMETERS,ERR,ERROR,*,componentType)
8256 
8257  !Argument variables
8258  TYPE(field_variable_type), POINTER :: field_variable
8259  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
8260  INTEGER(INTG), INTENT(OUT) :: err
8261  TYPE(varying_string), INTENT(OUT) :: error
8262  INTEGER(INTG), OPTIONAL, INTENT(IN) :: componenttype
8263  !Local Variables
8264  INTEGER(INTG) :: component_idx,dummy_err,numberofcomponents
8265 
8266  TYPE(field_type), POINTER :: field
8267  TYPE(varying_string) :: dummy_error,localerror
8268 
8269  enters("FIELD_INTERPOLATION_PARAMETER_INITIALISE",err,error,*998)
8270 
8271  IF(ASSOCIATED(field_variable)) THEN
8272  field=>field_variable%FIELD
8273  IF(ASSOCIATED(field)) THEN
8274  IF(ASSOCIATED(interpolation_parameters)) THEN
8275  CALL flagerror("Interpolation parameters is already associated.",err,error,*998)
8276  ELSE
8277  ALLOCATE(interpolation_parameters,stat=err)
8278  IF(err/=0) CALL flagerror("Could not allocate an interpolation parameter.",err,error,*999)
8279  interpolation_parameters%FIELD=>field
8280  interpolation_parameters%FIELD_VARIABLE=>field_variable
8281  interpolation_parameters%NUMBER_OF_XI=0
8282  !Calculate the number of components required
8283  IF(PRESENT(componenttype)) THEN
8284  SELECT CASE(componenttype)
8285  CASE(field_all_components_type)
8286  numberofcomponents=interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
8287  CASE(field_geometric_components_type)
8288  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
8289  numberofcomponents=interpolation_parameters%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(field_u_variable_type)%PTR% &
8290  & number_of_components
8291  ELSEIF(interpolation_parameters%FIELD%TYPE==field_geometric_type) THEN
8292  numberofcomponents=interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
8293  ELSE
8294  localerror="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
8295  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
8296  CALL flagerror(localerror,err,error,*999)
8297  ENDIF
8298  CASE(field_nongeometric_components_type)
8299  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
8300  numberofcomponents=interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS-interpolation_parameters% &
8301  & field%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(field_u_variable_type)%PTR%NUMBER_OF_COMPONENTS
8302  ELSE
8303  localerror="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
8304  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
8305  CALL flagerror(localerror,err,error,*999)
8306  ENDIF
8307  CASE DEFAULT
8308  localerror="Interpolation component type "//trim(number_to_vstring(componenttype,"*",err,error))//" is not valid."
8309  CALL flagerror(localerror,err,error,*999)
8310  END SELECT
8311  ELSE
8312  numberofcomponents=interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
8313  ENDIF
8314  ALLOCATE(interpolation_parameters%BASES(numberofcomponents),stat=err)
8315  IF(err/=0) CALL flagerror("Could not allocate bases.",err,error,*999)
8316  ALLOCATE(interpolation_parameters%NUMBER_OF_PARAMETERS(numberofcomponents),stat=err)
8317  IF(err/=0) CALL flagerror("Could not allocate interpolation type.",err,error,*999)
8318  ALLOCATE(interpolation_parameters%PARAMETERS(field_variable%maxNumberElementInterpolationParameters, &
8319  & numberofcomponents),stat=err)
8320  IF(err/=0) CALL flagerror("Could not allocate parameters.",err,error,*999)
8321  interpolation_parameters%PARAMETERS=0.0_dp
8322  IF(field%SCALINGS%SCALING_TYPE/=field_no_scaling) THEN
8323  ALLOCATE(interpolation_parameters%SCALE_FACTORS(field_variable%maxNumberElementInterpolationParameters, &
8324  & numberofcomponents),stat=err)
8325  IF(err/=0) CALL flagerror("Could not allocate scale factors.",err,error,*999)
8326  interpolation_parameters%SCALE_FACTORS=0.0_dp
8327  ENDIF
8328  DO component_idx=1,numberofcomponents
8329  NULLIFY(interpolation_parameters%BASES(component_idx)%PTR)
8330  ENDDO !component_idx
8331  interpolation_parameters%NUMBER_OF_PARAMETERS=0
8332  ENDIF
8333  ELSE
8334  CALL flagerror("Field variable field is not associated.",err,error,*998)
8335  ENDIF
8336  ELSE
8337  CALL flagerror("Field is not associated.",err,error,*998)
8338  ENDIF
8339 
8340  exits("FIELD_INTERPOLATION_PARAMETER_INITIALISE")
8341  RETURN
8342 999 CALL field_interpolation_parameter_finalise(interpolation_parameters,dummy_err,dummy_error,*998)
8343 998 errorsexits("FIELD_INTERPOLATION_PARAMETER_INITIALISE",err,error)
8344  RETURN 1
8345  END SUBROUTINE field_interpolation_parameter_initialise
8346 
8347  !
8348  !================================================================================================================================
8349  !
8350 
8352  SUBROUTINE field_interpolation_parameters_element_get(PARAMETER_SET_TYPE,ELEMENT_NUMBER,INTERPOLATION_PARAMETERS,ERR,ERROR,*, &
8353  & componenttype)
8354 
8355  !Argument variables
8356  INTEGER(INTG), INTENT(IN) :: parameter_set_type
8357  INTEGER(INTG), INTENT(IN) :: element_number
8358  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
8359  INTEGER(INTG), INTENT(OUT) :: err
8360  TYPE(varying_string), INTENT(OUT) :: error
8361  INTEGER(INTG), OPTIONAL, INTENT(IN) :: componenttype
8362  !Local Variables
8363  INTEGER(INTG) :: component_idx,local_derivative_idx,version_idx,global_derivative_idx,element_node_idx,node_idx, &
8364  & element_parameter_idx,dof_idx,node_scaling_dof_idx,scaling_idx,startComponentIdx,endComponentIdx
8365  REAL(DP), POINTER :: field_parameter_set_data(:),scale_factors(:)
8366  TYPE(basis_type), POINTER :: basis
8367  TYPE(coordinate_system_type), POINTER :: coordinate_system
8368  TYPE(domain_elements_type), POINTER :: elements_topology
8369  TYPE(domain_nodes_type), POINTER :: nodes_topology
8370  TYPE(field_type), POINTER :: field
8371  TYPE(field_parameter_set_type), POINTER :: parameter_set
8372  TYPE(varying_string) :: local_error
8373 
8374  enters("FIELD_INTERPOLATION_PARAMETERS_ELEMENT_GET",err,error,*999)
8375 
8376  IF(ASSOCIATED(interpolation_parameters)) THEN
8377  IF(parameter_set_type>0.AND.parameter_set_type<=field_number_of_set_types) THEN
8378  parameter_set=>interpolation_parameters%FIELD_VARIABLE%PARAMETER_SETS%SET_TYPE(parameter_set_type)%PTR
8379  IF(ASSOCIATED(parameter_set)) THEN
8380  NULLIFY(field_parameter_set_data)
8381  CALL distributed_vector_data_get(parameter_set%PARAMETERS,field_parameter_set_data,err,error,*999)
8382  field=>interpolation_parameters%FIELD
8383  IF(ASSOCIATED(field)) THEN
8384  NULLIFY(coordinate_system)
8385  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
8386  IF(PRESENT(componenttype)) THEN
8387  SELECT CASE(componenttype)
8388  CASE(field_all_components_type)
8389  startcomponentidx=1
8390  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8391  CASE(field_geometric_components_type)
8392  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
8393  startcomponentidx=1
8394  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(FIELD_U_VARIABLE_TYPE)%PTR% &
8395  & number_of_components
8396  ELSEIF(interpolation_parameters%FIELD%TYPE==field_geometric_type) THEN
8397  startcomponentidx=1
8398  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8399  ELSE
8400  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
8401  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
8402  CALL flagerror(local_error,err,error,*999)
8403  ENDIF
8404  CASE(field_nongeometric_components_type)
8405  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
8406  startcomponentidx=interpolation_parameters%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(field_u_variable_type)% &
8407  & ptr%NUMBER_OF_COMPONENTS+1
8408  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8409  ELSE
8410  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
8411  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
8412  CALL flagerror(local_error,err,error,*999)
8413  ENDIF
8414  CASE DEFAULT
8415  local_error="Interpolation component type "//trim(number_to_vstring(componenttype,"*",err,error))//" is not valid."
8416  CALL flagerror(local_error,err,error,*999)
8417  END SELECT
8418  ELSE
8419  startcomponentidx=1
8420  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8421  ENDIF
8422  DO component_idx=startcomponentidx,endcomponentidx
8423  elements_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%ELEMENTS
8424  IF(element_number>0.AND.element_number<=elements_topology%TOTAL_NUMBER_OF_ELEMENTS) THEN
8425  basis=>elements_topology%ELEMENTS(element_number)%BASIS
8426  interpolation_parameters%BASES(component_idx)%PTR=>basis
8427  IF(component_idx==1) THEN
8428  interpolation_parameters%NUMBER_OF_XI=basis%NUMBER_OF_XI
8429  ELSE
8430  IF(basis%NUMBER_OF_XI/=interpolation_parameters%NUMBER_OF_XI) &
8431  & CALL flagerror("Inconsistent number of xi directions???",err,error,*999)
8432  ENDIF
8433  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
8434  CASE(field_constant_interpolation)
8435  dof_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%PARAM_TO_DOF_MAP% &
8436  & constant_param2dof_map
8437  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
8438  interpolation_parameters%PARAMETERS(1,component_idx)=field_parameter_set_data(dof_idx)
8439  CASE(field_element_based_interpolation)
8440  dof_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%PARAM_TO_DOF_MAP% &
8441  & element_param2dof_map%ELEMENTS(element_number)
8442  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
8443  interpolation_parameters%PARAMETERS(1,component_idx)=field_parameter_set_data(dof_idx)
8444  CASE(field_node_based_interpolation)
8445  elements_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%ELEMENTS
8446  nodes_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%NODES
8447  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=basis%NUMBER_OF_ELEMENT_PARAMETERS
8448  SELECT CASE(interpolation_parameters%FIELD%SCALINGS%SCALING_TYPE)
8449  CASE(field_no_scaling)
8450  DO element_node_idx=1,basis%NUMBER_OF_NODES
8451  node_idx=elements_topology%ELEMENTS(element_number)%ELEMENT_NODES(element_node_idx)
8452  DO local_derivative_idx=1,basis%NUMBER_OF_DERIVATIVES(element_node_idx)
8453  global_derivative_idx=elements_topology%ELEMENTS(element_number)%ELEMENT_DERIVATIVES( &
8454  & local_derivative_idx,element_node_idx)
8455  version_idx=elements_topology%ELEMENTS(element_number)%elementVersions(local_derivative_idx, &
8456  & element_node_idx)
8457  element_parameter_idx=basis%ELEMENT_PARAMETER_INDEX(local_derivative_idx,element_node_idx)
8458  dof_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%PARAM_TO_DOF_MAP% &
8459  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(global_derivative_idx)%VERSIONS(version_idx)
8460  interpolation_parameters%PARAMETERS(element_parameter_idx,component_idx)=field_parameter_set_data(dof_idx)
8461  ENDDO !local_derivative_idx
8462  ENDDO !element_node_idx
8463  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
8464  scaling_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%SCALING_INDEX
8465  NULLIFY(scale_factors)
8466  CALL distributed_vector_data_get(interpolation_parameters%FIELD%SCALINGS%SCALINGS(scaling_idx)% &
8467  & scale_factors,scale_factors,err,error,*999)
8468  DO element_node_idx=1,basis%NUMBER_OF_NODES
8469  node_idx=elements_topology%ELEMENTS(element_number)%ELEMENT_NODES(element_node_idx)
8470  DO local_derivative_idx=1,basis%NUMBER_OF_DERIVATIVES(element_node_idx)
8471  global_derivative_idx=elements_topology%ELEMENTS(element_number)%ELEMENT_DERIVATIVES( &
8472  & local_derivative_idx,element_node_idx)
8473  version_idx=elements_topology%ELEMENTS(element_number)%elementVersions( &
8474  & local_derivative_idx,element_node_idx)
8475  element_parameter_idx=basis%ELEMENT_PARAMETER_INDEX(global_derivative_idx,element_node_idx)
8476  dof_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%PARAM_TO_DOF_MAP% &
8477  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(global_derivative_idx)%VERSIONS(version_idx)
8478  node_scaling_dof_idx= &
8479  & nodes_topology%NODES(node_idx)%DERIVATIVES(global_derivative_idx)%DOF_INDEX(version_idx)
8480  !INTERPOLATION_PARAMETERS%PARAMETERS(element_parameter_idx,component_idx)=FIELD_PARAMETER_SET_DATA(dof_idx)* &
8481  ! & INTERPOLATION_PARAMETERS%FIELD%SCALINGS%SCALINGS(scaling_idx)%SCALE_FACTORS(element_parameter_idx,ELEMENT_NUMBER)
8482  !INTERPOLATION_PARAMETERS%PARAMETERS(element_parameter_idx,component_idx)=FIELD_PARAMETER_SET_DATA(dof_idx)* &
8483  ! & INTERPOLATION_PARAMETERS%FIELD%SCALINGS%SCALINGS(scaling_idx)%SCALE_FACTORS(global_derivative_idx,node_idx)
8484  interpolation_parameters%PARAMETERS(element_parameter_idx,component_idx)=field_parameter_set_data( &
8485  & dof_idx)*scale_factors(node_scaling_dof_idx)
8486  interpolation_parameters%SCALE_FACTORS(element_parameter_idx,component_idx)=scale_factors( &
8487  & node_scaling_dof_idx)
8488  ENDDO !local_derivative_idx
8489  ENDDO !element_node_idx
8490  CALL distributed_vector_data_restore(interpolation_parameters%FIELD%SCALINGS%SCALINGS(scaling_idx)% &
8491  & scale_factors,scale_factors,err,error,*999)
8492  CASE(field_arc_length_scaling)
8493  CALL flagerror("Not implemented.",err,error,*999)
8494  CASE DEFAULT
8495  local_error="The scaling type of "//trim(number_to_vstring(interpolation_parameters%FIELD%SCALINGS% &
8496  & scaling_type,"*",err,error))//" is invalid for field number "// &
8497  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8498  CALL flagerror(local_error,err,error,*999)
8499  END SELECT
8500  CASE(field_gauss_point_based_interpolation)
8501  CALL flagerror("Not implemented.",err,error,*999)
8502  CASE(field_data_point_based_interpolation)
8503  CALL flagerror("Not implemented.",err,error,*999)
8504  CASE DEFAULT
8505  local_error="The interpolation type of "//trim(number_to_vstring(interpolation_parameters%FIELD_VARIABLE% &
8506  & components(component_idx)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
8507  & trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
8508  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8509  CALL flagerror(local_error,err,error,*999)
8510  END SELECT
8511  ELSE
8512  local_error="The element number of "//trim(number_to_vstring(element_number,"*",err,error))// &
8513  & " is invalid. The number must be between 1 and "// &
8514  & trim(number_to_vstring(elements_topology%TOTAL_NUMBER_OF_ELEMENTS,"*",err,error))// &
8515  & " for component number "//trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
8516  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8517  CALL flagerror(local_error,err,error,*999)
8518  ENDIF
8519  ENDDO !component_idx
8520  CALL coordinate_interpolation_parameters_adjust(coordinate_system,interpolation_parameters,err,error,*999)
8521  ELSE
8522  CALL flagerror("The interpolation parameters field is not associated.",err,error,*999)
8523  ENDIF
8524  CALL distributed_vector_data_restore(parameter_set%PARAMETERS,field_parameter_set_data,err,error,*999)
8525  ELSE
8526  local_error="The field parameter set type of "//trim(number_to_vstring(parameter_set_type,"*",err,error))// &
8527  & " has not been created for field number "// &
8528  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8529  CALL flagerror(local_error,err,error,*999)
8530  ENDIF
8531  ELSE
8532  local_error="The field parameter set type of "//trim(number_to_vstring(parameter_set_type,"*",err,error))// &
8533  & " is invalid. The number must be between 1 and "//trim(number_to_vstring(field_number_of_set_types,"*",err,error))// &
8534  & " for field number "//trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8535  CALL flagerror(local_error,err,error,*999)
8536  ENDIF
8537  ELSE
8538  CALL flagerror("Interpolation parameters is not associated.",err,error,*999)
8539  ENDIF
8540 
8541  IF(diagnostics1) THEN
8542  CALL write_string(diagnostic_output_type,"Interpolation parameters:",err,error,*999)
8543  CALL write_string_value(diagnostic_output_type," Field number = ",interpolation_parameters%FIELD%USER_NUMBER,err,error,*999)
8544  CALL write_string_value(diagnostic_output_type," Field variable number = ",interpolation_parameters%FIELD_VARIABLE% &
8545  & variable_number,err,error,*999)
8546  CALL write_string_value(diagnostic_output_type," Parameter set type = ",parameter_set_type,err,error,*999)
8547  CALL write_string_value(diagnostic_output_type," Element number = ",element_number,err,error,*999)
8548  CALL write_string_value(diagnostic_output_type," Number of components = ",interpolation_parameters%FIELD_VARIABLE% &
8549  & number_of_components,err,error,*999)
8550  DO component_idx=startcomponentidx,endcomponentidx
8551  CALL write_string_value(diagnostic_output_type," Component = ",component_idx,err,error,*999)
8552  CALL write_string_value(diagnostic_output_type," Number of parameters = ",interpolation_parameters% &
8553  & number_of_parameters(component_idx),err,error,*999)
8554  CALL write_string_vector(diagnostic_output_type,1,1,interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx),4,4, &
8555  & interpolation_parameters%PARAMETERS(:,component_idx),'(" Parameters :",4(X,E13.6))','(18X,4(X,E13.6))', &
8556  & err,error,*999)
8557  ENDDO !component_idx
8558  ENDIF
8559 
8560  exits("FIELD_INTERPOLATION_PARAMETERS_ELEMENT_GET")
8561  RETURN
8562 999 errorsexits("FIELD_INTERPOLATION_PARAMETERS_ELEMENT_GET",err,error)
8563  RETURN 1
8564  END SUBROUTINE field_interpolation_parameters_element_get
8565 
8566  !
8567  !================================================================================================================================
8568  !
8569 
8571  SUBROUTINE field_interpolation_parameters_finalise(INTERPOLATION_PARAMETERS,ERR,ERROR,*)
8572 
8573  !Argument variables
8574  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolation_parameters(:)
8575  INTEGER(INTG), INTENT(OUT) :: err
8576  TYPE(varying_string), INTENT(OUT) :: error
8577  !Local Variables
8578  INTEGER(INTG) :: var_type_idx
8579 
8580  enters("FIELD_INTERPOLATION_PARAMETERS_FINALISE",err,error,*999)
8581 
8582  IF(ASSOCIATED(interpolation_parameters)) THEN
8583  DO var_type_idx=1,SIZE(interpolation_parameters,1)
8584  CALL field_interpolation_parameter_finalise(interpolation_parameters(var_type_idx)%PTR,err,error,*999)
8585  ENDDO !var_type_idx
8586  DEALLOCATE(interpolation_parameters)
8587  ENDIF
8588 
8589  exits("FIELD_INTERPOLATION_PARAMETERS_FINALISE")
8590  RETURN
8591 999 errorsexits("FIELD_INTERPOLATION_PARAMETERS_FINALISE",err,error)
8592  RETURN 1
8593  END SUBROUTINE field_interpolation_parameters_finalise
8594 
8595  !
8596  !================================================================================================================================
8597  !
8598 
8600  SUBROUTINE field_interpolation_parameters_initialise(FIELD,INTERPOLATION_PARAMETERS,ERR,ERROR,*,componentType)
8601 
8602  !Argument variables
8603  TYPE(field_type), POINTER :: field
8604  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolation_parameters(:)
8605  INTEGER(INTG), INTENT(OUT) :: err
8606  TYPE(varying_string), INTENT(OUT) :: error
8607  INTEGER(INTG), OPTIONAL, INTENT(IN) :: componenttype
8608  !Local Variables
8609  INTEGER(INTG) :: dummy_err,var_type_idx
8610  TYPE(field_variable_type), POINTER :: field_variable
8611  TYPE(varying_string) :: dummy_error,local_error
8612 
8613  enters("FIELD_INTERPOLATION_PARAMETERS_INITIALISE",err,error,*998)
8614 
8615  IF(ASSOCIATED(field)) THEN
8616  IF(field%FIELD_FINISHED) THEN
8617  IF(ASSOCIATED(interpolation_parameters)) THEN
8618  CALL flagerror("Interpolation parameters is already associated.",err,error,*998)
8619  ELSE
8620  ALLOCATE(interpolation_parameters(field_number_of_variable_types),stat=err)
8621  IF(err/=0) CALL flagerror("Could not allocate the interpolation parameters.",err,error,*999)
8622  DO var_type_idx=1,field_number_of_variable_types
8623  NULLIFY(interpolation_parameters(var_type_idx)%PTR)
8624  field_variable=>field%VARIABLE_TYPE_MAP(var_type_idx)%PTR
8625  IF(PRESENT(componenttype)) THEN
8626  IF(ASSOCIATED(field_variable)) CALL field_interpolation_parameter_initialise(field_variable, &
8627  & interpolation_parameters(var_type_idx)%PTR,err,error,*999,componenttype)
8628  ELSE
8629  IF(ASSOCIATED(field_variable)) CALL field_interpolation_parameter_initialise(field_variable, &
8630  & interpolation_parameters(var_type_idx)%PTR,err,error,*999)
8631  ENDIF
8632  ENDDO !var_type_idx
8633  ENDIF
8634  ELSE
8635  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
8636  & " has not been finished."
8637  CALL flagerror(local_error,err,error,*998)
8638  ENDIF
8639  ELSE
8640  CALL flagerror("Field is not associated.",err,error,*998)
8641  ENDIF
8642 
8643  exits("FIELD_INTERPOLATION_PARAMETERS_INITIALISE")
8644  RETURN
8645 999 CALL field_interpolation_parameters_finalise(interpolation_parameters,dummy_err,dummy_error,*998)
8646 998 errorsexits("FIELD_INTERPOLATION_PARAMETERS_INITIALISE",err,error)
8647  RETURN 1
8648  END SUBROUTINE field_interpolation_parameters_initialise
8649 
8650  !
8651  !================================================================================================================================
8652  !
8653 
8655  SUBROUTINE field_interpolation_parameters_line_get(PARAMETER_SET_TYPE,LINE_NUMBER,INTERPOLATION_PARAMETERS,ERR,ERROR,*, &
8656  & componenttype)
8657 
8658  !Argument variables
8659  INTEGER(INTG), INTENT(IN) :: parameter_set_type
8660  INTEGER(INTG), INTENT(IN) :: line_number
8661  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
8662  INTEGER(INTG), INTENT(OUT) :: err
8663  TYPE(varying_string), INTENT(OUT) :: error
8664  INTEGER(INTG), OPTIONAL, INTENT(IN) :: componenttype
8665  !Local Variables
8666  INTEGER(INTG) :: component_idx,basis_derivative_idx,derivative_idx,basis_node_idx,version_idx,node_idx,element_parameter_idx, &
8667  & dof_idx,node_scaling_dof_idx,scaling_idx,startComponentIdx,endComponentIdx
8668  REAL(DP), POINTER :: field_parameter_set_data(:),scale_factors(:)
8669  TYPE(basis_type), POINTER :: basis
8670  TYPE(coordinate_system_type), POINTER :: coordinate_system
8671  TYPE(domain_lines_type), POINTER :: lines_topology
8672  TYPE(domain_nodes_type), POINTER :: nodes_topology
8673  TYPE(field_type), POINTER :: field
8674  TYPE(field_parameter_set_type), POINTER :: parameter_set
8675  TYPE(varying_string) :: local_error
8676 
8677  enters("FIELD_INTERPOLATION_PARAMETERS_LINE_GET",err,error,*999)
8678 
8679  IF(ASSOCIATED(interpolation_parameters)) THEN
8680  IF(parameter_set_type>0.AND.parameter_set_type<=field_number_of_set_types) THEN
8681  parameter_set=>interpolation_parameters%FIELD_VARIABLE%PARAMETER_SETS%SET_TYPE(parameter_set_type)%PTR
8682  IF(ASSOCIATED(parameter_set)) THEN
8683  NULLIFY(field_parameter_set_data)
8684  CALL distributed_vector_data_get(parameter_set%PARAMETERS,field_parameter_set_data,err,error,*999)
8685  field=>interpolation_parameters%FIELD
8686  IF(ASSOCIATED(field)) THEN
8687  NULLIFY(coordinate_system)
8688  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
8689  IF(PRESENT(componenttype)) THEN
8690  SELECT CASE(componenttype)
8691  CASE(field_all_components_type)
8692  startcomponentidx=1
8693  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8694  CASE(field_geometric_components_type)
8695  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
8696  startcomponentidx=1
8697  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(FIELD_U_VARIABLE_TYPE)%PTR% &
8698  & number_of_components
8699  ELSEIF(interpolation_parameters%FIELD%TYPE==field_geometric_type) THEN
8700  startcomponentidx=1
8701  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8702  ELSE
8703  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
8704  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
8705  CALL flagerror(local_error,err,error,*999)
8706  ENDIF
8707  CASE(field_nongeometric_components_type)
8708  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
8709  startcomponentidx=interpolation_parameters%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(field_u_variable_type)% &
8710  & ptr%NUMBER_OF_COMPONENTS+1
8711  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8712  ELSE
8713  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
8714  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
8715  CALL flagerror(local_error,err,error,*999)
8716  ENDIF
8717  CASE DEFAULT
8718  local_error="Interpolation component type "//trim(number_to_vstring(componenttype,"*",err,error))//" is not valid."
8719  CALL flagerror(local_error,err,error,*999)
8720  END SELECT
8721  ELSE
8722  startcomponentidx=1
8723  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8724  ENDIF
8725  DO component_idx=startcomponentidx,endcomponentidx
8726  lines_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%LINES
8727  IF(line_number>0.AND.line_number<=lines_topology%NUMBER_OF_LINES) THEN
8728  basis=>lines_topology%LINES(line_number)%BASIS
8729  interpolation_parameters%BASES(component_idx)%PTR=>basis
8730  IF(component_idx==1) THEN
8731  interpolation_parameters%NUMBER_OF_XI=basis%NUMBER_OF_XI
8732  ELSE
8733  IF(basis%NUMBER_OF_XI/=interpolation_parameters%NUMBER_OF_XI) &
8734  & CALL flagerror("Inconsistent number of xi directions???",err,error,*999)
8735  ENDIF
8736  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
8737  CASE(field_constant_interpolation)
8738  CALL flagerror("Not implemented.",err,error,*999)
8739  CASE(field_element_based_interpolation)
8740  CALL flagerror("Not implemented.",err,error,*999)
8741  CASE(field_node_based_interpolation)
8742  nodes_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%NODES
8743  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=basis%NUMBER_OF_ELEMENT_PARAMETERS
8744  SELECT CASE(interpolation_parameters%FIELD%SCALINGS%SCALING_TYPE)
8745  CASE(field_no_scaling)
8746  DO basis_node_idx=1,basis%NUMBER_OF_NODES
8747  node_idx=lines_topology%LINES(line_number)%NODES_IN_LINE(basis_node_idx)
8748  DO basis_derivative_idx=1,basis%NUMBER_OF_DERIVATIVES(basis_node_idx)
8749  derivative_idx=lines_topology%LINES(line_number)%DERIVATIVES_IN_LINE(1,basis_derivative_idx,basis_node_idx)
8750  version_idx=lines_topology%LINES(line_number)%DERIVATIVES_IN_LINE(2,basis_derivative_idx,basis_node_idx)
8751  element_parameter_idx=basis%ELEMENT_PARAMETER_INDEX(basis_derivative_idx,basis_node_idx)
8752  dof_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%PARAM_TO_DOF_MAP% &
8753  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(derivative_idx)%VERSIONS(version_idx)
8754  interpolation_parameters%PARAMETERS(element_parameter_idx,component_idx)=field_parameter_set_data(dof_idx)
8755  ENDDO !basis_derivative_idx
8756  ENDDO !basis_node_idx
8757  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
8758  scaling_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%SCALING_INDEX
8759  NULLIFY(scale_factors)
8760  CALL distributed_vector_data_get(interpolation_parameters%FIELD%SCALINGS%SCALINGS(scaling_idx)% &
8761  & scale_factors,scale_factors,err,error,*999)
8762  DO basis_node_idx=1,basis%NUMBER_OF_NODES
8763  node_idx=lines_topology%LINES(line_number)%NODES_IN_LINE(basis_node_idx)
8764  DO basis_derivative_idx=1,basis%NUMBER_OF_DERIVATIVES(basis_node_idx)
8765  derivative_idx=lines_topology%LINES(line_number)%DERIVATIVES_IN_LINE(1,basis_derivative_idx,basis_node_idx)
8766  version_idx=lines_topology%LINES(line_number)%DERIVATIVES_IN_LINE(2,basis_derivative_idx,basis_node_idx)
8767  element_parameter_idx=basis%ELEMENT_PARAMETER_INDEX(basis_derivative_idx,basis_node_idx)
8768  dof_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%PARAM_TO_DOF_MAP% &
8769  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(derivative_idx)%VERSIONS(version_idx)
8770  node_scaling_dof_idx= &
8771  & nodes_topology%NODES(node_idx)%DERIVATIVES(derivative_idx)%DOF_INDEX(version_idx)
8772  !INTERPOLATION_PARAMETERS%PARAMETERS(element_parameter_idx,component_idx)=FIELD_PARAMETER_SET_DATA(dof_idx)* &
8773  ! & INTERPOLATION_PARAMETERS%FIELD%SCALINGS%SCALINGS(scaling_idx)%SCALE_FACTORS(derivative_idx,node_idx)
8774  interpolation_parameters%PARAMETERS(element_parameter_idx,component_idx)= &
8775  & field_parameter_set_data(dof_idx)*scale_factors(node_scaling_dof_idx)
8776  interpolation_parameters%SCALE_FACTORS(element_parameter_idx,component_idx)= &
8777  & scale_factors(node_scaling_dof_idx)
8778  ENDDO !basis_derivative_idx
8779  ENDDO !basis_node_idx
8780  CASE(field_arc_length_scaling)
8781  CALL flagerror("Not implemented.",err,error,*999)
8782  CASE DEFAULT
8783  local_error="The scaling type of "//trim(number_to_vstring(interpolation_parameters%FIELD%SCALINGS% &
8784  & scaling_type,"*",err,error))//" is invalid for field number "// &
8785  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8786  CALL flagerror(local_error,err,error,*999)
8787  END SELECT
8788  CASE(field_grid_point_based_interpolation)
8789  CALL flagerror("Not implemented.",err,error,*999)
8790  CASE(field_gauss_point_based_interpolation)
8791  CALL flagerror("Not implemented.",err,error,*999)
8792  CASE(field_data_point_based_interpolation)
8793  CALL flagerror("Not implemented.",err,error,*999)
8794  CASE DEFAULT
8795  local_error="The interpolation type of "//trim(number_to_vstring(interpolation_parameters%FIELD_VARIABLE% &
8796  & components(component_idx)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
8797  & trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
8798  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8799  CALL flagerror(local_error,err,error,*999)
8800  END SELECT
8801  ELSE
8802  local_error="The line number of "//trim(number_to_vstring(line_number,"*",err,error))// &
8803  & " is invalid. The number must be between 1 and "// &
8804  & trim(number_to_vstring(lines_topology%NUMBER_OF_LINES,"*",err,error))// &
8805  & " for component number "//trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
8806  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8807  CALL flagerror(local_error,err,error,*999)
8808 
8809  ENDIF
8810  ENDDO !component_idx
8811  CALL coordinate_interpolation_parameters_adjust(coordinate_system,interpolation_parameters,err,error,*999)
8812  ELSE
8813  CALL flagerror("The interpolation parameters field is not associated.",err,error,*999)
8814  ENDIF
8815  CALL distributed_vector_data_restore(parameter_set%PARAMETERS,field_parameter_set_data,err,error,*999)
8816  ELSE
8817  local_error="The field parameter set type of "//trim(number_to_vstring(parameter_set_type,"*",err,error))// &
8818  & " has not been created for field number "// &
8819  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8820  CALL flagerror(local_error,err,error,*999)
8821  ENDIF
8822  ELSE
8823  local_error="The field parameter set type of "//trim(number_to_vstring(parameter_set_type,"*",err,error))// &
8824  & " is invalid. The number must be between 1 and "//trim(number_to_vstring(field_number_of_set_types,"*",err,error))// &
8825  & " for field number "//trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8826  CALL flagerror(local_error,err,error,*999)
8827  ENDIF
8828  ELSE
8829  CALL flagerror("Interpolation parameters is not associated.",err,error,*999)
8830  ENDIF
8831 
8832  IF(diagnostics1) THEN
8833  CALL write_string(diagnostic_output_type,"Interpolation parameters:",err,error,*999)
8834  CALL write_string_value(diagnostic_output_type," Field number = ",interpolation_parameters%FIELD%USER_NUMBER,err,error,*999)
8835  CALL write_string_value(diagnostic_output_type," Field variable number = ",interpolation_parameters%FIELD_VARIABLE% &
8836  & variable_number,err,error,*999)
8837  CALL write_string_value(diagnostic_output_type," Parameter set type = ",parameter_set_type,err,error,*999)
8838  CALL write_string_value(diagnostic_output_type," Line number = ",line_number,err,error,*999)
8839  CALL write_string_value(diagnostic_output_type," Total number of components = ", &
8840  & interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS,err,error,*999)
8841  CALL write_string_value(diagnostic_output_type," Interpolation number of components = ", &
8842  & endcomponentidx-startcomponentidx+1,err,error,*999)
8843  DO component_idx=startcomponentidx,endcomponentidx
8844  CALL write_string_value(diagnostic_output_type," Component = ",component_idx,err,error,*999)
8845  CALL write_string_value(diagnostic_output_type," Number of parameters = ",interpolation_parameters% &
8846  & number_of_parameters(component_idx),err,error,*999)
8847  CALL write_string_vector(diagnostic_output_type,1,1,interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx),4,4, &
8848  & interpolation_parameters%PARAMETERS(:,component_idx),'(" Parameters :",4(X,E13.6))','(18X,4(X,E13.6))', &
8849  & err,error,*999)
8850  ENDDO !component_idx
8851  ENDIF
8852 
8853  exits("FIELD_INTERPOLATION_PARAMETERS_LINE_GET")
8854  RETURN
8855 999 errorsexits("FIELD_INTERPOLATION_PARAMETERS_LINE_GET",err,error)
8856  RETURN 1
8857  END SUBROUTINE field_interpolation_parameters_line_get
8858 
8859  !
8860  !================================================================================================================================
8861  !
8863  SUBROUTINE field_interpolation_parameters_face_get(PARAMETER_SET_TYPE,FACE_NUMBER,INTERPOLATION_PARAMETERS,ERR,ERROR,*, &
8864  & componenttype)
8865 
8866  !Argument variables
8867  INTEGER(INTG), INTENT(IN) :: parameter_set_type
8868  INTEGER(INTG), INTENT(IN) :: face_number
8869  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
8870  INTEGER(INTG), INTENT(OUT) :: err
8871  TYPE(varying_string), INTENT(OUT) :: error
8872  INTEGER(INTG), OPTIONAL, INTENT(IN) :: componenttype
8873  !Local Variables
8874  INTEGER(INTG) :: component_idx,basis_derivative_idx,derivative_idx,version_idx,basis_node_idx,node_idx,element_parameter_idx, &
8875  & dof_idx,node_scaling_dof_idx,scaling_idx,startComponentIdx,endComponentIdx
8876  REAL(DP), POINTER :: field_parameter_set_data(:),scale_factors(:)
8877  TYPE(basis_type), POINTER :: basis
8878  TYPE(coordinate_system_type), POINTER :: coordinate_system
8879  TYPE(domain_faces_type), POINTER :: faces_topology
8880  TYPE(domain_nodes_type), POINTER :: nodes_topology
8881  TYPE(field_type), POINTER :: field
8882  TYPE(field_parameter_set_type), POINTER :: parameter_set
8883  TYPE(varying_string) :: local_error
8884 
8885  enters("FIELD_INTERPOLATION_PARAMETERS_FACE_GET",err,error,*999)
8886 
8887  IF(ASSOCIATED(interpolation_parameters)) THEN
8888  IF(parameter_set_type>0.AND.parameter_set_type<=field_number_of_set_types) THEN
8889  parameter_set=>interpolation_parameters%FIELD_VARIABLE%PARAMETER_SETS%SET_TYPE(parameter_set_type)%PTR
8890  IF(ASSOCIATED(parameter_set)) THEN
8891  NULLIFY(field_parameter_set_data)
8892  CALL distributed_vector_data_get(parameter_set%PARAMETERS,field_parameter_set_data,err,error,*999)
8893  field=>interpolation_parameters%FIELD
8894  IF(ASSOCIATED(field)) THEN
8895  NULLIFY(coordinate_system)
8896  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
8897  IF(PRESENT(componenttype)) THEN
8898  SELECT CASE(componenttype)
8899  CASE(field_all_components_type)
8900  startcomponentidx=1
8901  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8902  CASE(field_geometric_components_type)
8903  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
8904  startcomponentidx=1
8905  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(FIELD_U_VARIABLE_TYPE)%PTR% &
8906  & number_of_components
8907  ELSEIF(interpolation_parameters%FIELD%TYPE==field_geometric_type) THEN
8908  startcomponentidx=1
8909  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8910  ELSE
8911  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
8912  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
8913  CALL flagerror(local_error,err,error,*999)
8914  ENDIF
8915  CASE(field_nongeometric_components_type)
8916  IF(interpolation_parameters%FIELD%TYPE==field_geometric_general_type) THEN
8917  startcomponentidx=interpolation_parameters%FIELD%GEOMETRIC_FIELD%VARIABLE_TYPE_MAP(field_u_variable_type)% &
8918  & ptr%NUMBER_OF_COMPONENTS+1
8919  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8920  ELSE
8921  local_error="Field type "//trim(number_to_vstring(interpolation_parameters%FIELD%TYPE,"*",err,error))// &
8922  & " is not valid for only interpolating geometric field, use FIELD_GEOMETRIC_GENERAL_TYPE."
8923  CALL flagerror(local_error,err,error,*999)
8924  ENDIF
8925  CASE DEFAULT
8926  local_error="Interpolation component type "//trim(number_to_vstring(componenttype,"*",err,error))//" is not valid."
8927  CALL flagerror(local_error,err,error,*999)
8928  END SELECT
8929  ELSE
8930  startcomponentidx=1
8931  endComponentIdx=INTERPOLATION_PARAMETERS%FIELD_VARIABLE%number_of_components
8932  ENDIF
8933  DO component_idx=startcomponentidx,endcomponentidx
8934  faces_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%FACES
8935  IF(face_number>0.AND.face_number<=faces_topology%NUMBER_OF_FACES) THEN
8936  basis=>faces_topology%FACES(face_number)%BASIS
8937  interpolation_parameters%BASES(component_idx)%PTR=>basis
8938  IF(component_idx==1) THEN
8939  interpolation_parameters%NUMBER_OF_XI=basis%NUMBER_OF_XI
8940  ELSE
8941  IF(basis%NUMBER_OF_XI/=interpolation_parameters%NUMBER_OF_XI) &
8942  & CALL flagerror("Inconsistent number of xi directions???",err,error,*999)
8943  ENDIF
8944  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
8945  CASE(field_constant_interpolation)
8946  CALL flagerror("Not implemented.",err,error,*999)
8947  CASE(field_element_based_interpolation)
8948  CALL flagerror("Not implemented.",err,error,*999)
8949  CASE(field_node_based_interpolation)
8950  nodes_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%NODES
8951  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=basis%NUMBER_OF_ELEMENT_PARAMETERS
8952  SELECT CASE(interpolation_parameters%FIELD%SCALINGS%SCALING_TYPE)
8953  CASE(field_no_scaling)
8954  DO basis_node_idx=1,basis%NUMBER_OF_NODES
8955  node_idx=faces_topology%FACES(face_number)%NODES_IN_FACE(basis_node_idx)
8956  DO basis_derivative_idx=1,basis%NUMBER_OF_DERIVATIVES(basis_node_idx)
8957  derivative_idx=faces_topology%FACES(face_number)%DERIVATIVES_IN_FACE(1,basis_derivative_idx,basis_node_idx)
8958  version_idx=faces_topology%FACES(face_number)%DERIVATIVES_IN_FACE(2,basis_derivative_idx,basis_node_idx)
8959  element_parameter_idx=basis%ELEMENT_PARAMETER_INDEX(basis_derivative_idx,basis_node_idx)
8960  dof_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%PARAM_TO_DOF_MAP% &
8961  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(derivative_idx)%VERSIONS(version_idx)
8962  interpolation_parameters%PARAMETERS(element_parameter_idx,component_idx)=field_parameter_set_data(dof_idx)
8963  ENDDO !basis_derivative_idx
8964  ENDDO !basis_node_idx
8965  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
8966  scaling_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%SCALING_INDEX
8967  NULLIFY(scale_factors)
8968  CALL distributed_vector_data_get(interpolation_parameters%FIELD%SCALINGS%SCALINGS(scaling_idx)% &
8969  & scale_factors,scale_factors,err,error,*999)
8970  DO basis_node_idx=1,basis%NUMBER_OF_NODES
8971  node_idx=faces_topology%FACES(face_number)%NODES_IN_FACE(basis_node_idx)
8972  DO basis_derivative_idx=1,basis%NUMBER_OF_DERIVATIVES(basis_node_idx)
8973  derivative_idx=faces_topology%FACES(face_number)%DERIVATIVES_IN_FACE(1,basis_derivative_idx,basis_node_idx)
8974  version_idx=faces_topology%FACES(face_number)%DERIVATIVES_IN_FACE(2,basis_derivative_idx,basis_node_idx)
8975  element_parameter_idx=basis%ELEMENT_PARAMETER_INDEX(basis_derivative_idx,basis_node_idx)
8976  dof_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%PARAM_TO_DOF_MAP% &
8977  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(derivative_idx)%VERSIONS(version_idx)
8978  node_scaling_dof_idx= &
8979  & nodes_topology%NODES(node_idx)%DERIVATIVES(derivative_idx)%DOF_INDEX(version_idx)
8980  !INTERPOLATION_PARAMETERS%PARAMETERS(element_parameter_idx,component_idx)=FIELD_PARAMETER_SET_DATA(dof_idx)* &
8981  ! & INTERPOLATION_PARAMETERS%FIELD%SCALINGS%SCALINGS(scaling_idx)%SCALE_FACTORS(derivative_idx,node_idx)
8982  interpolation_parameters%PARAMETERS(element_parameter_idx,component_idx)= &
8983  & field_parameter_set_data(dof_idx)*scale_factors(node_scaling_dof_idx)
8984  interpolation_parameters%SCALE_FACTORS(element_parameter_idx,component_idx)= &
8985  & scale_factors(node_scaling_dof_idx)
8986  ENDDO !basis_derivative_idx
8987  ENDDO !basis_node_idx
8988  CASE(field_arc_length_scaling)
8989  CALL flagerror("Not implemented.",err,error,*999)
8990  CASE DEFAULT
8991  local_error="The scaling type of "//trim(number_to_vstring(interpolation_parameters%FIELD%SCALINGS% &
8992  & scaling_type,"*",err,error))//" is invalid for field number "// &
8993  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
8994  CALL flagerror(local_error,err,error,*999)
8995  END SELECT
8996  CASE(field_grid_point_based_interpolation)
8997  CALL flagerror("Not implemented.",err,error,*999)
8998  CASE(field_gauss_point_based_interpolation)
8999  CALL flagerror("Not implemented.",err,error,*999)
9000  CASE(field_data_point_based_interpolation)
9001  CALL flagerror("Not implemented.",err,error,*999)
9002  CASE DEFAULT
9003  local_error="The interpolation type of "//trim(number_to_vstring(interpolation_parameters%FIELD_VARIABLE% &
9004  & components(component_idx)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
9005  & trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
9006  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9007  CALL flagerror(local_error,err,error,*999)
9008  END SELECT
9009  ELSE
9010  local_error="The face number of "//trim(number_to_vstring(face_number,"*",err,error))// &
9011  & " is invalid. The number must be between 1 and "// &
9012  & trim(number_to_vstring(faces_topology%NUMBER_OF_FACES,"*",err,error))// &
9013  & " for component number "//trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
9014  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9015  CALL flagerror(local_error,err,error,*999)
9016  ENDIF
9017  ENDDO !component_idx
9018  CALL coordinate_interpolation_parameters_adjust(coordinate_system,interpolation_parameters,err,error,*999)
9019  ELSE
9020  CALL flagerror("The interpolation parameters field is not associated.",err,error,*999)
9021  ENDIF
9022  CALL distributed_vector_data_restore(parameter_set%PARAMETERS,field_parameter_set_data,err,error,*999)
9023  ELSE
9024  local_error="The field parameter set type of "//trim(number_to_vstring(parameter_set_type,"*",err,error))// &
9025  & " has not been created for field number "// &
9026  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9027  CALL flagerror(local_error,err,error,*999)
9028  ENDIF
9029  ELSE
9030  local_error="The field parameter set type of "//trim(number_to_vstring(parameter_set_type,"*",err,error))// &
9031  & " is invalid. The number must be between 1 and "//trim(number_to_vstring(field_number_of_set_types,"*",err,error))// &
9032  & " for field number "//trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9033  CALL flagerror(local_error,err,error,*999)
9034  ENDIF
9035  ELSE
9036  CALL flagerror("Interpolation parameters is not associated.",err,error,*999)
9037  ENDIF
9038 
9039  IF(diagnostics1) THEN
9040  CALL write_string(diagnostic_output_type,"Interpolation parameters:",err,error,*999)
9041  CALL write_string_value(diagnostic_output_type," Field number = ",interpolation_parameters%FIELD%USER_NUMBER,err,error,*999)
9042  CALL write_string_value(diagnostic_output_type," Field variable number = ",interpolation_parameters%FIELD_VARIABLE% &
9043  & variable_number,err,error,*999)
9044  CALL write_string_value(diagnostic_output_type," Parameter set type = ",parameter_set_type,err,error,*999)
9045  CALL write_string_value(diagnostic_output_type," Face number = ",face_number,err,error,*999)
9046  CALL write_string_value(diagnostic_output_type," Total number of components = ", &
9047  & interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS,err,error,*999)
9048  CALL write_string_value(diagnostic_output_type," Interpolation number of components = ", &
9049  & endcomponentidx-startcomponentidx+1,err,error,*999)
9050  DO component_idx=startcomponentidx,endcomponentidx
9051  CALL write_string_value(diagnostic_output_type," Component = ",component_idx,err,error,*999)
9052  CALL write_string_value(diagnostic_output_type," Number of parameters = ",interpolation_parameters% &
9053  & number_of_parameters(component_idx),err,error,*999)
9054  CALL write_string_vector(diagnostic_output_type,1,1,interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx),4,4, &
9055  & interpolation_parameters%PARAMETERS(:,component_idx),'(" Parameters :",4(X,E13.6))','(18X,4(X,E13.6))', &
9056  & err,error,*999)
9057  ENDDO !component_idx
9058  ENDIF
9059 
9060  exits("FIELD_INTERPOLATION_PARAMETERS_FACE_GET")
9061  RETURN
9062 999 errorsexits("FIELD_INTERPOLATION_PARAMETERS_FACE_GET",err,error)
9063  RETURN 1
9064  END SUBROUTINE field_interpolation_parameters_face_get
9065 
9066  !
9067  !================================================================================================================================
9068  !
9069 
9071  SUBROUTINE field_interpolationparametersscalefactorselementget(ELEMENT_NUMBER,INTERPOLATION_PARAMETERS,ERR,ERROR,*)
9072 
9073  !Argument variables
9074  INTEGER(INTG), INTENT(IN) :: element_number
9075  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
9076  INTEGER(INTG), INTENT(OUT) :: err
9077  TYPE(varying_string), INTENT(OUT) :: error
9078  !Local Variables
9079  INTEGER(INTG) :: component_idx,mk,nk,nn,np,ns,ny,scaling_idx,nv
9080  REAL(DP), POINTER :: scale_factors(:)
9081  TYPE(basis_type), POINTER :: basis
9082  TYPE(domain_elements_type), POINTER :: elements_topology
9083  TYPE(domain_nodes_type), POINTER :: nodes_topology
9084  TYPE(varying_string) :: local_error
9085 
9086  enters("Field_InterpolationParametersScaleFactorsElementGet",err,error,*999)
9087 
9088  IF(ASSOCIATED(interpolation_parameters)) THEN
9089  SELECT CASE(interpolation_parameters%FIELD%SCALINGS%SCALING_TYPE)
9090  CASE(field_no_scaling)
9091  CALL flagerror("Can not get the scale factors for a field with no scaling.",err,error,*999)
9092  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
9093  DO component_idx=1,interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
9094  elements_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%ELEMENTS
9095  IF(element_number>0.AND.element_number<=elements_topology%TOTAL_NUMBER_OF_ELEMENTS) THEN
9096  basis=>elements_topology%ELEMENTS(element_number)%BASIS
9097  interpolation_parameters%BASES(component_idx)%PTR=>basis
9098  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
9099  CASE(field_constant_interpolation)
9100  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9101  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9102  CASE(field_element_based_interpolation)
9103  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9104  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9105  CASE(field_node_based_interpolation)
9106  nodes_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%NODES
9107  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=basis%NUMBER_OF_ELEMENT_PARAMETERS
9108  scaling_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%SCALING_INDEX
9109  NULLIFY(scale_factors)
9110  CALL distributed_vector_data_get(interpolation_parameters%FIELD%SCALINGS%SCALINGS(scaling_idx)% &
9111  & scale_factors,scale_factors,err,error,*999)
9112  DO nn=1,basis%NUMBER_OF_NODES
9113  np=elements_topology%ELEMENTS(element_number)%ELEMENT_NODES(nn)
9114  DO mk=1,basis%NUMBER_OF_DERIVATIVES(nn)
9115  nk=elements_topology%ELEMENTS(element_number)%ELEMENT_DERIVATIVES(mk,nn)
9116  nv=elements_topology%ELEMENTS(element_number)%elementVersions(mk,nn)
9117  ns=basis%ELEMENT_PARAMETER_INDEX(mk,nn)
9118  ny=nodes_topology%NODES(np)%DERIVATIVES(nk)%DOF_INDEX(nv)
9119  interpolation_parameters%SCALE_FACTORS(ns,component_idx)=scale_factors(ny)
9120  ENDDO !mk
9121  ENDDO !nn
9122  CALL distributed_vector_data_restore(interpolation_parameters%FIELD%SCALINGS%SCALINGS(scaling_idx)% &
9123  & scale_factors,scale_factors,err,error,*999)
9124  CASE(field_grid_point_based_interpolation)
9125  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9126  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9127  CASE(field_gauss_point_based_interpolation)
9128  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9129  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9130  CASE(field_data_point_based_interpolation)
9131  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9132  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9133  CASE DEFAULT
9134  local_error="The interpolation type of "//trim(number_to_vstring(interpolation_parameters%FIELD_VARIABLE% &
9135  & components(component_idx)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
9136  & trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
9137  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9138  CALL flagerror(local_error,err,error,*999)
9139  END SELECT
9140  ELSE
9141  local_error="The element number of "//trim(number_to_vstring(element_number,"*",err,error))// &
9142  & " is invalid. The number must be between 1 and "// &
9143  & trim(number_to_vstring(elements_topology%TOTAL_NUMBER_OF_ELEMENTS,"*",err,error))// &
9144  & " for component number "//trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
9145  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9146  CALL flagerror(local_error,err,error,*999)
9147  ENDIF
9148  ENDDO !component_idx
9149  CASE(field_arc_length_scaling)
9150  CALL flagerror("Not implemented.",err,error,*999)
9151  CASE DEFAULT
9152  local_error="The scaling type of "//trim(number_to_vstring(interpolation_parameters%FIELD%SCALINGS% &
9153  & scaling_type,"*",err,error))//" is invalid for field number "// &
9154  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9155  CALL flagerror(local_error,err,error,*999)
9156  END SELECT
9157  ELSE
9158  CALL flagerror("Interpolation parameters is not associated.",err,error,*999)
9159  ENDIF
9160 
9161  IF(diagnostics1) THEN
9162  CALL write_string(diagnostic_output_type,"Interpolation scale factors:",err,error,*999)
9163  CALL write_string_value(diagnostic_output_type," Field number = ",interpolation_parameters%FIELD%USER_NUMBER,err,error,*999)
9164  CALL write_string_value(diagnostic_output_type," Field variable number = ",interpolation_parameters%FIELD_VARIABLE% &
9165  & variable_number,err,error,*999)
9166  CALL write_string_value(diagnostic_output_type," Element number = ",element_number,err,error,*999)
9167  CALL write_string_value(diagnostic_output_type," Number of components = ",interpolation_parameters%FIELD_VARIABLE% &
9168  & number_of_components,err,error,*999)
9169  DO component_idx=1,interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
9170  CALL write_string_value(diagnostic_output_type," Component = ",component_idx,err,error,*999)
9171  CALL write_string_value(diagnostic_output_type," Number of parameters = ",interpolation_parameters% &
9172  & number_of_parameters(component_idx),err,error,*999)
9173  CALL write_string_vector(diagnostic_output_type,1,1,interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx),4,4, &
9174  & interpolation_parameters%SCALE_FACTORS(:,component_idx),'(" Scale factors :",4(X,E13.6))','(21X,4(X,E13.6))', &
9175  & err,error,*999)
9176  ENDDO !component_idx
9177  ENDIF
9178 
9179  exits("Field_InterpolationParametersScaleFactorsElementGet")
9180  RETURN
9181 999 errors("Field_InterpolationParametersScaleFactorsElementGet",err,error)
9182  exits("Field_InterpolationParametersScaleFactorsElementGet")
9183  RETURN 1
9184 
9185  END SUBROUTINE field_interpolationparametersscalefactorselementget
9186 
9187  !
9188  !================================================================================================================================
9189  !
9190 
9192  SUBROUTINE field_parametersetnodescalefactorget(field,variableType,versionNumber, &
9193  & derivativenumber,nodeusernumber,componentnumber,scalefactor,err,error,*)
9194 
9195  !Argument variables
9196  TYPE(field_type), POINTER :: field
9197  INTEGER(INTG), INTENT(IN) :: variabletype
9198  INTEGER(INTG), INTENT(IN) :: versionnumber
9199  INTEGER(INTG), INTENT(IN) :: derivativenumber
9200  INTEGER(INTG), INTENT(IN) :: nodeusernumber
9201  INTEGER(INTG), INTENT(IN) :: componentnumber
9202  REAL(DP), INTENT(OUT) :: scalefactor
9203  INTEGER(INTG), INTENT(OUT) :: err
9204  TYPE(varying_string), INTENT(OUT) :: error
9205  !Local Variables
9206  LOGICAL :: ghostnode,usernodeexists
9207  INTEGER(INTG) :: domainlocalnodenumber,scalingidx,dofidx
9208  REAL(DP), POINTER :: fieldscalefactors(:)
9209  TYPE(field_variable_type), POINTER :: fieldvariable
9210  TYPE(domain_topology_type), POINTER :: domaintopology
9211  TYPE(domain_nodes_type), POINTER :: domainnodes
9212  TYPE(varying_string) :: localerror
9213 
9214  enters("Field_ParameterSetNodeScaleFactorGet",err,error,*999)
9215 
9216  IF(ASSOCIATED(field)) THEN
9217  IF(field%FIELD_FINISHED) THEN
9218  SELECT CASE(field%SCALINGS%SCALING_TYPE)
9219  CASE(field_no_scaling)
9220  CALL flagerror("Can not get the scale factors for a field with no scaling.",err,error,*999)
9221  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
9222  IF(variabletype>0.AND.variabletype<=field_number_of_variable_types) THEN
9223  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
9224  IF(ASSOCIATED(fieldvariable)) THEN
9225  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
9226  IF(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE==field_node_based_interpolation)THEN
9227  domaintopology=>fieldvariable%COMPONENTS(componentnumber)%DOMAIN%TOPOLOGY
9228  CALL domain_topology_node_check_exists(domaintopology,nodeusernumber,usernodeexists, &
9229  & domainlocalnodenumber,ghostnode,err,error,*999)
9230  IF(usernodeexists) THEN
9231  IF(ghostnode) THEN
9232  localerror="Cannot get by node for user node "// &
9233  & trim(number_to_vstring(nodeusernumber,"*",err,error))//" as it is a ghost node."
9234  CALL flagerror(localerror,err,error,*999)
9235  ELSE
9236  domainnodes=>domaintopology%NODES
9237  IF(ASSOCIATED(domainnodes)) THEN
9238  IF(derivativenumber>0.AND.derivativenumber<=domainnodes%NODES(domainlocalnodenumber)% &
9239  & number_of_derivatives) THEN
9240  IF(versionnumber>0.AND.versionnumber<= &
9241  & fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
9242  & node_param2dof_map%NODES(domainlocalnodenumber)%DERIVATIVES(derivativenumber)% &
9243  & number_of_versions) THEN
9244  ! The field component number is used to determine which scaling index to use.
9245  ! The number of scaling indices are set based on the number of mesh components (not field components).
9246  scalingidx=fieldvariable%COMPONENTS(componentnumber)%SCALING_INDEX
9247  NULLIFY(fieldscalefactors)
9248  CALL distributed_vector_data_get(field%SCALINGS%SCALINGS(scalingidx)%SCALE_FACTORS, &
9249  & fieldscalefactors,err,error,*999)
9250  dofidx=domainnodes%NODES(nodeusernumber)%DERIVATIVES(derivativenumber)%DOF_INDEX(versionnumber)
9251  !dofIdx=fieldVariable%COMPONENTS(componentNumber)%PARAM_TO_DOF_MAP% &
9252  ! & NODE_PARAM2DOF_MAP%NODES(domainLocalNodeNumber)%DERIVATIVES(derivativeNumber)% &
9253  ! & VERSIONS(versionNumber)
9254  scalefactor=fieldscalefactors(dofidx)
9255  CALL distributed_vector_data_restore(field%SCALINGS%SCALINGS(scalingidx)% &
9256  & scale_factors,fieldscalefactors,err,error,*999)
9257  ELSE
9258  localerror="Version number "//trim(number_to_vstring(versionnumber,"*",err,error))// &
9259  & " is invalid for derivative number "// &
9260  & trim(number_to_vstring(derivativenumber,"*",err,error))//" of node number "// &
9261  & trim(number_to_vstring(nodeusernumber,"*",err,error))//" of component number "// &
9262  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
9263  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
9264  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
9265  & trim(number_to_vstring(domainnodes%NODES(domainlocalnodenumber)% &
9266  & derivatives(derivativenumber)%numberOfVersions,"*",err,error))//" versions "// &
9267  & "(note version numbers are indexed directly from the value the user specifies during "// &
9268  & "element creation and no record is kept of the total number of versions the user sets."// &
9269  & "The maximum version number the user sets defines the total number of versions allocated)."
9270  CALL flagerror(localerror,err,error,*999)
9271  ENDIF
9272  ELSE
9273  localerror="Derivative number "//trim(number_to_vstring(derivativenumber,"*",err,error))// &
9274  & " is invalid for user node number "// &
9275  & trim(number_to_vstring(nodeusernumber,"*",err,error))//" of component number "// &
9276  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
9277  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
9278  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
9279  & trim(number_to_vstring(domainnodes%NODES(domainlocalnodenumber)% &
9280  & number_of_derivatives,"*",err,error))//" derivatives."
9281  CALL flagerror(localerror,err,error,*999)
9282  ENDIF
9283  ENDIF
9284  ENDIF
9285  ELSE
9286  localerror="The specified user node number of "// &
9287  & trim(number_to_vstring(nodeusernumber,"*",err,error))// &
9288  & " does not exist in the domain for field component number "// &
9289  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
9290  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
9291  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9292  CALL flagerror(localerror,err,error,*999)
9293  ENDIF
9294  ELSE
9295  localerror="The interpolation type of "//trim(number_to_vstring(fieldvariable%COMPONENTS(componentnumber)% &
9296  & interpolation_type,"*",err,error))//" is not nodally based for component number "// &
9297  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field number "// &
9298  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9299  CALL flagerror(localerror,err,error,*999)
9300  ENDIF
9301  ELSE
9302  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
9303  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
9304  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
9305  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
9306  & " components."
9307  CALL flagerror(localerror,err,error,*999)
9308  ENDIF
9309  ELSE
9310  localerror="The field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
9311  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9312  CALL flagerror(localerror,err,error,*999)
9313  ENDIF
9314  ELSE
9315  localerror="The field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
9316  & " is invalid. The variable type must be between 1 and "// &
9317  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
9318  CALL flagerror(localerror,err,error,*999)
9319  ENDIF
9320  CASE(field_arc_length_scaling)
9321  CALL flagerror("Not implemented.",err,error,*999)
9322  CASE DEFAULT
9323  localerror="The scaling type of "//trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
9324  & " is invalid for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9325  CALL flagerror(localerror,err,error,*999)
9326  END SELECT
9327  ELSE
9328  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
9329  CALL flagerror(localerror,err,error,*999)
9330  ENDIF
9331  ELSE
9332  CALL flagerror("Field is not associated.",err,error,*999)
9333  ENDIF
9334 
9335  exits("Field_ParameterSetNodeScaleFactorGet")
9336  RETURN
9337 999 errorsexits("Field_ParameterSetNodeScaleFactorGet",err,error)
9338  RETURN 1
9339  END SUBROUTINE field_parametersetnodescalefactorget
9340 
9341  !
9342  !================================================================================================================================
9343  !
9344 
9346  SUBROUTINE field_parametersetnodescalefactorsget(field,variableType,meshComponentNumber,scaleFactors,err,error,*)
9347 
9348  !Argument variables
9349  TYPE(field_type), POINTER :: field
9350  INTEGER(INTG), INTENT(IN) :: variabletype
9351  INTEGER(INTG), INTENT(IN) :: meshcomponentnumber
9352  REAL(DP), INTENT(OUT) :: scalefactors(:)
9353  INTEGER(INTG), INTENT(OUT) :: err
9354  TYPE(varying_string), INTENT(OUT) :: error
9355  !Local Variables
9356  INTEGER(INTG) :: scalingidx
9357  REAL(DP), POINTER :: fieldscalefactors(:)
9358  TYPE(field_variable_type), POINTER :: fieldvariable
9359  TYPE(varying_string) :: localerror
9360 
9361  enters("Field_ParameterSetNodeScaleFactorsGet",err,error,*999)
9362 
9363  IF(ASSOCIATED(field)) THEN
9364  IF(field%FIELD_FINISHED) THEN
9365  SELECT CASE(field%SCALINGS%SCALING_TYPE)
9366  CASE(field_no_scaling)
9367  CALL flagerror("Can not get the scale factors for a field with no scaling.",err,error,*999)
9368  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
9369  IF(variabletype>0.AND.variabletype<=field_number_of_variable_types) THEN
9370  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
9371  IF(ASSOCIATED(fieldvariable)) THEN
9372  !The NUMBER_OF_SCALING_INDICES is the same as the number of mesh components (not field components).
9373  IF(meshcomponentnumber>=1.AND.meshcomponentnumber<=field%SCALINGS%NUMBER_OF_SCALING_INDICES) THEN
9374  scalingidx=meshcomponentnumber
9375  NULLIFY(fieldscalefactors)
9376  CALL distributed_vector_data_get(field%SCALINGS%SCALINGS(scalingidx)%SCALE_FACTORS, &
9377  & fieldscalefactors,err,error,*999)
9378  scalefactors=fieldscalefactors
9379  CALL distributed_vector_data_restore(field%SCALINGS%SCALINGS(scalingidx)% &
9380  & scale_factors,fieldscalefactors,err,error,*999)
9381  ELSE
9382  localerror="Mesh component number "//trim(number_to_vstring(meshcomponentnumber,"*",err,error))// &
9383  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
9384  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
9385  & trim(number_to_vstring(field%SCALINGS%NUMBER_OF_SCALING_INDICES,"*",err,error))// &
9386  & " components."
9387  CALL flagerror(localerror,err,error,*999)
9388  ENDIF
9389  ELSE
9390  localerror="The field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
9391  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9392  CALL flagerror(localerror,err,error,*999)
9393  ENDIF
9394  ELSE
9395  localerror="The field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
9396  & " is invalid. The variable type must be between 1 and "// &
9397  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
9398  CALL flagerror(localerror,err,error,*999)
9399  ENDIF
9400  CASE(field_arc_length_scaling)
9401  CALL flagerror("Not implemented.",err,error,*999)
9402  CASE DEFAULT
9403  localerror="The scaling type of "//trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
9404  & " is invalid for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9405  CALL flagerror(localerror,err,error,*999)
9406  END SELECT
9407  ELSE
9408  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
9409  CALL flagerror(localerror,err,error,*999)
9410  ENDIF
9411  ELSE
9412  CALL flagerror("Field is not associated.",err,error,*999)
9413  ENDIF
9414 
9415  exits("Field_ParameterSetNodeScaleFactorsGet")
9416  RETURN
9417 999 errorsexits("Field_ParameterSetNodeScaleFactorsGet",err,error)
9418  RETURN 1
9419  END SUBROUTINE field_parametersetnodescalefactorsget
9420 
9421  !
9422  !================================================================================================================================
9423  !
9424 
9426  SUBROUTINE field_parametersetnodenumberofscalefactordofsget(field,variableType,meshComponentNumber,numberOfScaleFactorsDofs, &
9427  & err,error,*)
9428 
9429  !Argument variables
9430  TYPE(field_type), POINTER :: field
9431  INTEGER(INTG), INTENT(IN) :: variabletype
9432  INTEGER(INTG), INTENT(IN) :: meshcomponentnumber
9433  INTEGER(INTG), INTENT(OUT) :: numberofscalefactorsdofs
9434  INTEGER(INTG), INTENT(OUT) :: err
9435  TYPE(varying_string), INTENT(OUT) :: error
9436  !Local Variables
9437  INTEGER(INTG) :: scalingidx
9438  REAL(DP), POINTER :: fieldscalefactors(:)
9439  TYPE(field_variable_type), POINTER :: fieldvariable
9440  TYPE(varying_string) :: localerror
9441 
9442  enters("Field_ParameterSetNodeNumberOfScaleFactorDofsGet",err,error,*999)
9443 
9444  IF(ASSOCIATED(field)) THEN
9445  IF(field%FIELD_FINISHED) THEN
9446  SELECT CASE(field%SCALINGS%SCALING_TYPE)
9447  CASE(field_no_scaling)
9448  CALL flagerror("Can not get the scale factors for a field with no scaling.",err,error,*999)
9449  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
9450  IF(variabletype>0.AND.variabletype<=field_number_of_variable_types) THEN
9451  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
9452  IF(ASSOCIATED(fieldvariable)) THEN
9453  !The NUMBER_OF_SCALING_INDICES is the same as the number of mesh components (not field components).
9454  IF(meshcomponentnumber>=1.AND.meshcomponentnumber<=field%SCALINGS%NUMBER_OF_SCALING_INDICES) THEN
9455  scalingidx=meshcomponentnumber
9456  NULLIFY(fieldscalefactors)
9457  CALL distributed_vector_data_get(field%SCALINGS%SCALINGS(scalingidx)%SCALE_FACTORS, &
9458  & fieldscalefactors,err,error,*999)
9459  numberofscalefactorsdofs=SIZE(fieldscalefactors,1)
9460  CALL distributed_vector_data_restore(field%SCALINGS%SCALINGS(scalingidx)% &
9461  & scale_factors,fieldscalefactors,err,error,*999)
9462  ELSE
9463  localerror="Mesh component number "//trim(number_to_vstring(meshcomponentnumber,"*",err,error))// &
9464  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
9465  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
9466  & trim(number_to_vstring(field%SCALINGS%NUMBER_OF_SCALING_INDICES,"*",err,error))// &
9467  & " components."
9468  CALL flagerror(localerror,err,error,*999)
9469  ENDIF
9470  ELSE
9471  localerror="The field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
9472  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9473  CALL flagerror(localerror,err,error,*999)
9474  ENDIF
9475  ELSE
9476  localerror="The field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
9477  & " is invalid. The variable type must be between 1 and "// &
9478  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
9479  CALL flagerror(localerror,err,error,*999)
9480  ENDIF
9481  CASE(field_arc_length_scaling)
9482  CALL flagerror("Not implemented.",err,error,*999)
9483  CASE DEFAULT
9484  localerror="The scaling type of "//trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
9485  & " is invalid for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9486  CALL flagerror(localerror,err,error,*999)
9487  END SELECT
9488  ELSE
9489  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
9490  CALL flagerror(localerror,err,error,*999)
9491  ENDIF
9492  ELSE
9493  CALL flagerror("Field is not associated.",err,error,*999)
9494  ENDIF
9495 
9496  exits("Field_ParameterSetNodeNumberOfScaleFactorDofsGet")
9497  RETURN
9498 999 errors("Field_ParameterSetNodeNumberOfScaleFactorDofsGet",err,error)
9499  exits("Field_ParameterSetNodeNumberOfScaleFactorDofsGet")
9500  RETURN 1
9501 
9502  END SUBROUTINE field_parametersetnodenumberofscalefactordofsget
9503 
9504  !
9505  !================================================================================================================================
9506  !
9507 
9509  SUBROUTINE field_parametersetnodescalefactorset(field,variableType,versionNumber, &
9510  & derivativenumber,nodeusernumber,componentnumber,scalefactor,err,error,*)
9511 
9512  !Argument variables
9513  TYPE(field_type), POINTER :: field
9514  INTEGER(INTG), INTENT(IN) :: variabletype
9515  INTEGER(INTG), INTENT(IN) :: versionnumber
9516  INTEGER(INTG), INTENT(IN) :: derivativenumber
9517  INTEGER(INTG), INTENT(IN) :: nodeusernumber
9518  INTEGER(INTG), INTENT(IN) :: componentnumber
9519  REAL(DP), INTENT(IN) :: scalefactor
9520  INTEGER(INTG), INTENT(OUT) :: err
9521  TYPE(varying_string), INTENT(OUT) :: error
9522  !Local Variables
9523  LOGICAL :: ghostnode,usernodeexists
9524  INTEGER(INTG) :: domainlocalnodenumber,scalingidx,dofidx
9525  REAL(DP), POINTER :: fieldscalefactors(:)
9526  TYPE(field_variable_type), POINTER :: fieldvariable
9527  TYPE(domain_topology_type), POINTER :: domaintopology
9528  TYPE(domain_nodes_type), POINTER :: domainnodes
9529  TYPE(varying_string) :: localerror
9530 
9531  enters("Field_ParameterSetNodeScaleFactorSet",err,error,*999)
9532 
9533  IF(ASSOCIATED(field)) THEN
9534  IF(field%FIELD_FINISHED) THEN
9535  SELECT CASE(field%SCALINGS%SCALING_TYPE)
9536  CASE(field_no_scaling)
9537  CALL flagerror("Can not set the scale factors for a field with no scaling.",err,error,*999)
9538  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
9539  IF(variabletype>0.AND.variabletype<=field_number_of_variable_types) THEN
9540  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
9541  IF(ASSOCIATED(fieldvariable)) THEN
9542  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
9543  IF(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE==field_node_based_interpolation)THEN
9544  domaintopology=>fieldvariable%COMPONENTS(componentnumber)%DOMAIN%TOPOLOGY
9545  CALL domain_topology_node_check_exists(domaintopology,nodeusernumber,usernodeexists, &
9546  & domainlocalnodenumber,ghostnode,err,error,*999)
9547  IF(usernodeexists) THEN
9548  IF(ghostnode) THEN
9549  localerror="Cannot update by node for user node "// &
9550  & trim(number_to_vstring(nodeusernumber,"*",err,error))//" as it is a ghost node."
9551  CALL flagerror(localerror,err,error,*999)
9552  ELSE
9553  domainnodes=>domaintopology%NODES
9554  IF(ASSOCIATED(domainnodes)) THEN
9555  IF(derivativenumber>0.AND.derivativenumber<=domainnodes%NODES(domainlocalnodenumber)% &
9556  & number_of_derivatives) THEN
9557  IF(versionnumber>0.AND.versionnumber<= &
9558  & fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
9559  & node_param2dof_map%NODES(domainlocalnodenumber)%DERIVATIVES(derivativenumber)% &
9560  & number_of_versions) THEN
9561 
9562  ! The field component number is used to determine which scaling index to use.
9563  ! The number of scaling indices are set based on the number of mesh components (not field components).
9564  scalingidx=fieldvariable%COMPONENTS(componentnumber)%SCALING_INDEX
9565  NULLIFY(fieldscalefactors)
9566  CALL distributed_vector_data_get(field%SCALINGS%SCALINGS(scalingidx)% &
9567  & scale_factors,fieldscalefactors,err,error,*999)
9568  dofidx=domainnodes%NODES(nodeusernumber)%DERIVATIVES(derivativenumber)%DOF_INDEX(versionnumber)
9569  !dofIdx=fieldVariable%COMPONENTS(componentNumber)%PARAM_TO_DOF_MAP% &
9570  ! & NODE_PARAM2DOF_MAP%NODES(domainLocalNodeNumber)%DERIVATIVES(derivativeNumber)% &
9571  ! & VERSIONS(versionNumber)
9572  fieldscalefactors(dofidx)=scalefactor
9573  CALL distributed_vector_data_restore(field%SCALINGS%SCALINGS(scalingidx)% &
9574  & scale_factors,fieldscalefactors,err,error,*999)
9575 
9576  ELSE
9577  localerror="Version number "//trim(number_to_vstring(versionnumber,"*",err,error))// &
9578  & " is invalid for derivative number "// &
9579  & trim(number_to_vstring(derivativenumber,"*",err,error))//" of node number "// &
9580  & trim(number_to_vstring(nodeusernumber,"*",err,error))//" of component number "// &
9581  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
9582  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
9583  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
9584  & trim(number_to_vstring(domainnodes%NODES(domainlocalnodenumber)% &
9585  & derivatives(derivativenumber)%numberOfVersions,"*",err,error))//" versions "// &
9586  & "(note version numbers are indexed directly from the value the user specifies during "// &
9587  & "element creation and no record is kept of the total number of versions the user sets."// &
9588  & "The maximum version number the user sets defines the total number of versions allocated)."
9589  CALL flagerror(localerror,err,error,*999)
9590  ENDIF
9591  ELSE
9592  localerror="Derivative number "//trim(number_to_vstring(derivativenumber,"*",err,error))// &
9593  & " is invalid for user node number "// &
9594  & trim(number_to_vstring(nodeusernumber,"*",err,error))//" of component number "// &
9595  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
9596  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
9597  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
9598  & trim(number_to_vstring(domainnodes%NODES(domainlocalnodenumber)% &
9599  & number_of_derivatives,"*",err,error))//" derivatives."
9600  CALL flagerror(localerror,err,error,*999)
9601  ENDIF
9602  ENDIF
9603  ENDIF
9604  ELSE
9605  localerror="The specified user node number of "// &
9606  & trim(number_to_vstring(nodeusernumber,"*",err,error))// &
9607  & " does not exist in the domain for field component number "// &
9608  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
9609  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
9610  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9611  CALL flagerror(localerror,err,error,*999)
9612  ENDIF
9613  ELSE
9614  localerror="The interpolation type of "//trim(number_to_vstring(fieldvariable%COMPONENTS(componentnumber)% &
9615  & interpolation_type,"*",err,error))//" is not nodally based for component number "// &
9616  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field number "// &
9617  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9618  CALL flagerror(localerror,err,error,*999)
9619  ENDIF
9620  ELSE
9621  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
9622  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
9623  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
9624  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
9625  & " components."
9626  CALL flagerror(localerror,err,error,*999)
9627  ENDIF
9628  ELSE
9629  localerror="The field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
9630  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9631  CALL flagerror(localerror,err,error,*999)
9632  ENDIF
9633  ELSE
9634  localerror="The field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
9635  & " is invalid. The variable type must be between 1 and "// &
9636  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
9637  CALL flagerror(localerror,err,error,*999)
9638  ENDIF
9639  CASE(field_arc_length_scaling)
9640  CALL flagerror("Not implemented.",err,error,*999)
9641  CASE DEFAULT
9642  localerror="The scaling type of "//trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
9643  & " is invalid for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9644  CALL flagerror(localerror,err,error,*999)
9645  END SELECT
9646  ELSE
9647  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
9648  CALL flagerror(localerror,err,error,*999)
9649  ENDIF
9650  ELSE
9651  CALL flagerror("Field is not associated.",err,error,*999)
9652  ENDIF
9653 
9654  exits("Field_ParameterSetNodeScaleFactorSet")
9655  RETURN
9656 999 errorsexits("Field_ParameterSetNodeScaleFactorSet",err,error)
9657  RETURN 1
9658  END SUBROUTINE field_parametersetnodescalefactorset
9659  !
9660  !================================================================================================================================
9661  !
9662 
9664  SUBROUTINE field_parametersetnodescalefactorsset(field,variableType,meshComponentNumber,scaleFactors,err,error,*)
9665 
9666  !Argument variables
9667  TYPE(field_type), POINTER :: field
9668  INTEGER(INTG), INTENT(IN) :: variabletype
9669  INTEGER(INTG), INTENT(IN) :: meshcomponentnumber
9670  REAL(DP), INTENT(IN) :: scalefactors(:)
9671  INTEGER(INTG), INTENT(OUT) :: err
9672  TYPE(varying_string), INTENT(OUT) :: error
9673  !Local Variables
9674  INTEGER(INTG) :: scalingidx
9675  REAL(DP), POINTER :: fieldscalefactors(:)
9676  TYPE(field_variable_type), POINTER :: fieldvariable
9677  TYPE(varying_string) :: localerror
9678 
9679  enters("Field_ParameterSetNodeScaleFactorsSet",err,error,*999)
9680 
9681  IF(ASSOCIATED(field)) THEN
9682  IF(field%FIELD_FINISHED) THEN
9683  SELECT CASE(field%SCALINGS%SCALING_TYPE)
9684  CASE(field_no_scaling)
9685  CALL flagerror("Can not set the scale factors for a field with no scaling.",err,error,*999)
9686  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
9687  IF(variabletype>0.AND.variabletype<=field_number_of_variable_types) THEN
9688  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
9689  IF(ASSOCIATED(fieldvariable)) THEN
9690  !The NUMBER_OF_SCALING_INDICES is the same as the number of mesh components (not field components).
9691  IF(meshcomponentnumber>=1.AND.meshcomponentnumber<=field%SCALINGS%NUMBER_OF_SCALING_INDICES) THEN
9692  scalingidx=meshcomponentnumber
9693  NULLIFY(fieldscalefactors)
9694  CALL distributed_vector_data_get(field%SCALINGS%SCALINGS(scalingidx)%SCALE_FACTORS, &
9695  & fieldscalefactors,err,error,*999)
9696  IF(SIZE(fieldscalefactors,1)==SIZE(scalefactors,1)) THEN
9697  fieldscalefactors = scalefactors
9698  ELSE
9699  localerror="The input scale factors have dimensions "//trim(number_to_vstring(SIZE(scalefactors),"*",err,error)) &
9700  & //" and does not match the expected scale factor dimensions of "// &
9701  & trim(number_to_vstring(SIZE(fieldscalefactors),"*",err,error))
9702  CALL flagerror(localerror,err,error,*999)
9703  ENDIF
9704  CALL distributed_vector_data_restore(field%SCALINGS%SCALINGS(scalingidx)% &
9705  & scale_factors,fieldscalefactors,err,error,*999)
9706  ELSE
9707  localerror="Mesh component number "//trim(number_to_vstring(meshcomponentnumber,"*",err,error))// &
9708  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
9709  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
9710  & trim(number_to_vstring(field%SCALINGS%NUMBER_OF_SCALING_INDICES,"*",err,error))// &
9711  & " components."
9712  CALL flagerror(localerror,err,error,*999)
9713  ENDIF
9714  ELSE
9715  localerror="The field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
9716  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9717  CALL flagerror(localerror,err,error,*999)
9718  ENDIF
9719  ELSE
9720  localerror="The field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
9721  & " is invalid. The variable type must be between 1 and "// &
9722  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
9723  CALL flagerror(localerror,err,error,*999)
9724  ENDIF
9725  CASE(field_arc_length_scaling)
9726  CALL flagerror("Not implemented.",err,error,*999)
9727  CASE DEFAULT
9728  localerror="The scaling type of "//trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
9729  & " is invalid for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
9730  CALL flagerror(localerror,err,error,*999)
9731  END SELECT
9732  ELSE
9733  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
9734  CALL flagerror(localerror,err,error,*999)
9735  ENDIF
9736  ELSE
9737  CALL flagerror("Field is not associated.",err,error,*999)
9738  ENDIF
9739 
9740  exits("Field_ParameterSetNodeScaleFactorsSet")
9741  RETURN
9742 999 errorsexits("Field_ParameterSetNodeScaleFactorsSet",err,error)
9743  RETURN 1
9744  END SUBROUTINE field_parametersetnodescalefactorsset
9745 
9746  !
9747  !================================================================================================================================
9748  !
9749 
9751  SUBROUTINE field_interpolationparametersscalefactorslineget(LINE_NUMBER,INTERPOLATION_PARAMETERS,ERR,ERROR,*)
9752 
9753  !Argument variables
9754  INTEGER(INTG), INTENT(IN) :: line_number
9755  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
9756  INTEGER(INTG), INTENT(OUT) :: err
9757  TYPE(varying_string), INTENT(OUT) :: error
9758  !Local Variables
9759  INTEGER(INTG) :: component_idx,mk,nk,nn,np,ns,ny,scaling_idx,nv
9760  REAL(DP), POINTER :: scale_factors(:)
9761  TYPE(basis_type), POINTER :: basis
9762  TYPE(domain_lines_type), POINTER :: lines_topology
9763  TYPE(domain_nodes_type), POINTER :: nodes_topology
9764  TYPE(varying_string) :: local_error
9765 
9766  enters("Field_InterpolationParametersScaleFactorsLineGet",err,error,*999)
9767 
9768  IF(ASSOCIATED(interpolation_parameters)) THEN
9769  SELECT CASE(interpolation_parameters%FIELD%SCALINGS%SCALING_TYPE)
9770  CASE(field_no_scaling)
9771  CALL flagerror("Can not scale factors for a field with no scaling.",err,error,*999)
9772  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
9773  DO component_idx=1,interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
9774  lines_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%LINES
9775  IF(line_number>0.AND.line_number<=lines_topology%NUMBER_OF_LINES) THEN
9776  basis=>lines_topology%LINES(line_number)%BASIS
9777  interpolation_parameters%BASES(component_idx)%PTR=>basis
9778  IF(component_idx==1) THEN
9779  interpolation_parameters%NUMBER_OF_XI=basis%NUMBER_OF_XI
9780  ELSE
9781  IF(basis%NUMBER_OF_XI/=interpolation_parameters%NUMBER_OF_XI) &
9782  & CALL flagerror("Inconsistent number of xi directions???",err,error,*999)
9783  ENDIF
9784  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
9785  CASE(field_constant_interpolation)
9786  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9787  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9788  CASE(field_element_based_interpolation)
9789  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9790  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9791  CASE(field_node_based_interpolation)
9792  nodes_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%NODES
9793  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=basis%NUMBER_OF_ELEMENT_PARAMETERS
9794  scaling_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%SCALING_INDEX
9795  NULLIFY(scale_factors)
9796  CALL distributed_vector_data_get(interpolation_parameters%FIELD%SCALINGS%SCALINGS(scaling_idx)% &
9797  & scale_factors,scale_factors,err,error,*999)
9798  DO nn=1,basis%NUMBER_OF_NODES
9799  np=lines_topology%LINES(line_number)%NODES_IN_LINE(nn)
9800  DO mk=1,basis%NUMBER_OF_DERIVATIVES(nn)
9801  nk=lines_topology%LINES(line_number)%DERIVATIVES_IN_LINE(1,mk,nn)
9802  nv=lines_topology%LINES(line_number)%DERIVATIVES_IN_LINE(2,mk,nn)
9803  ns=basis%ELEMENT_PARAMETER_INDEX(mk,nn)
9804  ny=nodes_topology%NODES(np)%DERIVATIVES(nk)%DOF_INDEX(nv)
9805  interpolation_parameters%SCALE_FACTORS(ns,component_idx)=scale_factors(ny)
9806  ENDDO !mk
9807  ENDDO !nn
9808  CALL distributed_vector_data_restore(interpolation_parameters%FIELD%SCALINGS%SCALINGS(scaling_idx)% &
9809  & scale_factors,scale_factors,err,error,*999)
9810  CASE(field_grid_point_based_interpolation)
9811  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9812  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9813  CASE(field_gauss_point_based_interpolation)
9814  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9815  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9816  CASE(field_data_point_based_interpolation)
9817  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9818  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9819  CASE DEFAULT
9820  local_error="The interpolation type of "//trim(number_to_vstring(interpolation_parameters%FIELD_VARIABLE% &
9821  & components(component_idx)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
9822  & trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
9823  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9824  CALL flagerror(local_error,err,error,*999)
9825  END SELECT
9826  ELSE
9827  local_error="The line number of "//trim(number_to_vstring(line_number,"*",err,error))// &
9828  & " is invalid. The number must be between 1 and "// &
9829  & trim(number_to_vstring(lines_topology%NUMBER_OF_LINES,"*",err,error))// &
9830  & " for component number "//trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
9831  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9832  CALL flagerror(local_error,err,error,*999)
9833  ENDIF
9834  ENDDO !component_idx
9835  CASE(field_arc_length_scaling)
9836  CALL flagerror("Not implemented.",err,error,*999)
9837  CASE DEFAULT
9838  local_error="The scaling type of "//trim(number_to_vstring(interpolation_parameters%FIELD%SCALINGS% &
9839  & scaling_type,"*",err,error))//" is invalid for field number "// &
9840  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9841  CALL flagerror(local_error,err,error,*999)
9842  END SELECT
9843  ELSE
9844  CALL flagerror("Interpolation parameters is not associated.",err,error,*999)
9845  ENDIF
9846 
9847  IF(diagnostics1) THEN
9848  CALL write_string(diagnostic_output_type,"Interpolation scale factors:",err,error,*999)
9849  CALL write_string_value(diagnostic_output_type," Field number = ",interpolation_parameters%FIELD%USER_NUMBER,err,error,*999)
9850  CALL write_string_value(diagnostic_output_type," Field variable number = ",interpolation_parameters%FIELD_VARIABLE% &
9851  & variable_number,err,error,*999)
9852  CALL write_string_value(diagnostic_output_type," Line number = ",line_number,err,error,*999)
9853  CALL write_string_value(diagnostic_output_type," Number of components = ",interpolation_parameters%FIELD_VARIABLE% &
9854  & number_of_components,err,error,*999)
9855  DO component_idx=1,interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
9856  CALL write_string_value(diagnostic_output_type," Component = ",component_idx,err,error,*999)
9857  CALL write_string_value(diagnostic_output_type," Number of parameters = ",interpolation_parameters% &
9858  & number_of_parameters(component_idx),err,error,*999)
9859  CALL write_string_vector(diagnostic_output_type,1,1,interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx),4,4, &
9860  & interpolation_parameters%SCALE_FACTORS(:,component_idx),'(" Scale factors :",4(X,E13.6))','(21X,4(X,E13.6))', &
9861  & err,error,*999)
9862  ENDDO !component_idx
9863  ENDIF
9864 
9865  exits("Field_InterpolationParametersScaleFactorsLineGet")
9866  RETURN
9867 999 errors("Field_InterpolationParametersScaleFactorsLineGet",err,error)
9868  exits("Field_InterpolationParametersScaleFactorsLineGet")
9869  RETURN 1
9870 
9871  END SUBROUTINE field_interpolationparametersscalefactorslineget
9872 
9873  !
9874  !================================================================================================================================
9875  !
9876 
9878  SUBROUTINE field_interpolationparametersscalefactorsfaceget(FACE_NUMBER,INTERPOLATION_PARAMETERS,ERR,ERROR,*)
9879 
9880  !Argument variables
9881  INTEGER(INTG), INTENT(IN) :: face_number
9882  TYPE(field_interpolation_parameters_type), POINTER :: interpolation_parameters
9883  INTEGER(INTG), INTENT(OUT) :: err
9884  TYPE(varying_string), INTENT(OUT) :: error
9885  !Local Variables
9886  INTEGER(INTG) :: component_idx,mk,nk,nn,np,ns,ny,scaling_idx,nv
9887  REAL(DP), POINTER :: scale_factors(:)
9888  TYPE(basis_type), POINTER :: basis
9889  TYPE(domain_faces_type), POINTER :: faces_topology
9890  TYPE(domain_nodes_type), POINTER :: nodes_topology
9891  TYPE(varying_string) :: local_error
9892 
9893  enters("Field_InterpolationParametersScaleFactorsFaceGet",err,error,*999)
9894 
9895  IF(ASSOCIATED(interpolation_parameters)) THEN
9896  SELECT CASE(interpolation_parameters%FIELD%SCALINGS%SCALING_TYPE)
9897  CASE(field_no_scaling)
9898  CALL flagerror("Can not scale factors for a field with no scaling.",err,error,*999)
9899  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
9900  DO component_idx=1,interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
9901  faces_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%FACES
9902  IF(face_number>0.AND.face_number<=faces_topology%NUMBER_OF_FACES) THEN
9903  basis=>faces_topology%FACES(face_number)%BASIS
9904  interpolation_parameters%BASES(component_idx)%PTR=>basis
9905  IF(component_idx==1) THEN
9906  interpolation_parameters%NUMBER_OF_XI=basis%NUMBER_OF_XI
9907  ELSE
9908  IF(basis%NUMBER_OF_XI/=interpolation_parameters%NUMBER_OF_XI) &
9909  & CALL flagerror("Inconsistent number of xi directions???",err,error,*999)
9910  ENDIF
9911  SELECT CASE(interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%INTERPOLATION_TYPE)
9912  CASE(field_constant_interpolation)
9913  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9914  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9915  CASE(field_element_based_interpolation)
9916  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9917  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9918  CASE(field_node_based_interpolation)
9919  nodes_topology=>interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%DOMAIN%TOPOLOGY%NODES
9920  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=basis%NUMBER_OF_ELEMENT_PARAMETERS
9921  scaling_idx=interpolation_parameters%FIELD_VARIABLE%COMPONENTS(component_idx)%SCALING_INDEX
9922  NULLIFY(scale_factors)
9923  CALL distributed_vector_data_get(interpolation_parameters%FIELD%SCALINGS%SCALINGS(scaling_idx)% &
9924  & scale_factors,scale_factors,err,error,*999)
9925  DO nn=1,basis%NUMBER_OF_NODES
9926  np=faces_topology%FACES(face_number)%NODES_IN_FACE(nn)
9927  DO mk=1,basis%NUMBER_OF_DERIVATIVES(nn)
9928  nk=faces_topology%FACES(face_number)%DERIVATIVES_IN_FACE(1,mk,nn)
9929  nv=faces_topology%FACES(face_number)%DERIVATIVES_IN_FACE(2,mk,nn)
9930  ns=basis%ELEMENT_PARAMETER_INDEX(mk,nn)
9931  ny=nodes_topology%NODES(np)%DERIVATIVES(nk)%DOF_INDEX(nv)
9932  interpolation_parameters%SCALE_FACTORS(ns,component_idx)=scale_factors(ny)
9933  ENDDO !mk
9934  ENDDO !nn
9935  CALL distributed_vector_data_restore(interpolation_parameters%FIELD%SCALINGS%SCALINGS(scaling_idx)% &
9936  & scale_factors,scale_factors,err,error,*999)
9937  CASE(field_grid_point_based_interpolation)
9938  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9939  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9940  CASE(field_gauss_point_based_interpolation)
9941  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9942  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9943  CASE(field_data_point_based_interpolation)
9944  interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx)=1
9945  interpolation_parameters%PARAMETERS(1,component_idx)=1.0_dp
9946  CASE DEFAULT
9947  local_error="The interpolation type of "//trim(number_to_vstring(interpolation_parameters%FIELD_VARIABLE% &
9948  & components(component_idx)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
9949  & trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
9950  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9951  CALL flagerror(local_error,err,error,*999)
9952  END SELECT
9953  ELSE
9954  local_error="The face number of "//trim(number_to_vstring(face_number,"*",err,error))// &
9955  & " is invalid. The number must be between 1 and "// &
9956  & trim(number_to_vstring(faces_topology%NUMBER_OF_FACES,"*",err,error))// &
9957  & " for component number "//trim(number_to_vstring(component_idx,"*",err,error))//" of field number "// &
9958  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9959  CALL flagerror(local_error,err,error,*999)
9960  ENDIF
9961  ENDDO !component_idx
9962  CASE(field_arc_length_scaling)
9963  CALL flagerror("Not implemented.",err,error,*999)
9964  CASE DEFAULT
9965  local_error="The scaling type of "//trim(number_to_vstring(interpolation_parameters%FIELD%SCALINGS% &
9966  & scaling_type,"*",err,error))//" is invalid for field number "// &
9967  & trim(number_to_vstring(interpolation_parameters%FIELD%USER_NUMBER,"*",err,error))//"."
9968  CALL flagerror(local_error,err,error,*999)
9969  END SELECT
9970  ELSE
9971  CALL flagerror("Interpolation parameters is not associated.",err,error,*999)
9972  ENDIF
9973 
9974  IF(diagnostics1) THEN
9975  CALL write_string(diagnostic_output_type,"Interpolation scale factors:",err,error,*999)
9976  CALL write_string_value(diagnostic_output_type," Field number = ",interpolation_parameters%FIELD%USER_NUMBER,err,error,*999)
9977  CALL write_string_value(diagnostic_output_type," Field variable number = ",interpolation_parameters%FIELD_VARIABLE% &
9978  & variable_number,err,error,*999)
9979  CALL write_string_value(diagnostic_output_type," Face number = ",face_number,err,error,*999)
9980  CALL write_string_value(diagnostic_output_type," Number of components = ",interpolation_parameters%FIELD_VARIABLE% &
9981  & number_of_components,err,error,*999)
9982  DO component_idx=1,interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS
9983  CALL write_string_value(diagnostic_output_type," Component = ",component_idx,err,error,*999)
9984  CALL write_string_value(diagnostic_output_type," Number of parameters = ",interpolation_parameters% &
9985  & number_of_parameters(component_idx),err,error,*999)
9986  CALL write_string_vector(diagnostic_output_type,1,1,interpolation_parameters%NUMBER_OF_PARAMETERS(component_idx),4,4, &
9987  & interpolation_parameters%SCALE_FACTORS(:,component_idx),'(" Scale factors :",4(X,E13.6))','(21X,4(X,E13.6))', &
9988  & err,error,*999)
9989  ENDDO !component_idx
9990  ENDIF
9991 
9992  exits("Field_InterpolationParametersScaleFactorsFaceGet")
9993  RETURN
9994 999 errors("Field_InterpolationParametersScaleFactorsFaceGet",err,error)
9995  exits("Field_InterpolationParametersScaleFactorsFaceGet")
9996  RETURN 1
9997 
9998  END SUBROUTINE field_interpolationparametersscalefactorsfaceget
9999 
10000  !
10001  !================================================================================================================================
10002  !
10003 
10005  SUBROUTINE field_physical_point_finalise(PHYSICAL_POINT,ERR,ERROR,*)
10006 
10007  !Argument variables
10008  TYPE(field_physical_point_type), POINTER :: physical_point
10009  INTEGER(INTG), INTENT(OUT) :: err
10010  TYPE(varying_string), INTENT(OUT) :: error
10011  !Local Variables
10012 
10013  enters("FIELD_PHYSICAL_POINT_FINALISE",err,error,*999)
10014 
10015  IF(ASSOCIATED(physical_point)) THEN
10016  IF(ALLOCATED(physical_point%VALUES)) DEALLOCATE(physical_point%VALUES)
10017  DEALLOCATE(physical_point)
10018  ENDIF
10019 
10020  exits("FIELD_PHYSICAL_POINT_FINALISE")
10021  RETURN
10022 999 errorsexits("FIELD_PHYSICAL_POINT_FINALISE",err,error)
10023  RETURN 1
10024  END SUBROUTINE field_physical_point_finalise
10025 
10026  !
10027  !================================================================================================================================
10028  !
10029 
10031  SUBROUTINE field_physical_point_initialise(FIELD_INTERPOLATED_POINT,GEOMETRIC_INTERPOLATED_POINT,PHYSICAL_POINT, &
10032  & err,error,*)
10033 
10034  !Argument variables
10035  TYPE(field_interpolated_point_type), POINTER :: field_interpolated_point
10036  TYPE(field_interpolated_point_type), POINTER :: geometric_interpolated_point
10037  TYPE(field_physical_point_type), POINTER :: physical_point
10038  INTEGER(INTG), INTENT(OUT) :: err
10039  TYPE(varying_string), INTENT(OUT) :: error
10040  !Local Variables
10041  INTEGER(INTG) :: dummy_err
10042  TYPE(field_type), POINTER :: field,geometric_field
10043  TYPE(field_interpolation_parameters_type), POINTER :: field_interpolation_parameters,geometric_interpolation_parameters
10044  TYPE(varying_string) :: dummy_error
10045 
10046  enters("FIELD_PHYSICAL_POINT_INITIALISE",err,error,*999)
10047 
10048  IF(ASSOCIATED(field_interpolated_point)) THEN
10049  IF(ASSOCIATED(geometric_interpolated_point)) THEN
10050  field_interpolation_parameters=>field_interpolated_point%INTERPOLATION_PARAMETERS
10051  IF(ASSOCIATED(field_interpolation_parameters)) THEN
10052  geometric_interpolation_parameters=>geometric_interpolated_point%INTERPOLATION_PARAMETERS
10053  IF(ASSOCIATED(geometric_interpolation_parameters)) THEN
10054  field=>field_interpolation_parameters%FIELD
10055  IF(ASSOCIATED(field)) THEN
10056  geometric_field=>geometric_interpolation_parameters%FIELD
10057  IF(ASSOCIATED(geometric_field)) THEN
10058  IF(ASSOCIATED(field%GEOMETRIC_FIELD,geometric_field)) THEN
10059  IF(ASSOCIATED(physical_point)) THEN
10060  CALL flagerror("Physical point is already associated.",err,error,*998)
10061  ELSE
10062  ALLOCATE(physical_point,stat=err)
10063  IF(err/=0) CALL flagerror("Could not allocate physical point",err,error,*999)
10064  physical_point%FIELD_INTERPOLATED_POINT=>field_interpolated_point
10065  physical_point%GEOMETRIC_INTERPOLATED_POINT=>geometric_interpolated_point
10066  physical_point%PHYSICAL_DERIVATIVE_TYPE=0
10067  ALLOCATE(physical_point%VALUES(field_interpolation_parameters%FIELD_VARIABLE%NUMBER_OF_COMPONENTS),stat=err)
10068  IF(err/=0) CALL flagerror("Could not allocate physical point values.",err,error,*999)
10069  physical_point%VALUES=0.0_dp
10070  ENDIF
10071  ELSE
10072  CALL flagerror("The field geometric field and the specified geometric field are not associated.", &
10073  & err,error,*999)
10074  ENDIF
10075  ELSE
10076  CALL flagerror("Geometric interpolation parameters field is not associated.",err,error,*999)
10077  ENDIF
10078  ELSE
10079  CALL flagerror("Field interpolation parameters field is not associated.",err,error,*999)
10080  ENDIF
10081  ELSE
10082  CALL flagerror("Geometric interpolated point interpolation parameters is not associated.",err,error,*999)
10083  ENDIF
10084  ELSE
10085  CALL flagerror("Field interpolated point interpolation parameters is not associated.",err,error,*999)
10086  ENDIF
10087  ELSE
10088  CALL flagerror("Geometric interpolated point is not associated.",err,error,*998)
10089  ENDIF
10090  ELSE
10091  CALL flagerror("Field interpolated point is not associated.",err,error,*998)
10092  ENDIF
10093 
10094  exits("FIELD_PHYSICAL_POINT_INITIALISE")
10095  RETURN
10096 999 CALL field_physical_point_finalise(physical_point,dummy_err,dummy_error,*998)
10097 998 errorsexits("FIELD_PHYSICAL_POINT_INITIALISE",err,error)
10098  RETURN 1
10099 
10100  END SUBROUTINE field_physical_point_initialise
10101 
10102  !
10103  !================================================================================================================================
10104  !
10105 
10107  SUBROUTINE field_physical_points_finalise(PHYSICAL_POINTS,ERR,ERROR,*)
10108 
10109  !Argument variables
10110  TYPE(field_physical_point_ptr_type), POINTER :: physical_points(:)
10111  INTEGER(INTG), INTENT(OUT) :: err
10112  TYPE(varying_string), INTENT(OUT) :: error
10113  !Local Variables
10114  INTEGER(INTG) :: var_type_idx
10115 
10116  enters("FIELD_PHYSICAL_POINTS_FINALISE",err,error,*999)
10117 
10118  IF(ASSOCIATED(physical_points)) THEN
10119  DO var_type_idx=1,SIZE(physical_points,1)
10120  CALL field_physical_point_finalise(physical_points(var_type_idx)%PTR,err,error,*999)
10121  ENDDO !var_type_idx
10122  DEALLOCATE(physical_points)
10123  ENDIF
10124 
10125  exits("FIELD_PHYSICAL_POINTS_FINALISE")
10126  RETURN
10127 999 errorsexits("FIELD_PHYSICAL_POINTS_FINALISE",err,error)
10128  RETURN 1
10129  END SUBROUTINE field_physical_points_finalise
10130 
10131  !
10132  !================================================================================================================================
10133  !
10134 
10136  SUBROUTINE field_physical_points_initialise(FIELD_INTERPOLATED_POINTS,GEOMETRIC_INTERPOLATED_POINTS, &
10137  & physical_points,err,error,*)
10138 
10139  !Argument variables
10140  TYPE(field_interpolated_point_ptr_type), POINTER :: field_interpolated_points(:)
10141  TYPE(field_interpolated_point_ptr_type), POINTER :: geometric_interpolated_points(:)
10142  TYPE(field_physical_point_ptr_type), POINTER :: physical_points(:)
10143  INTEGER(INTG), INTENT(OUT) :: err
10144  TYPE(varying_string), INTENT(OUT) :: error
10145  !Local Variables
10146  INTEGER(INTG) :: dummy_err,var_type_idx
10147  TYPE(varying_string) :: dummy_error
10148 
10149  enters("FIELD_PHYSICAL_POINTS_INITIALISE",err,error,*998)
10150 
10151  IF(ASSOCIATED(field_interpolated_points)) THEN
10152  IF(ASSOCIATED(geometric_interpolated_points)) THEN
10153  IF(ASSOCIATED(physical_points)) THEN
10154  CALL flagerror("Physical points is already associated.",err,error,*998)
10155  ELSE
10156  ALLOCATE(physical_points(field_number_of_variable_types),stat=err)
10157  IF(err/=0) CALL flagerror("Could not allocate physical points.",err,error,*999)
10158  DO var_type_idx=1,field_number_of_variable_types
10159 
10160  NULLIFY(physical_points(var_type_idx)%PTR)
10161  IF(ASSOCIATED(field_interpolated_points(var_type_idx)%PTR).AND. &
10162  & ASSOCIATED(geometric_interpolated_points(var_type_idx)%PTR)) &
10163  & CALL field_physical_point_initialise(field_interpolated_points(var_type_idx)%PTR, &
10164  & geometric_interpolated_points(var_type_idx)%PTR,physical_points(var_type_idx)%PTR,err,error,*999)
10165  ENDDO !var_type_idx
10166  ENDIF
10167  ELSE
10168  CALL flagerror("Geometric interpolated points is not associated.",err,error,*998)
10169  ENDIF
10170  ELSE
10171  CALL flagerror("Field interpolated points is not associated.",err,error,*998)
10172  ENDIF
10173 
10174  exits("FIELD_PHYSICAL_POINTS_INITIALISE")
10175  RETURN
10176 999 CALL field_physical_points_finalise(physical_points,dummy_err,dummy_error,*998)
10177 998 errorsexits("FIELD_PHYSICAL_POINTS_INITIALISE",err,error)
10178  RETURN 1
10179 
10180  END SUBROUTINE field_physical_points_initialise
10181 
10182  !
10183  !================================================================================================================================
10184  !
10185 
10187  SUBROUTINE field_mappings_calculate(FIELD,ERR,ERROR,*)
10188 
10189  !Argument variables
10190  TYPE(field_type), POINTER :: field
10191  INTEGER(INTG), INTENT(OUT) :: err
10192  TYPE(varying_string), INTENT(OUT) :: error
10193  !Local Variables
10194  INTEGER(INTG) :: variable_idx,component_idx,domain_type_idx,variable_global_dofs_offset,number_of_global_variable_dofs, &
10195  & NUMBER_OF_CONSTANT_DOFS,NUMBER_OF_ELEMENT_DOFS,NUMBER_OF_NODE_DOFS,NUMBER_OF_GRID_POINT_DOFS,NUMBER_OF_GAUSS_POINT_DOFS, &
10196  & NUMBER_OF_LOCAL_VARIABLE_DOFS,TOTAL_NUMBER_OF_VARIABLE_DOFS,NUMBER_OF_DOMAINS,variable_global_ny, &
10197  & variable_local_ny,domain_idx,domain_no,constant_nyy,element_ny,element_nyy,node_ny,node_nyy,grid_point_nyy, &
10198  & Gauss_point_nyy,version_idx,derivative_idx,ny,NUMBER_OF_COMPUTATIONAL_NODES, &
10199  & my_computational_node_number,domain_type_stop,start_idx,stop_idx,element_idx,node_idx,NUMBER_OF_LOCAL, NGP, MAX_NGP, &
10200  & gp,MPI_IERROR,NUMBER_OF_GLOBAL_DOFS,gauss_point_idx,NUMBER_OF_DATA_POINT_DOFS,data_point_nyy,dataPointIdx,elementIdx, &
10201  & localDataNumber,globalElementNumber
10202  INTEGER(INTG), ALLOCATABLE :: variable_local_dofs_offsets(:),variable_ghost_dofs_offsets(:), &
10203  & localDataParamCount(:),ghostDataParamCount(:)
10204  TYPE(decomposition_type), POINTER :: decomposition
10205  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
10206  TYPE(domain_type), POINTER :: domain
10207  TYPE(domain_mapping_type), POINTER :: elementsmapping,dofs_mapping,field_variable_dofs_mapping
10208  TYPE(domain_topology_type), POINTER :: domain_topology
10209  TYPE(field_variable_component_type), POINTER :: field_component
10210  TYPE(varying_string) :: local_error
10211  TYPE(basis_type), POINTER :: basis
10212 
10213  enters("FIELD_MAPPINGS_CALCULATE",err,error,*999)
10214 
10215  IF(ASSOCIATED(field)) THEN
10216  number_of_computational_nodes=computational_nodes_number_get(err,error)
10217  IF(err/=0) GOTO 999
10218  my_computational_node_number=computational_node_number_get(err,error)
10219  IF(err/=0) GOTO 999
10220  !Calculate the number of global and local degrees of freedom for the field variables and components. Each field variable
10221  !component has a set of DOFs so loop over the components for each variable component and count up the DOFs.
10222  DO variable_idx=1,field%NUMBER_OF_VARIABLES
10223  number_of_constant_dofs=0
10224  number_of_element_dofs=0
10225  number_of_node_dofs=0
10226  number_of_grid_point_dofs=0
10227  number_of_gauss_point_dofs=0
10228  number_of_data_point_dofs=0
10229  number_of_local_variable_dofs=0
10230  total_number_of_variable_dofs=0
10231  number_of_global_variable_dofs=0
10232  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
10233  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
10234  SELECT CASE(field_component%INTERPOLATION_TYPE)
10235  CASE(field_constant_interpolation)
10236  number_of_constant_dofs=number_of_constant_dofs+1
10237  number_of_local_variable_dofs=number_of_local_variable_dofs+1
10238  total_number_of_variable_dofs=total_number_of_variable_dofs+1
10239  number_of_global_variable_dofs=number_of_global_variable_dofs+1
10240  CASE(field_element_based_interpolation)
10241  domain=>field_component%DOMAIN
10242  domain_topology=>domain%TOPOLOGY
10243  number_of_element_dofs=number_of_element_dofs+domain_topology%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS
10244  number_of_local_variable_dofs=number_of_local_variable_dofs+domain_topology%ELEMENTS%NUMBER_OF_ELEMENTS
10245  total_number_of_variable_dofs=total_number_of_variable_dofs+domain_topology%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS
10246  number_of_global_variable_dofs=number_of_global_variable_dofs+domain_topology%ELEMENTS%NUMBER_OF_GLOBAL_ELEMENTS
10247  CASE(field_node_based_interpolation)
10248  domain=>field_component%DOMAIN
10249  domain_topology=>domain%TOPOLOGY
10250  number_of_node_dofs=number_of_node_dofs+domain_topology%DOFS%TOTAL_NUMBER_OF_DOFS
10251  number_of_local_variable_dofs=number_of_local_variable_dofs+domain_topology%DOFS%NUMBER_OF_DOFS
10252  total_number_of_variable_dofs=total_number_of_variable_dofs+domain_topology%DOFS%TOTAL_NUMBER_OF_DOFS
10253  number_of_global_variable_dofs=number_of_global_variable_dofs+domain_topology%DOFS%NUMBER_OF_GLOBAL_DOFS
10254  CASE(field_grid_point_based_interpolation)
10255  CALL flagerror("Not implemented.",err,error,*999)
10256  CASE(field_gauss_point_based_interpolation)
10257  domain=>field_component%DOMAIN
10258  domain_topology=>domain%TOPOLOGY
10259  max_ngp = -1
10260  DO element_idx=1,domain_topology%ELEMENTS%NUMBER_OF_ELEMENTS
10261  basis=>domain_topology%ELEMENTS%ELEMENTS(element_idx)%BASIS
10262  ngp=basis%QUADRATURE%QUADRATURE_SCHEME_MAP(basis_default_quadrature_scheme)%PTR%NUMBER_OF_GAUSS
10263  max_ngp=max(max_ngp,ngp)
10264  ENDDO !element_idx
10265  CALL mpi_allreduce(mpi_in_place,max_ngp,1,mpi_integer,mpi_max,mpi_comm_world,mpi_ierror)
10266  CALL mpi_error_check("MPI_ALLREDUCE",mpi_ierror,err,error,*999)
10267  number_of_gauss_point_dofs=number_of_gauss_point_dofs+domain_topology%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS*max_ngp
10268  number_of_local_variable_dofs=number_of_local_variable_dofs+domain_topology%ELEMENTS%NUMBER_OF_ELEMENTS*max_ngp
10269  total_number_of_variable_dofs=total_number_of_variable_dofs+domain_topology%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS*max_ngp
10270  number_of_global_variable_dofs=number_of_global_variable_dofs+domain_topology%ELEMENTS%NUMBER_OF_GLOBAL_ELEMENTS*max_ngp
10271  CASE(field_data_point_based_interpolation)
10272  ! Data points do not have domain topology or mappings, since they're the same across all mesh components
10273  decompositiontopology=>field%DECOMPOSITION%TOPOLOGY
10274  number_of_data_point_dofs=number_of_data_point_dofs+decompositiontopology%dataPoints%totalNumberOfDataPoints
10275  number_of_local_variable_dofs=number_of_local_variable_dofs+decompositiontopology%dataPoints%numberOfDataPoints
10276  total_number_of_variable_dofs=total_number_of_variable_dofs+decompositiontopology% &
10277  & datapoints%totalNumberOfDataPoints
10278  number_of_global_variable_dofs=number_of_global_variable_dofs+decompositiontopology%dataPoints% &
10279  & numberofglobaldatapoints
10280  CASE DEFAULT
10281  local_error="The interpolation type of "// &
10282  & trim(number_to_vstring(field%VARIABLES(variable_idx)%COMPONENTS(component_idx)%INTERPOLATION_TYPE, &
10283  & "*",err,error))//" is invalid for component number "//trim(number_to_vstring(component_idx,"*",err,error))// &
10284  & " of variable type "//trim(number_to_vstring(field%VARIABLES(variable_idx)%VARIABLE_TYPE,"*",err,error))//"."
10285  CALL flagerror(local_error,err,error,*999)
10286  END SELECT
10287  ENDDO !component_idx
10288  !Allocate the DOF to parameters (nodes, elements, gauss, components etc.) maps.
10289  field%VARIABLES(variable_idx)%NUMBER_OF_DOFS=number_of_local_variable_dofs
10290  field%VARIABLES(variable_idx)%TOTAL_NUMBER_OF_DOFS=total_number_of_variable_dofs
10291  field%VARIABLES(variable_idx)%NUMBER_OF_GLOBAL_DOFS=number_of_global_variable_dofs
10292  ALLOCATE(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(2,total_number_of_variable_dofs),stat=err)
10293  IF(err/=0) CALL flagerror("Could not allocate dof to parameter map.",err,error,*999)
10294  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_DOFS=total_number_of_variable_dofs
10295  IF(number_of_constant_dofs>0) THEN
10296  ALLOCATE(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%CONSTANT_DOF2PARAM_MAP(number_of_constant_dofs),stat=err)
10297  IF(err/=0) CALL flagerror("Could not allocate dof to parameter constant map.",err,error,*999)
10298  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_CONSTANT_DOFS=number_of_constant_dofs
10299  ENDIF
10300  IF(number_of_element_dofs>0) THEN
10301  ALLOCATE(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%ELEMENT_DOF2PARAM_MAP(2,number_of_element_dofs),stat=err)
10302  IF(err/=0) CALL flagerror("Could not allocate dof to parameter element map.",err,error,*999)
10303  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_ELEMENT_DOFS=number_of_element_dofs
10304  ENDIF
10305  IF(number_of_node_dofs>0) THEN
10306  ALLOCATE(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NODE_DOF2PARAM_MAP(4,number_of_node_dofs),stat=err)
10307  IF(err/=0) CALL flagerror("Could not allocate dof to parameter node map.",err,error,*999)
10308  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_NODE_DOFS=number_of_node_dofs
10309  ENDIF
10310  IF(number_of_grid_point_dofs>0) THEN
10311  ALLOCATE(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%GRID_POINT_DOF2PARAM_MAP(2,number_of_grid_point_dofs),stat=err)
10312  IF(err/=0) CALL flagerror("Could not allocate dof to parameter grid point map.",err,error,*999)
10313  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_GRID_POINT_DOFS=number_of_grid_point_dofs
10314  ENDIF
10315  IF(number_of_gauss_point_dofs>0) THEN
10316  ALLOCATE(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%GAUSS_POINT_DOF2PARAM_MAP(3,number_of_gauss_point_dofs),stat=err)
10317  IF(err/=0) CALL flagerror("Could not allocate dof to parameter Gauss point map.",err,error,*999)
10318  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_GAUSS_POINT_DOFS=number_of_gauss_point_dofs
10319  ENDIF
10320  IF(number_of_data_point_dofs>0) THEN
10321  ALLOCATE(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DATA_POINT_DOF2PARAM_MAP(3,number_of_data_point_dofs),stat=err)
10322  IF(err/=0) CALL flagerror("Could not allocate dof to parameter Gauss point map.",err,error,*999)
10323  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_DATA_POINT_DOFS=number_of_data_point_dofs
10324  ENDIF
10325  ENDDO !variable_idx
10326  !Allocate the mapping arrays
10327  decomposition=>field%DECOMPOSITION
10328  ALLOCATE(variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1),stat=err)
10329  IF(err/=0) CALL flagerror("Could not allocate variable local dofs offsets.",err,error,*999)
10330  ALLOCATE(variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1),stat=err)
10331  IF(err/=0) CALL flagerror("Could not allocate variable ghost dofs offsets.",err,error,*999)
10332  !We want to ensure that the ghost DOFs are at the end so loop over the DOFs in two passes. The first pass will process
10333  !the local DOFs for each variable component and the second pass will process the ghost DOFs for each variable component.
10334  IF(number_of_computational_nodes==1) THEN
10335  domain_type_stop=1 !Local only
10336  ELSE
10337  domain_type_stop=2 !Local+Ghosts
10338  ENDIF
10339  !Calculate the local and global numbers and set up the mappings
10340  DO variable_idx=1,field%NUMBER_OF_VARIABLES
10341  constant_nyy=0
10342  element_nyy=0
10343  node_nyy=0
10344  grid_point_nyy=0
10345  gauss_point_nyy=0
10346  data_point_nyy=0
10347  variable_local_ny=0
10348  field_variable_dofs_mapping=>field%VARIABLES(variable_idx)%DOMAIN_MAPPING
10349  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10350  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(field%VARIABLES(variable_idx)%NUMBER_OF_GLOBAL_DOFS),stat=err)
10351  IF(err/=0) CALL flagerror("Could not allocate variable dofs mapping global to local map.",err,error,*999)
10352  field_variable_dofs_mapping%NUMBER_OF_GLOBAL=field%VARIABLES(variable_idx)%NUMBER_OF_GLOBAL_DOFS
10353  ENDIF
10354  !The ordering of the DOFs with respect to components is arbitrary. Allow for two orderings: The first ordering is that
10355  !all the DOFs from one component are processed before all the DOFs of the next component. This is known as "separated"
10356  !component DOF ordering. The second ordering is to process all the components for a particular parameter (e.g., node)
10357  !and then process all the components for the next parameter. This is known as "contiguous" component DOF ordering.
10358  !Continguous component ordering only works if each of the components has the same DOF structure. For this reason
10359  !separate component ordering is the default.
10360  SELECT CASE(field%VARIABLES(variable_idx)%DOF_ORDER_TYPE)
10361  CASE(field_separated_component_dof_order)
10362  !Loop over the domain types. Here domain_type_idx=1 for the non-ghosted dofs and =2 for the ghosted dofs.
10363  variable_ghost_dofs_offsets=0
10364  DO domain_type_idx=1,domain_type_stop
10365  variable_global_dofs_offset=0
10366  variable_local_dofs_offsets=0
10367  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
10368  number_of_local=0
10369  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
10370  SELECT CASE(field_component%INTERPOLATION_TYPE)
10371  CASE(field_constant_interpolation)
10372  !Only process the non-ghosted dofs for constant interpolation
10373  IF(domain_type_idx==1) THEN
10374  variable_local_ny=variable_local_ny+1
10375  !Allocate and set up global to local domain map for variable mapping
10376  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10377  variable_global_ny=1+variable_global_dofs_offset
10378  CALL domain_mappings_mapping_global_initialise(field_variable_dofs_mapping% &
10379  & global_to_local_map(variable_global_ny),err,error,*999)
10380  number_of_domains=number_of_computational_nodes !Constant is in all domains
10381  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(number_of_domains), &
10382  & stat=err)
10383  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local number.", &
10384  & err,error,*999)
10385  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(number_of_domains), &
10386  & stat=err)
10387  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map domain number.", &
10388  & err,error,*999)
10389  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(number_of_domains), &
10390  & stat=err)
10391  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local type.", &
10392  & err,error,*999)
10393  !A constant dof is mapped to all domains.
10394  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS=number_of_domains
10395  DO domain_idx=1,number_of_domains
10396  domain_no=domain_idx-1
10397  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10398  & 1+variable_local_dofs_offsets(domain_no)
10399  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)=domain_no
10400  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)= &
10401  & domain_local_internal
10402  ENDDO !domain_idx
10403  ENDIF
10404  constant_nyy=constant_nyy+1
10405  !Setup dof to parameter map
10406  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(1,variable_local_ny)=field_constant_dof_type
10407  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(2,variable_local_ny)=constant_nyy
10408  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%CONSTANT_DOF2PARAM_MAP(constant_nyy)=component_idx
10409  !Setup reverse parameter to dof map
10410  field_component%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS=1
10411  field_component%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP=variable_local_ny
10412  !Adjust the offsets
10413  variable_global_dofs_offset=variable_global_dofs_offset+1
10414  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10415  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+1
10416  ENDIF
10417  CASE(field_element_based_interpolation)
10418  domain=>field_component%DOMAIN
10419  domain_topology=>domain%TOPOLOGY
10420  elementsmapping=>domain%MAPPINGS%ELEMENTS
10421  IF(domain_type_idx==1) THEN
10422  !Allocate parameter to dof map for this field variable component
10423  dofs_mapping=>domain%MAPPINGS%ELEMENTS
10424  ALLOCATE(field_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS(domain_topology%ELEMENTS% &
10425  & total_number_of_elements),stat=err)
10426  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof element map.",err,error,*999)
10427  field_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS= &
10428  & domain_topology%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS
10429  !Handle global dofs domain mapping
10430  DO ny=1,elementsmapping%NUMBER_OF_GLOBAL
10431  !Handle field variable mappings
10432  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10433  variable_global_ny=ny+variable_global_dofs_offset
10434  CALL domain_mappings_mapping_global_initialise(field_variable_dofs_mapping% &
10435  & global_to_local_map(variable_global_ny),err,error,*999)
10436  number_of_domains=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%NUMBER_OF_DOMAINS
10437  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
10438  & local_number(number_of_domains),stat=err)
10439  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local number.", &
10440  & err,error,*999)
10441  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
10442  & domain_number(number_of_domains),stat=err)
10443  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map domain number.", &
10444  & err,error,*999)
10445  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(number_of_domains), &
10446  & stat=err)
10447  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local type.", &
10448  & err,error,*999)
10449  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS=number_of_domains
10450  DO domain_idx=1,number_of_domains
10451  domain_no=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
10452  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10453  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_NUMBER(domain_idx)+variable_local_dofs_offsets(domain_no)
10454  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)= &
10455  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
10456  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)= &
10457  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_TYPE(domain_idx)
10458  ENDDO !domain_idx
10459  ENDIF
10460  ENDDO !ny
10461  start_idx=1
10462  stop_idx=elementsmapping%NUMBER_OF_LOCAL
10463  !Adjust the local and ghost offsets
10464  IF(component_idx>1) &
10465  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10466  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+elementsmapping%NUMBER_OF_DOMAIN_LOCAL
10467  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10468  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+ &
10469  & elementsmapping%NUMBER_OF_DOMAIN_LOCAL+elementsmapping%NUMBER_OF_DOMAIN_GHOST
10470  ELSE
10471  !Handle global dofs domain mapping. For the second pass adjust the local dof numbers to ensure that the ghost
10472  !dofs are at the end of the local dofs.
10473  !Adjust the ghost offsets
10474  IF(component_idx>1) &
10475  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10476  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)-elementsmapping%NUMBER_OF_DOMAIN_LOCAL
10477  DO ny=1,elementsmapping%NUMBER_OF_GLOBAL
10478  !Adjust variable mapping local numbers
10479  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10480  variable_global_ny=ny+variable_global_dofs_offset
10481  number_of_domains=field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS
10482  DO domain_idx=1,number_of_domains
10483  domain_no=field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)
10484  IF(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)== &
10485  & domain_local_ghost) THEN
10486  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10487  & field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)+ &
10488  & variable_ghost_dofs_offsets(domain_no)
10489  ELSE
10490  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10491  & field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)+ &
10492  & variable_local_dofs_offsets(domain_no)
10493  ENDIF
10494  ENDDO !domain_idx
10495  ENDIF
10496  ENDDO !ny (global)
10497  start_idx=elementsmapping%NUMBER_OF_LOCAL+1
10498  stop_idx=elementsmapping%TOTAL_NUMBER_OF_LOCAL
10499  !Adjust the local offsets
10500  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10501  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)-elementsmapping%NUMBER_OF_DOMAIN_GHOST
10502  ENDIF
10503  !Adjust the global offset
10504  variable_global_dofs_offset=variable_global_dofs_offset+elementsmapping%NUMBER_OF_GLOBAL
10505  !Handle local dofs domain mapping
10506  DO element_idx=start_idx,stop_idx
10507  variable_local_ny=variable_local_ny+1
10508  element_nyy=element_nyy+1
10509  !Setup dof to parameter map
10510  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(1,variable_local_ny)=field_element_dof_type
10511  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(2,variable_local_ny)=element_nyy
10512  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%ELEMENT_DOF2PARAM_MAP(1,element_nyy)=element_idx
10513  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%ELEMENT_DOF2PARAM_MAP(2,element_nyy)=component_idx
10514  !Setup reverse parameter to dof map
10515  field_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS(element_idx)=variable_local_ny
10516  ENDDO !element_idx
10517  CASE(field_node_based_interpolation)
10518  domain=>field_component%DOMAIN
10519  domain_topology=>domain%TOPOLOGY
10520  dofs_mapping=>domain%MAPPINGS%DOFS
10521  IF(domain_type_idx==1) THEN
10522  ALLOCATE(field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES( &
10523  domain_topology%NODES%TOTAL_NUMBER_OF_NODES),stat=err)
10524  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof node map (nodes).",err,error,*999)
10525  field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS = &
10526  & domain_topology%NODES%TOTAL_NUMBER_OF_NODES
10527  !Loop through and allocate number of derivatives for each node in the domain
10528  DO node_idx=1,domain_topology%NODES%TOTAL_NUMBER_OF_NODES
10529  ALLOCATE(field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%DERIVATIVES( &
10530  & domain_topology%NODES%NODES(node_idx)%NUMBER_OF_DERIVATIVES),stat=err)
10531  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof node map (derivatives).", &
10532  & err,error,*999)
10533  field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%NUMBER_OF_DERIVATIVES = &
10534  & domain_topology%NODES%NODES(node_idx)%NUMBER_OF_DERIVATIVES
10535  DO derivative_idx=1,domain_topology%NODES%NODES(node_idx)%NUMBER_OF_DERIVATIVES
10536  ALLOCATE(field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%DERIVATIVES(derivative_idx)% &
10537  & versions(domain_topology%NODES%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions),stat=err)
10538  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof node map (versions).", &
10539  & err,error,*999)
10540  field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%DERIVATIVES(derivative_idx)% &
10541  & number_of_versions = domain_topology%NODES%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
10542  ENDDO !derivative_idx
10543  ENDDO !node_idx
10544  DO ny=1,dofs_mapping%NUMBER_OF_GLOBAL
10545  !Handle variable mapping
10546  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10547  variable_global_ny=ny+variable_global_dofs_offset
10548  CALL domain_mappings_mapping_global_initialise(field_variable_dofs_mapping% &
10549  & global_to_local_map(variable_global_ny),err,error,*999)
10550  number_of_domains=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%NUMBER_OF_DOMAINS
10551  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
10552  & local_number(number_of_domains),stat=err)
10553  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local number.", &
10554  & err,error,*999)
10555  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
10556  & domain_number(number_of_domains),stat=err)
10557  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map domain number.", &
10558  & err,error,*999)
10559  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(number_of_domains), &
10560  & stat=err)
10561  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local type.", &
10562  & err,error,*999)
10563  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS=number_of_domains
10564  DO domain_idx=1,number_of_domains
10565  domain_no=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
10566  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10567  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_NUMBER(domain_idx)+variable_local_dofs_offsets(domain_no)
10568  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)= &
10569  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
10570  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)= &
10571  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_TYPE(domain_idx)
10572  ENDDO !domain_idx
10573  ENDIF
10574  ENDDO !ny (global)
10575  start_idx=1
10576  stop_idx=dofs_mapping%NUMBER_OF_LOCAL
10577  !Adjust the local and ghost offsets
10578  IF(component_idx>1) &
10579  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10580  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+dofs_mapping%NUMBER_OF_DOMAIN_LOCAL
10581  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10582  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+ &
10583  & dofs_mapping%NUMBER_OF_DOMAIN_LOCAL+dofs_mapping%NUMBER_OF_DOMAIN_GHOST
10584  ELSE
10585  !Handle global dofs domain mapping. For the second pass adjust the local dof numbers to ensure that the ghost
10586  !dofs are at the end of the local dofs.
10587  !Adjust the ghost offsets
10588  IF(component_idx>1) &
10589  variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10590  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)-dofs_mapping%NUMBER_OF_DOMAIN_LOCAL
10591  DO ny=1,dofs_mapping%NUMBER_OF_GLOBAL
10592  !Adjust variable mapping local numbers
10593  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10594  variable_global_ny=ny+variable_global_dofs_offset
10595  number_of_domains=field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS
10596  DO domain_idx=1,number_of_domains
10597  domain_no=field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)
10598  IF(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)== &
10599  & domain_local_ghost) THEN
10600  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10601  & field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)+ &
10602  & variable_ghost_dofs_offsets(domain_no)
10603  ELSE
10604  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10605  & field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)+ &
10606  & variable_local_dofs_offsets(domain_no)
10607  ENDIF
10608  ENDDO !domain_idx
10609  ENDIF
10610  ENDDO !ny (global)
10611  start_idx=dofs_mapping%NUMBER_OF_LOCAL+1
10612  stop_idx=dofs_mapping%TOTAL_NUMBER_OF_LOCAL
10613  !Adjust the local offsets
10614  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10615  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)-dofs_mapping%NUMBER_OF_DOMAIN_GHOST
10616  ENDIF
10617  !Adjust the global offset
10618  variable_global_dofs_offset=variable_global_dofs_offset+dofs_mapping%NUMBER_OF_GLOBAL
10619  !Handle local dofs domain mapping
10620  DO ny=start_idx,stop_idx
10621  variable_local_ny=variable_local_ny+1
10622  node_nyy=node_nyy+1
10623  version_idx=domain%TOPOLOGY%DOFS%DOF_INDEX(1,ny)
10624  derivative_idx=domain%TOPOLOGY%DOFS%DOF_INDEX(2,ny)
10625  node_idx=domain%TOPOLOGY%DOFS%DOF_INDEX(3,ny)
10626  !Setup dof to parameter map
10627  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(1,variable_local_ny)=field_node_dof_type
10628  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(2,variable_local_ny)=node_nyy
10629  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NODE_DOF2PARAM_MAP(1,node_nyy)=version_idx
10630  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NODE_DOF2PARAM_MAP(2,node_nyy)=derivative_idx
10631  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NODE_DOF2PARAM_MAP(3,node_nyy)=node_idx
10632  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NODE_DOF2PARAM_MAP(4,node_nyy)=component_idx
10633  !Setup reverse parameter to dof map
10634  field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%DERIVATIVES(derivative_idx)% &
10635  & versions(version_idx) = variable_local_ny
10636  ENDDO !ny
10637  CASE(field_grid_point_based_interpolation)
10638  CALL flagerror("Not implemented.",err,error,*999)
10639  CASE(field_gauss_point_based_interpolation)
10640  domain=>field_component%DOMAIN
10641  elementsmapping=>domain%MAPPINGS%ELEMENTS
10642  domain_topology=>domain%TOPOLOGY
10643  IF(domain_type_idx==1) THEN ! domain_type_idx==1 --> non ghosts
10644  !Allocate parameter to dof map for this field variable component
10645  dofs_mapping=>domain%MAPPINGS%ELEMENTS
10646  ! GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS(ng,element_idx). The field variable dof number of ng'th Gauss point in the element_idx'th element based parameter for this field variable component.
10647  ALLOCATE(field_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS(&
10648  & max_ngp,domain_topology%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS),stat=err)
10649  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof Gauss point map.",err,error,*999)
10650  ! this might be wasteful in worst case, but should generally be ok
10651  field_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%NUMBER_OF_GAUSS_POINT_PARAMETERS= &
10652  & domain_topology%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS*max_ngp
10653  !Handle global dofs domain mapping
10654  DO ny=1,elementsmapping%NUMBER_OF_GLOBAL
10655  DO gp=1,max_ngp !
10656  !Handle field variable mappings
10657  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10658  variable_global_ny= (ny-1) * max_ngp + gp + variable_global_dofs_offset
10659  CALL domain_mappings_mapping_global_initialise(field_variable_dofs_mapping% &
10660  & global_to_local_map(variable_global_ny),err,error,*999)
10661  number_of_domains=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%NUMBER_OF_DOMAINS
10662  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
10663  & local_number(number_of_domains),stat=err)
10664  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local number.", &
10665  & err,error,*999)
10666  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
10667  & domain_number(number_of_domains),stat=err)
10668  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map domain number.", &
10669  & err,error,*999)
10670  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(number_of_domains), &
10671  & stat=err)
10672  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map domain number.", &
10673  & err,error,*999)
10674  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS=number_of_domains
10675  DO domain_idx=1,number_of_domains
10676  domain_no=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
10677  ! elt local number = 1 -> gp local = 1..max_ngp, etc
10678  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10679  & (dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_NUMBER(domain_idx) - 1) * max_ngp + gp &
10680  & + variable_local_dofs_offsets(domain_no)
10681  ! domain and type same as element
10682  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)= &
10683  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
10684  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)= &
10685  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_TYPE(domain_idx)
10686  ENDDO !domain_idx
10687  ENDIF
10688  ENDDO ! gp
10689  ENDDO !ny
10690  start_idx=1
10691  stop_idx=elementsmapping%NUMBER_OF_LOCAL
10692  !Adjust the local and ghost offsets
10693  IF(component_idx>1) &
10694  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10695  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+ &
10696  & elementsmapping%NUMBER_OF_DOMAIN_LOCAL*max_ngp
10697  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10698  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+ &
10699  & (elementsmapping%NUMBER_OF_DOMAIN_LOCAL+elementsmapping%NUMBER_OF_DOMAIN_GHOST)*max_ngp
10700  ELSE !domain_type_idx==2 --> ghosts
10701  !Handle global dofs domain mapping. For the second pass adjust the local dof numbers to ensure that the ghost
10702  !dofs are at the end of the local dofs.
10703  !Adjust the ghost offsets
10704  IF(component_idx>1) &
10705  variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10706  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)- &
10707  & elementsmapping%NUMBER_OF_DOMAIN_LOCAL*max_ngp
10708  DO ny=1,elementsmapping%NUMBER_OF_GLOBAL
10709  DO gp=1,max_ngp !
10710  !Adjust variable mapping local numbers
10711  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10712  variable_global_ny= (ny-1) * max_ngp + gp + variable_global_dofs_offset
10713  number_of_domains=field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS
10714  DO domain_idx=1,number_of_domains
10715  domain_no=field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)
10716  IF(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)== &
10717  & domain_local_ghost) THEN
10718  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10719  & field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)+ &
10720  & variable_ghost_dofs_offsets(domain_no)
10721  ELSE
10722  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10723  & field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)+ &
10724  & variable_local_dofs_offsets(domain_no)
10725  ENDIF
10726  ENDDO !domain_idx
10727  ENDIF
10728  ENDDO ! gp
10729  ENDDO !ny (global)
10730  start_idx=elementsmapping%NUMBER_OF_LOCAL+1
10731  stop_idx=elementsmapping%TOTAL_NUMBER_OF_LOCAL
10732  !Adjust the local offsets
10733  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10734  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)- &
10735  & elementsmapping%NUMBER_OF_DOMAIN_GHOST*max_ngp
10736  ENDIF ! 2 passes for normal, ghost
10737  !Adjust the global offset
10738  variable_global_dofs_offset=variable_global_dofs_offset+elementsmapping%NUMBER_OF_GLOBAL*max_ngp
10739  !Handle local dofs domain mapping
10740  DO element_idx=start_idx,stop_idx
10741  DO gp=1,max_ngp !
10742  variable_local_ny= variable_local_ny+1
10743  gauss_point_nyy = gauss_point_nyy+1
10744  !Setup dof to parameter map
10745  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(1,variable_local_ny)=field_gauss_point_dof_type
10746  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(2,variable_local_ny)=gauss_point_nyy
10747  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%GAUSS_POINT_DOF2PARAM_MAP(1,gauss_point_nyy)=gp
10748  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%GAUSS_POINT_DOF2PARAM_MAP(2,gauss_point_nyy)=element_idx
10749  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%GAUSS_POINT_DOF2PARAM_MAP(3,gauss_point_nyy)=component_idx
10750  !Setup reverse parameter to dof map
10751  field_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS(gp,element_idx)=variable_local_ny
10752  ENDDO !gp
10753  ENDDO !element_idx
10754  CASE(field_data_point_based_interpolation)
10755  domain=>field_component%DOMAIN
10756  elementsmapping=>domain%MAPPINGS%ELEMENTS
10757  decompositiontopology=>domain%DECOMPOSITION%TOPOLOGY
10758  IF(domain_type_idx==1) THEN ! domain_type_idx==1 -> non ghosts
10759  !Allocate parameter to dof map for this field variable component
10760  !including both local and ghost data points on this computational domain.
10761  ALLOCATE(field_component%PARAM_TO_DOF_MAP%DATA_POINT_PARAM2DOF_MAP%DATA_POINTS(decompositiontopology% &
10762  & datapoints%totalNumberOfDataPoints),stat=err)
10763  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof data point map.",err,error,*999)
10764  ! Number of data points
10765  field_component%PARAM_TO_DOF_MAP%DATA_POINT_PARAM2DOF_MAP%NUMBER_OF_DATA_POINT_PARAMETERS= &
10766  & decompositiontopology%dataPoints%totalNumberOfDataPoints
10767  ALLOCATE(localdataparamcount(0:decomposition%NUMBER_OF_DOMAINS-1),stat=err)
10768  IF(err/=0) CALL flagerror("Could not allocate data point parameter local count.",err,error,*999)
10769  ALLOCATE(ghostdataparamcount(0:decomposition%NUMBER_OF_DOMAINS-1),stat=err)
10770  IF(err/=0) CALL flagerror("Could not allocate data point parameter ghost count.",err,error,*999)
10771  localdataparamcount=0
10772  ghostdataparamcount(0:decomposition%NUMBER_OF_DOMAINS-1)=decompositiontopology%dataPoints%numberOfDomainLocal
10773  !Looping through global elements and data points in the elements
10774  variable_global_ny=variable_global_dofs_offset
10775  DO elementidx=1,elementsmapping%NUMBER_OF_GLOBAL
10776  DO datapointidx=1,decompositiontopology%dataPoints%numberOfelementDataPoints(elementidx)
10777  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10778  variable_global_ny=variable_global_ny+1
10779  CALL domain_mappings_mapping_global_initialise(field_variable_dofs_mapping% &
10780  & global_to_local_map(variable_global_ny),err,error,*999)
10781  number_of_domains=elementsmapping%GLOBAL_TO_LOCAL_MAP(elementidx)%NUMBER_OF_DOMAINS
10782  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
10783  & local_number(number_of_domains),stat=err)
10784  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local number.", &
10785  & err,error,*999)
10786  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
10787  & domain_number(number_of_domains),stat=err)
10788  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map domain number.", &
10789  & err,error,*999)
10790  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
10791  & local_type(number_of_domains),stat=err)
10792  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local type.", &
10793  & err,error,*999)
10794  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS=number_of_domains
10795  DO domain_idx=1,number_of_domains
10796  domain_no=elementsmapping%GLOBAL_TO_LOCAL_MAP(elementidx)%DOMAIN_NUMBER(domain_idx)
10797  IF(elementsmapping%GLOBAL_TO_LOCAL_MAP(elementidx)%LOCAL_TYPE(domain_idx)== &
10798  & domain_local_ghost) THEN
10799  ghostdataparamcount(domain_no)=ghostdataparamcount(domain_no)+1
10800  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10801  & ghostdataparamcount(domain_no)+variable_local_dofs_offsets(domain_no)
10802  ELSE
10803  localdataparamcount(domain_no)=localdataparamcount(domain_no)+1
10804  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10805  & localdataparamcount(domain_no)+variable_local_dofs_offsets(domain_no)
10806  ENDIF
10807  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)= &
10808  & elementsmapping%GLOBAL_TO_LOCAL_MAP(elementidx)%DOMAIN_NUMBER(domain_idx)
10809  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)= &
10810  & elementsmapping%GLOBAL_TO_LOCAL_MAP(elementidx)%LOCAL_TYPE(domain_idx)
10811  ENDDO !domain_idx
10812  ENDIF
10813  ENDDO !dataPointIdx
10814  ENDDO !elementIdx
10815  IF(ALLOCATED(localdataparamcount)) DEALLOCATE(localdataparamcount)
10816  IF(ALLOCATED(ghostdataparamcount)) DEALLOCATE(ghostdataparamcount)
10817  start_idx=1 !the start idx for the elements
10818  stop_idx=elementsmapping%NUMBER_OF_LOCAL !the end idx for local elements
10819  !Adjust the local and ghost offsets
10820  IF(component_idx>1) THEN
10821  variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10822  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+ &
10823  & decompositiontopology%dataPoints%numberOfDomainLocal
10824  ENDIF
10825  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10826  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+ &
10827  & decompositiontopology%dataPoints%numberOfDomainLocal+decompositiontopology%dataPoints%numberOfDomainGhost
10828  ELSE ! domain_type_idx == 2 -> ghosts
10829  !Handle global dofs domain mapping. For the second pass adjust the local dof numbers to ensure that the ghost
10830  !dofs are at the end of the local dofs.
10831  !Adjust the ghost offsets
10832  IF(component_idx>1) THEN
10833  variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10834  & variable_ghost_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)- &
10835  & decompositiontopology%dataPoints%numberOfDomainLocal
10836  ENDIF
10837  !Looping through global elements and data points in the elements
10838  variable_global_ny=variable_global_dofs_offset
10839  DO elementidx=1,elementsmapping%NUMBER_OF_GLOBAL
10840  DO datapointidx=1,decompositiontopology%dataPoints%numberOfelementDataPoints(elementidx)
10841  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10842  variable_global_ny=variable_global_ny+1
10843  number_of_domains=elementsmapping%GLOBAL_TO_LOCAL_MAP(elementidx)%NUMBER_OF_DOMAINS
10844  DO domain_idx=1,number_of_domains
10845  domain_no=elementsmapping%GLOBAL_TO_LOCAL_MAP(elementidx)%DOMAIN_NUMBER(domain_idx)
10846  IF(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)== &
10847  & domain_local_ghost) THEN
10848  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10849  & field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)+ &
10850  & variable_ghost_dofs_offsets(domain_no)
10851  ELSE
10852  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10853  & field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)+ &
10854  & variable_local_dofs_offsets(domain_no)
10855  ENDIF
10856  ENDDO
10857  ENDIF
10858  ENDDO !dataPointIdx
10859  ENDDO !elementIdx
10860  !Adjust the local offsets
10861  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10862  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)- &
10863  & decompositiontopology%dataPoints%numberOfDomainGhost
10864  start_idx=elementsmapping%NUMBER_OF_LOCAL+1 !The start index for ghost elements
10865  stop_idx=elementsmapping%TOTAL_NUMBER_OF_LOCAL !The end index for local elements
10866  ENDIF
10867  !Adjust the global offset
10868  variable_global_dofs_offset=variable_global_dofs_offset+decompositiontopology%dataPoints%&
10869  & numberofglobaldatapoints
10870  !Handle local dofs domain mapping
10871  DO elementidx=start_idx,stop_idx
10872  globalelementnumber=elementsmapping%LOCAL_TO_GLOBAL_MAP(elementidx)
10873  DO datapointidx=1,decompositiontopology%dataPoints%numberOfelementDataPoints(globalelementnumber)
10874  variable_local_ny=variable_local_ny+1 !reinitialise for every field variable, field variable dof idx
10875  data_point_nyy=data_point_nyy+1 !reinitialise for every field variable, field variable data point dof idx
10876  localdatanumber=decompositiontopology%dataPoints%elementDataPoint(elementidx)%dataIndices(datapointidx)% &
10877  & localnumber
10878  !Setup dof to parameter map
10879  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(1,variable_local_ny)=field_data_point_dof_type
10880  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(2,variable_local_ny)=data_point_nyy
10881  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DATA_POINT_DOF2PARAM_MAP(1,data_point_nyy)=localdatanumber
10882  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DATA_POINT_DOF2PARAM_MAP(2,data_point_nyy)=elementidx
10883  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DATA_POINT_DOF2PARAM_MAP(3,data_point_nyy)=component_idx
10884  !Setup reverse parameter to dof map
10885  field_component%PARAM_TO_DOF_MAP%DATA_POINT_PARAM2DOF_MAP%DATA_POINTS(localdatanumber)=variable_local_ny
10886  ENDDO !dataPointIdx
10887  ENDDO !elementIdx
10888  CASE DEFAULT
10889  local_error="The interpolation type of "// &
10890  & trim(number_to_vstring(field%VARIABLES(variable_idx)%COMPONENTS(component_idx)%INTERPOLATION_TYPE, &
10891  & "*",err,error))//" is invalid for component number "//trim(number_to_vstring(component_idx,"*",err,error))// &
10892  & " of variable type "//trim(number_to_vstring(field%VARIABLES(variable_idx)%VARIABLE_TYPE,"*",err,error))//"."
10893  CALL flagerror(local_error,err,error,*999)
10894  END SELECT
10895  ENDDO !component_idx
10896  ENDDO !domain_type_idx
10897  CASE(field_contiguous_component_dof_order)
10898  !Handle the case where all components for a particular DOF parameter are processed before all the component of the next
10899  !parameter.
10900  variable_local_dofs_offsets=0
10901  variable_global_dofs_offset=0
10902  variable_ghost_dofs_offsets=0
10903  IF(field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS>=1) THEN
10904  SELECT CASE(field%VARIABLES(variable_idx)%COMPONENTS(1)%INTERPOLATION_TYPE)
10905  CASE(field_constant_interpolation)
10906  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
10907  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
10908  variable_local_ny=1+variable_local_dofs_offsets(my_computational_node_number)
10909  !Allocate and set up global to local domain map for variable mapping
10910  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10911  variable_global_ny=1+variable_global_dofs_offset
10912  CALL domain_mappings_mapping_global_initialise(field_variable_dofs_mapping% &
10913  & global_to_local_map(variable_global_ny),err,error,*999)
10914  number_of_domains=number_of_computational_nodes !Constant is in all domains
10915  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(number_of_domains), &
10916  & stat=err)
10917  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local number.", &
10918  & err,error,*999)
10919  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(number_of_domains), &
10920  & stat=err)
10921  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map domain number.", &
10922  & err,error,*999)
10923  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(number_of_domains), &
10924  & stat=err)
10925  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local type.", &
10926  & err,error,*999)
10927  !A constant dof is mapped to all domains.
10928  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS=number_of_domains
10929  DO domain_idx=1,number_of_domains
10930  domain_no=domain_idx-1
10931  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10932  & 1+variable_local_dofs_offsets(domain_no)
10933  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)=domain_no
10934  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)=domain_local_internal
10935  ENDDO !domain_idx
10936  ENDIF
10937  constant_nyy=constant_nyy+1
10938  !Setup dof to parameter map
10939  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(1,variable_local_ny)=field_constant_dof_type
10940  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(2,variable_local_ny)=constant_nyy
10941  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%CONSTANT_DOF2PARAM_MAP(constant_nyy)=component_idx
10942  !Setup reverse parameter to dof map
10943  field_component%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS=1
10944  field_component%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP=variable_local_ny
10945  !Adjust the offsets
10946  variable_global_dofs_offset=variable_global_dofs_offset+1
10947  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
10948  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+1
10949  ENDDO !component_idx
10950  CASE(field_element_based_interpolation)
10951  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
10952  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
10953  domain=>field_component%DOMAIN
10954  domain_topology=>domain%TOPOLOGY
10955  !Allocate parameter to dof map for this field variable component
10956  ALLOCATE(field_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS(domain_topology%ELEMENTS% &
10957  & total_number_of_elements),stat=err)
10958  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof element map.",err,error,*999)
10959  field_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS= &
10960  & domain_topology%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS
10961  ENDDO !component_idx
10962  !Handle global dofs domain mapping
10963  element_ny=0
10964  DO ny=1,elementsmapping%NUMBER_OF_GLOBAL ! elementsMapping has not been associated for this case !?!
10965  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
10966  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
10967  domain=>field_component%DOMAIN
10968  dofs_mapping=>domain%MAPPINGS%ELEMENTS
10969  !Handle field variable mappings
10970  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
10971  element_ny=element_ny+1
10972  variable_global_ny=element_ny+variable_global_dofs_offset
10973  CALL domain_mappings_mapping_global_initialise(field_variable_dofs_mapping% &
10974  & global_to_local_map(variable_global_ny),err,error,*999)
10975  number_of_domains=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%NUMBER_OF_DOMAINS
10976  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(number_of_domains), &
10977  & stat=err)
10978  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local number.", &
10979  & err,error,*999)
10980  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(number_of_domains), &
10981  & stat=err)
10982  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map domain number.", &
10983  & err,error,*999)
10984  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(number_of_domains), &
10985  & stat=err)
10986  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local type.", &
10987  & err,error,*999)
10988  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS=number_of_domains
10989  DO domain_idx=1,number_of_domains
10990  domain_no=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
10991  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
10992  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_NUMBER(domain_idx)+variable_local_dofs_offsets(domain_no)
10993  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)= &
10994  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
10995  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)= &
10996  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_TYPE(domain_idx)
10997  ENDDO !domain_idx
10998  ENDIF
10999  ENDDO !component_idx
11000  ENDDO !ny
11001  !Loop over the domain types. Here domain_type_idx=1 for the non-ghosted dofs and =2 for the ghosted dofs.
11002  DO domain_type_idx=1,domain_type_stop
11003  IF(domain_type_idx==1) THEN
11004  start_idx=1
11005  stop_idx=elementsmapping%NUMBER_OF_LOCAL
11006  ELSE
11007  start_idx=elementsmapping%NUMBER_OF_LOCAL+1
11008  stop_idx=elementsmapping%TOTAL_NUMBER_OF_LOCAL
11009  ENDIF
11010  !Handle local dofs domain mapping
11011  element_ny=0
11012  DO element_idx=start_idx,stop_idx
11013  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
11014  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
11015  element_ny=element_ny+1
11016  variable_local_ny=element_ny+variable_local_dofs_offsets(my_computational_node_number)
11017  element_nyy=element_nyy+1
11018  !Setup dof to parameter map
11019  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(1,variable_local_ny)=field_element_dof_type
11020  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(2,variable_local_ny)=element_nyy
11021  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%ELEMENT_DOF2PARAM_MAP(1,element_nyy)=element_idx
11022  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%ELEMENT_DOF2PARAM_MAP(2,element_nyy)=component_idx
11023  !Setup reverse parameter to dof map
11024  field_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS(element_idx)=variable_local_ny
11025  ENDDO !component_idx
11026  ENDDO !element_idx
11027  !Adjust the offsets
11028  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
11029  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+ &
11030  & field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS* &
11031  & elementsmapping%NUMBER_OF_DOMAIN_LOCAL
11032  IF(domain_type_idx==1) THEN
11033  variable_global_dofs_offset=variable_global_dofs_offset+field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS* &
11034  & elementsmapping%NUMBER_OF_GLOBAL
11035  ENDIF
11036  ENDDO !domain_type_idx
11037  CASE(field_node_based_interpolation)
11038  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
11039  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
11040  domain=>field_component%DOMAIN
11041  domain_topology=>domain%TOPOLOGY
11042  ALLOCATE(field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(domain_topology%NODES%TOTAL_NUMBER_OF_NODES), &
11043  & stat=err)
11044  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof node map (nodes).",err,error,*999)
11045  field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS = &
11046  & domain_topology%NODES%TOTAL_NUMBER_OF_NODES
11047  !Loop through and allocate number of derivatives for each node in the domain
11048  DO node_idx=1,domain_topology%NODES%TOTAL_NUMBER_OF_NODES
11049  ALLOCATE(field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%DERIVATIVES( &
11050  & domain_topology%NODES%NODES(node_idx)%NUMBER_OF_DERIVATIVES),stat=err)
11051  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof node map (derivatives).", &
11052  & err,error,*999)
11053  field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%NUMBER_OF_DERIVATIVES = &
11054  & domain_topology%NODES%NODES(node_idx)%NUMBER_OF_DERIVATIVES
11055  DO derivative_idx=1,domain_topology%NODES%NODES(node_idx)%NUMBER_OF_DERIVATIVES
11056  ALLOCATE(field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%DERIVATIVES(derivative_idx)% &
11057  & versions(domain_topology%NODES%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions),stat=err)
11058  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof node map (versions).", &
11059  & err,error,*999)
11060  field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%DERIVATIVES(derivative_idx)% &
11061  number_of_versions = domain_topology%NODES%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
11062  ENDDO !derivative_idx
11063  ENDDO !node_idx
11064  ENDDO !component_idx
11065  !Handle global dofs domain mapping
11066  !Should the contiguous components have an inner groupping for derivatives??? i.e., loop over nodes, components then
11067  !derivatives????
11068  node_ny=0
11069  number_of_global_dofs=field%VARIABLES(variable_idx)%COMPONENTS(1)%DOMAIN%MAPPINGS%DOFS%NUMBER_OF_GLOBAL
11070  DO ny=1,number_of_global_dofs
11071  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
11072  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
11073  domain=>field_component%DOMAIN
11074  dofs_mapping=>domain%MAPPINGS%DOFS
11075  !Handle variable mapping
11076  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
11077  node_ny=node_ny+1
11078  variable_global_ny=node_ny+variable_global_dofs_offset
11079  CALL domain_mappings_mapping_global_initialise(field_variable_dofs_mapping% &
11080  & global_to_local_map(variable_global_ny),err,error,*999)
11081  number_of_domains=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%NUMBER_OF_DOMAINS
11082  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
11083  & local_number(number_of_domains),stat=err)
11084  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local number.", &
11085  & err,error,*999)
11086  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
11087  & domain_number(number_of_domains),stat=err)
11088  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map domain number.", &
11089  & err,error,*999)
11090  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(number_of_domains), &
11091  & stat=err)
11092  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local type.", &
11093  & err,error,*999)
11094  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS=number_of_domains
11095  DO domain_idx=1,number_of_domains
11096  domain_no=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
11097  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
11098  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_NUMBER(domain_idx)+variable_local_dofs_offsets(domain_no)
11099  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)= &
11100  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
11101  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)= &
11102  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_TYPE(domain_idx)
11103  ENDDO !domain_idx
11104  ENDIF
11105  ENDDO !component_idx
11106  ENDDO !ny (global)
11107  !Loop over the domain types. Here domain_type_idx=1 for the non-ghosted dofs and =2 for the ghosted dofs.
11108  DO domain_type_idx=1,domain_type_stop
11109  IF(domain_type_idx==1) THEN
11110  start_idx=1
11111  stop_idx=dofs_mapping%NUMBER_OF_LOCAL
11112  ELSE
11113  start_idx=dofs_mapping%NUMBER_OF_LOCAL+1
11114  stop_idx=dofs_mapping%TOTAL_NUMBER_OF_LOCAL
11115  ENDIF
11116  !Handle local dofs domain mapping
11117  node_ny=0
11118  DO ny=start_idx,stop_idx
11119  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
11120  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
11121  domain=>field_component%DOMAIN
11122  node_ny=node_ny+1
11123  variable_local_ny=node_ny+variable_local_dofs_offsets(my_computational_node_number)
11124  node_nyy=node_nyy+1
11125  version_idx=domain%TOPOLOGY%DOFS%DOF_INDEX(1,ny)
11126  derivative_idx=domain%TOPOLOGY%DOFS%DOF_INDEX(2,ny)
11127  node_idx=domain%TOPOLOGY%DOFS%DOF_INDEX(3,ny)
11128  !Setup dof to parameter map
11129  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(1,variable_local_ny)=field_node_dof_type
11130  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(2,variable_local_ny)=node_nyy
11131  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NODE_DOF2PARAM_MAP(1,node_nyy)=version_idx
11132  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NODE_DOF2PARAM_MAP(2,node_nyy)=derivative_idx
11133  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NODE_DOF2PARAM_MAP(3,node_nyy)=node_idx
11134  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NODE_DOF2PARAM_MAP(4,node_nyy)=component_idx
11135  !Setup reverse parameter to dof map
11136  field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%DERIVATIVES(derivative_idx)% &
11137  & versions(version_idx) = variable_local_ny
11138  ENDDO !component_idx
11139  ENDDO !ny
11140  !Adjust the offsets
11141  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
11142  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+ &
11143  & field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS* &
11144  & dofs_mapping%NUMBER_OF_DOMAIN_LOCAL
11145  IF(domain_type_idx==1) THEN
11146  variable_global_dofs_offset=variable_global_dofs_offset+field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS* &
11147  & dofs_mapping%NUMBER_OF_GLOBAL
11148  ENDIF
11149  ENDDO !domain_type_idx
11150  CASE(field_grid_point_based_interpolation)
11151  CALL flagerror("Not implemented.",err,error,*999)
11152  CASE(field_gauss_point_based_interpolation)
11153  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
11154  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
11155  domain=>field_component%DOMAIN
11156  domain_topology=>domain%TOPOLOGY
11158  ALLOCATE(field_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS(max_ngp,domain_topology% &
11159  & elements%TOTAL_NUMBER_OF_ELEMENTS),stat=err)
11160  IF(err/=0) CALL flagerror("Could not allocate field component parameter to dof gauss point map (gauss points).", &
11161  & err,error,*999)
11162  field_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%NUMBER_OF_GAUSS_POINT_PARAMETERS= &
11163  & max_ngp*domain_topology%ELEMENTS%TOTAL_NUMBER_OF_ELEMENTS
11164  ENDDO
11165  !Handle global dofs domain mapping
11166  element_ny=0
11167  number_of_global_dofs=field%VARIABLES(variable_idx)%COMPONENTS(1)%DOMAIN%MAPPINGS%ELEMENTS%NUMBER_OF_GLOBAL
11168  DO ny=1,number_of_global_dofs
11169  DO gauss_point_idx=1,max_ngp
11170  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
11171  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
11172  domain=>field_component%DOMAIN
11173  dofs_mapping=>domain%MAPPINGS%ELEMENTS
11174  !Handle variable mapping
11175  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
11176  element_ny=element_ny+1
11177  variable_global_ny=element_ny+variable_global_dofs_offset
11178  CALL domain_mappings_mapping_global_initialise(field_variable_dofs_mapping% &
11179  & global_to_local_map(variable_global_ny),err,error,*999)
11180  number_of_domains=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%NUMBER_OF_DOMAINS
11181  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
11182  & local_number(number_of_domains),stat=err)
11183  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local number.", &
11184  & err,error,*999)
11185  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)% &
11186  & domain_number(number_of_domains),stat=err)
11187  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map domain number.", &
11188  & err,error,*999)
11189  ALLOCATE(field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(number_of_domains), &
11190  & stat=err)
11191  IF(err/=0) CALL flagerror("Could not allocate field variable dofs global to local map local type.", &
11192  & err,error,*999)
11193  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%NUMBER_OF_DOMAINS=number_of_domains
11194  DO domain_idx=1,number_of_domains
11195  domain_no=dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
11196  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_NUMBER(domain_idx)= &
11197  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_NUMBER(domain_idx)+variable_local_dofs_offsets(domain_no)
11198  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%DOMAIN_NUMBER(domain_idx)= &
11199  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%DOMAIN_NUMBER(domain_idx)
11200  field_variable_dofs_mapping%GLOBAL_TO_LOCAL_MAP(variable_global_ny)%LOCAL_TYPE(domain_idx)= &
11201  & dofs_mapping%GLOBAL_TO_LOCAL_MAP(ny)%LOCAL_TYPE(domain_idx)
11202  ENDDO !domain_idx
11203  ENDIF
11204  ENDDO !component_idx
11205  ENDDO !gauss_point_idx
11206  ENDDO !ny (global)
11207  !Loop over the domain types. Here domain_type_idx=1 for the non-ghosted dofs and =2 for the ghosted dofs.
11208  DO domain_type_idx=1,domain_type_stop
11209  IF(domain_type_idx==1) THEN
11210  start_idx=1
11211  stop_idx=dofs_mapping%NUMBER_OF_LOCAL
11212  ELSE
11213  start_idx=dofs_mapping%NUMBER_OF_LOCAL+1
11214  stop_idx=dofs_mapping%TOTAL_NUMBER_OF_LOCAL
11215  ENDIF
11216  !Handle local dofs domain mapping
11217  element_ny=0
11218  DO ny=start_idx,stop_idx
11219  DO gauss_point_idx=1,max_ngp
11220  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
11221  field_component=>field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
11222  domain=>field_component%DOMAIN
11223  element_ny=element_ny+1
11224  variable_local_ny=element_ny+variable_local_dofs_offsets(my_computational_node_number)
11225  node_nyy=node_nyy+1
11226  !Setup dof to parameter map
11227  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(1,variable_local_ny)=field_gauss_point_dof_type
11228  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%DOF_TYPE(2,variable_local_ny)=node_nyy
11229  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%GAUSS_POINT_DOF2PARAM_MAP(1,node_nyy)=gauss_point_idx
11230  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%GAUSS_POINT_DOF2PARAM_MAP(2,node_nyy)=ny !element_idx
11231  field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%GAUSS_POINT_DOF2PARAM_MAP(3,node_nyy)=component_idx
11232  !Setup reverse parameter to dof map
11233  field_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS(gauss_point_idx,ny)= &
11234  & variable_local_ny
11235  ENDDO !component_idx
11236  ENDDO !gauss_point_idx
11237  ENDDO !ny
11238  !Adjust the offsets
11239  variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)= &
11240  & variable_local_dofs_offsets(0:decomposition%NUMBER_OF_DOMAINS-1)+ &
11241  & field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS* &
11242  & dofs_mapping%NUMBER_OF_DOMAIN_LOCAL*max_ngp
11243  IF(domain_type_idx==1) THEN
11244  variable_global_dofs_offset=variable_global_dofs_offset+field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS* &
11245  & dofs_mapping%NUMBER_OF_GLOBAL*max_ngp
11246  ENDIF
11247  ENDDO !domain_type_idx
11248  CASE(field_data_point_based_interpolation)
11249  CALL flagerror("Not implemented.",err,error,*999)
11250  CASE DEFAULT
11251  local_error="The interpolation type of "// &
11252  & trim(number_to_vstring(field%VARIABLES(variable_idx)%COMPONENTS(component_idx)%INTERPOLATION_TYPE, &
11253  & "*",err,error))//" is invalid for component number 1 of variable type "//trim(number_to_vstring( &
11254  & field%VARIABLES(variable_idx)%VARIABLE_TYPE,"*",err,error))//"."
11255  CALL flagerror(local_error,err,error,*999)
11256  END SELECT
11257  ELSE
11258  CALL flagerror("The field must have at least one component.",err,error,*999)
11259  ENDIF
11260  CASE DEFAULT
11261  local_error="The DOF order type of "//trim(number_to_vstring(field%VARIABLES(variable_idx)%DOF_ORDER_TYPE, &
11262  & "*",err,error))//" is invalid for variable type "//trim(number_to_vstring(field%VARIABLES(variable_idx)% &
11263  & variable_type,"*",err,error))//"."
11264  CALL flagerror(local_error,err,error,*999)
11265  END SELECT
11266  IF(ASSOCIATED(field_variable_dofs_mapping)) THEN
11267  CALL domain_mappings_local_from_global_calculate(field_variable_dofs_mapping,err,error,*999)
11268  ENDIF
11269  ENDDO !variable_idx
11270  IF(ALLOCATED(variable_local_dofs_offsets)) DEALLOCATE(variable_local_dofs_offsets)
11271  IF(ALLOCATED(variable_ghost_dofs_offsets)) DEALLOCATE(variable_ghost_dofs_offsets)
11272 
11273  IF(diagnostics1) THEN
11274  CALL write_string(diagnostic_output_type,"Field DOF mappings:",err,error,*999)
11275  CALL write_string_value(diagnostic_output_type," Field user number = ",field%USER_NUMBER,err,error,*999)
11276  CALL write_string_value(diagnostic_output_type," Number of variables = ",field%NUMBER_OF_VARIABLES,err,error,*999)
11277  DO variable_idx=1,field%NUMBER_OF_VARIABLES
11278  CALL write_string_value(diagnostic_output_type," Variable : ",variable_idx,err,error,*999)
11279  CALL write_string_value(diagnostic_output_type," Variable type = ",field%VARIABLES(variable_idx)%VARIABLE_TYPE, &
11280  & err,error,*999)
11281  CALL write_string_value(diagnostic_output_type," Number of local DOFs = ",field%VARIABLES(variable_idx)% &
11282  & number_of_dofs,err,error,*999)
11283  CALL write_string_value(diagnostic_output_type," Total number of local DOFs = ",field%VARIABLES(variable_idx)% &
11284  & total_number_of_dofs,err,error,*999)
11285  CALL write_string_value(diagnostic_output_type," Number of global DOFs = ",field%VARIABLES(variable_idx)% &
11286  & number_of_global_dofs,err,error,*999)
11287  CALL write_string(diagnostic_output_type," DOF to parameter map:",err,error,*999)
11288  DO variable_local_ny=1,field%VARIABLES(variable_idx)%TOTAL_NUMBER_OF_DOFS
11289  CALL write_string_value(diagnostic_output_type," DOF : ",variable_local_ny,err,error,*999)
11290  CALL write_string_vector(diagnostic_output_type,1,1,2,2,2,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP% &
11291  & dof_type(:,variable_local_ny),'(" DOF type :",2(X,I8))','(18X,2(X,I8))',err,error,*999)
11292  ENDDO !variable_local_ny
11293  CALL write_string_value(diagnostic_output_type," Number of constant DOFs = ",field%VARIABLES(variable_idx)% &
11294  & dof_to_param_map%NUMBER_OF_CONSTANT_DOFS,err,error,*999)
11295  IF(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_CONSTANT_DOFS>0) THEN
11296  CALL write_string(diagnostic_output_type," Constant DOFs:",err,error,*999)
11297  DO constant_nyy=1,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_CONSTANT_DOFS
11298  CALL write_string_value(diagnostic_output_type," Constant DOF : ",constant_nyy,err,error,*999)
11299  CALL write_string_fmt_value(diagnostic_output_type," DOF 2 Parameters : ", &
11300  & field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%CONSTANT_DOF2PARAM_MAP(constant_nyy),'(I8)',err,error,*999)
11301  ENDDO !constant_nyy
11302  ENDIF
11303  CALL write_string_value(diagnostic_output_type," Number of element DOFs = ",field%VARIABLES(variable_idx)% &
11304  & dof_to_param_map%NUMBER_OF_ELEMENT_DOFS,err,error,*999)
11305  IF(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_ELEMENT_DOFS>0) THEN
11306  CALL write_string(diagnostic_output_type," Element DOFs:",err,error,*999)
11307  DO element_nyy=1,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_ELEMENT_DOFS
11308  CALL write_string_value(diagnostic_output_type," Element DOF : ",element_nyy,err,error,*999)
11309  CALL write_string_vector(diagnostic_output_type,1,1,2,2,2,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP% &
11310  & element_dof2param_map(:,element_nyy),'(" DOF 2 Parameters :",2(X,I8))','(28X,2(X,I8))',err,error,*999)
11311  ENDDO !element_nyy
11312  ENDIF
11313  CALL write_string_value(diagnostic_output_type," Number of nodal DOFs = ",field%VARIABLES(variable_idx)% &
11314  & dof_to_param_map%NUMBER_OF_NODE_DOFS,err,error,*999)
11315  IF(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_NODE_DOFS>0) THEN
11316  CALL write_string(diagnostic_output_type," Nodal DOFs:",err,error,*999)
11317  DO node_nyy=1,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_NODE_DOFS
11318  CALL write_string_value(diagnostic_output_type," Node DOF : ",node_nyy,err,error,*999)
11319  CALL write_string_vector(diagnostic_output_type,1,1,4,4,4,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP% &
11320  & node_dof2param_map(:,node_nyy),'(" DOF 2 Parameters :",4(X,I8))','(28X,4(X,I8))',err,error,*999)
11321  ENDDO !node_nyy
11322  ENDIF
11323  CALL write_string_value(diagnostic_output_type," Number of grid point DOFs = ",field%VARIABLES(variable_idx)% &
11324  & dof_to_param_map%NUMBER_OF_GRID_POINT_DOFS,err,error,*999)
11325  IF(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_GRID_POINT_DOFS>0) THEN
11326  CALL write_string(diagnostic_output_type," Grid point DOFs:",err,error,*999)
11327  DO grid_point_nyy=1,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_GRID_POINT_DOFS
11328  CALL write_string_value(diagnostic_output_type," Grid point DOF : ",grid_point_nyy,err,error,*999)
11329  CALL write_string_vector(diagnostic_output_type,1,1,2,2,2,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP% &
11330  & grid_point_dof2param_map(:,grid_point_nyy),'(" DOF 2 Parameters :",2(X,I8))','(28X,2(X,I8))', &
11331  & err,error,*999)
11332  ENDDO !node_nyy
11333  ENDIF
11334  CALL write_string_value(diagnostic_output_type," Number of Gauss point DOFs = ",field%VARIABLES(variable_idx)% &
11335  & dof_to_param_map%NUMBER_OF_GAUSS_POINT_DOFS,err,error,*999)
11336  IF(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_GAUSS_POINT_DOFS>0) THEN
11337  CALL write_string(diagnostic_output_type," Gauss point DOFs:",err,error,*999)
11338  DO gauss_point_nyy=1,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_GAUSS_POINT_DOFS
11339  CALL write_string_value(diagnostic_output_type," Gauss point DOF : ",gauss_point_nyy,err,error,*999)
11340  CALL write_string_vector(diagnostic_output_type,1,1,3,3,3,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP% &
11341  & gauss_point_dof2param_map(:,gauss_point_nyy),'(" DOF 2 Parameters :",3(X,I8))','(28X,3(X,I8))', &
11342  & err,error,*999)
11343  ENDDO !node_nyy
11344  ENDIF
11345  CALL write_string_value(diagnostic_output_type," Number of data point DOFs = ",field%VARIABLES(variable_idx)% &
11346  & dof_to_param_map%NUMBER_OF_DATA_POINT_DOFS,err,error,*999)
11347  IF(field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_DATA_POINT_DOFS>0) THEN
11348  CALL write_string(diagnostic_output_type," data point DOFs:",err,error,*999)
11349  DO data_point_nyy=1,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP%NUMBER_OF_DATA_POINT_DOFS
11350  CALL write_string_value(diagnostic_output_type," data point DOF : ",data_point_nyy,err,error,*999)
11351  CALL write_string_vector(diagnostic_output_type,1,1,3,3,3,field%VARIABLES(variable_idx)%DOF_TO_PARAM_MAP% &
11352  & data_point_dof2param_map(:,data_point_nyy),'(" DOF 2 Parameters :",3(X,I8))','(28X,3(X,I8))', &
11353  & err,error,*999)
11354  ENDDO !node_nyy
11355  ENDIF
11356  CALL write_string(diagnostic_output_type," Parameter to DOF map:",err,error,*999)
11357  CALL write_string_value(diagnostic_output_type," Number of components = ",field%VARIABLES(variable_idx)% &
11358  & number_of_components,err,error,*999)
11359  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
11360  field_component => field%VARIABLES(variable_idx)%COMPONENTS(component_idx)
11361  CALL write_string_value(diagnostic_output_type," Component : ",component_idx,err,error,*999)
11362  CALL write_string_value(diagnostic_output_type," Number of constant parameters = ", &
11363  & field_component%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS,err,error,*999)
11364  IF(field_component%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
11365  CALL write_string_value(diagnostic_output_type," Constant DOF = ", &
11366  & field_component%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP,err,error,*999)
11367  ENDIF
11368  CALL write_string_value(diagnostic_output_type," Number of element parameters = ", &
11369  & field_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS,err,error,*999)
11370  IF(field_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS>0) THEN
11371  DO element_idx=1,field_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS
11372  CALL write_string_value(diagnostic_output_type," Element : ",element_idx,err,error,*999)
11373  CALL write_string_value(diagnostic_output_type," Element DOF = ", &
11374  & field_component%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS(element_idx), &
11375  & err,error,*999)
11376  ENDDO !element_idx
11377  ENDIF
11378  CALL write_string_value(diagnostic_output_type," Number of node parameters = ", &
11379  & field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS,err,error,*999)
11380  IF(field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS>0) THEN
11381  DO node_idx=1,field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS
11382  CALL write_string_value(diagnostic_output_type," Node : ",node_idx,err,error,*999)
11383  CALL write_string_value(diagnostic_output_type," Number of Derivatives = ", &
11384  & field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%NUMBER_OF_DERIVATIVES,err,error,*999)
11385  DO derivative_idx=1,field_component%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP%NODES(node_idx)%NUMBER_OF_DERIVATIVES
11386  CALL write_string_value(diagnostic_output_type," Derivative : ",derivative_idx,err,error,*999)
11387  CALL write_string_vector(diagnostic_output_type,1,1,field_component%PARAM_TO_DOF_MAP% &
11388  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(derivative_idx)%NUMBER_OF_VERSIONS,8,8,field_component% &
11389  & param_to_dof_map%NODE_PARAM2DOF_MAP%NODES(node_idx)%DERIVATIVES(derivative_idx)%VERSIONS(:), &
11390  & '(" Version DOFs :",8(X,I8))','(23X,8(X,I8))',err,error,*999)
11391  ENDDO !derivative_idx
11392  ENDDO !node_idx
11393  ENDIF
11394  CALL write_string_value(diagnostic_output_type," Number of grid point parameters = ", &
11395  & field_component%PARAM_TO_DOF_MAP%GRID_POINT_PARAM2DOF_MAP%NUMBER_OF_GRID_POINT_PARAMETERS,err,error,*999)
11396  IF(field_component%PARAM_TO_DOF_MAP%GRID_POINT_PARAM2DOF_MAP%NUMBER_OF_GRID_POINT_PARAMETERS>0) THEN
11397  ENDIF
11398  CALL write_string_value(diagnostic_output_type," Number of Gauss point parameters = ", &
11399  & field_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%NUMBER_OF_GAUSS_POINT_PARAMETERS,err,error,*999)
11400  IF(field_component%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%NUMBER_OF_GAUSS_POINT_PARAMETERS>0) THEN
11401  ENDIF
11402  CALL write_string_value(diagnostic_output_type," Number of data point parameters = ", &
11403  & field_component%PARAM_TO_DOF_MAP%DATA_POINT_PARAM2DOF_MAP%NUMBER_OF_DATA_POINT_PARAMETERS,err,error,*999)
11404  IF(field_component%PARAM_TO_DOF_MAP%DATA_POINT_PARAM2DOF_MAP%NUMBER_OF_DATA_POINT_PARAMETERS>0) THEN
11405  ENDIF
11406  ENDDO !component_idx
11407  ENDDO !variable_idx
11408  ENDIF
11409 
11410  ELSE
11411  CALL flagerror("Field is not associated.",err,error,*999)
11412  ENDIF
11413 
11414  exits("FIELD_MAPPINGS_CALCULATE")
11415  RETURN
11416 999 IF(ALLOCATED(variable_local_dofs_offsets)) DEALLOCATE(variable_local_dofs_offsets)
11417  IF(ALLOCATED(variable_ghost_dofs_offsets)) DEALLOCATE(variable_ghost_dofs_offsets)
11418  errorsexits("FIELD_MAPPINGS_CALCULATE",err,error)
11419  RETURN 1
11420  END SUBROUTINE field_mappings_calculate
11421 
11422  !
11423  !================================================================================================================================
11424  !
11425 
11427  SUBROUTINE field_dof_to_param_map_finalise(DOF_TO_PARAM_MAP,ERR,ERROR,*)
11428 
11429  !Argument variables
11430  TYPE(field_dof_to_param_map_type) :: dof_to_param_map
11431  INTEGER(INTG), INTENT(OUT) :: err
11432  TYPE(varying_string), INTENT(OUT) :: error
11433  !Local Variables
11434 
11435  enters("FIELD_DOF_TO_PARAM_MAP_FINALISE",err,error,*999)
11436 
11437  IF(ALLOCATED(dof_to_param_map%DOF_TYPE)) DEALLOCATE(dof_to_param_map%DOF_TYPE)
11438  IF(ALLOCATED(dof_to_param_map%CONSTANT_DOF2PARAM_MAP)) DEALLOCATE(dof_to_param_map%CONSTANT_DOF2PARAM_MAP)
11439  IF(ALLOCATED(dof_to_param_map%ELEMENT_DOF2PARAM_MAP)) DEALLOCATE(dof_to_param_map%ELEMENT_DOF2PARAM_MAP)
11440  IF(ALLOCATED(dof_to_param_map%NODE_DOF2PARAM_MAP)) DEALLOCATE(dof_to_param_map%NODE_DOF2PARAM_MAP)
11441  IF(ALLOCATED(dof_to_param_map%GRID_POINT_DOF2PARAM_MAP)) DEALLOCATE(dof_to_param_map%GRID_POINT_DOF2PARAM_MAP)
11442  IF(ALLOCATED(dof_to_param_map%GAUSS_POINT_DOF2PARAM_MAP)) DEALLOCATE(dof_to_param_map%GAUSS_POINT_DOF2PARAM_MAP)
11443  IF(ALLOCATED(dof_to_param_map%DATA_POINT_DOF2PARAM_MAP)) DEALLOCATE(dof_to_param_map%DATA_POINT_DOF2PARAM_MAP)
11444  dof_to_param_map%NUMBER_OF_DOFS=0
11445  dof_to_param_map%NUMBER_OF_CONSTANT_DOFS=0
11446  dof_to_param_map%NUMBER_OF_ELEMENT_DOFS=0
11447  dof_to_param_map%NUMBER_OF_NODE_DOFS=0
11448  dof_to_param_map%NUMBER_OF_GRID_POINT_DOFS=0
11449  dof_to_param_map%NUMBER_OF_GAUSS_POINT_DOFS=0
11450  dof_to_param_map%NUMBER_OF_DATA_POINT_DOFS=0
11451 
11452  exits("FIELD_DOF_TO_PARAM_MAP_FINALISE")
11453  RETURN
11454 999 errorsexits("FIELD_DOF_TO_PARAM_MAP_FINALISE",err,error)
11455  RETURN 1
11456  END SUBROUTINE field_dof_to_param_map_finalise
11457 
11458  !
11459  !================================================================================================================================
11460  !
11461 
11463  SUBROUTINE field_dof_to_param_map_initialise(DOF_TO_PARAM_MAP,ERR,ERROR,*)
11464 
11465  !Argument variables
11466  TYPE(field_dof_to_param_map_type) :: dof_to_param_map
11467  INTEGER(INTG), INTENT(OUT) :: err
11468  TYPE(varying_string), INTENT(OUT) :: error
11469  !Local Variables
11470 
11471  enters("FIELD_DOF_TO_PARAM_INITIALISE",err,error,*999)
11472 
11473  dof_to_param_map%NUMBER_OF_DOFS=0
11474  dof_to_param_map%NUMBER_OF_CONSTANT_DOFS=0
11475  dof_to_param_map%NUMBER_OF_ELEMENT_DOFS=0
11476  dof_to_param_map%NUMBER_OF_NODE_DOFS=0
11477  dof_to_param_map%NUMBER_OF_GRID_POINT_DOFS=0
11478  dof_to_param_map%NUMBER_OF_GAUSS_POINT_DOFS=0
11479  dof_to_param_map%NUMBER_OF_DATA_POINT_DOFS=0
11480 
11481  exits("FIELD_DOF_TO_PARAM_MAP_INITIALISE")
11482  RETURN
11483 999 errorsexits("FIELD_DOF_TO_PARAM_MAP_INITIALISE",err,error)
11484  RETURN 1
11485  END SUBROUTINE field_dof_to_param_map_initialise
11486 
11487  !
11488  !================================================================================================================================
11489  !
11490 
11492  SUBROUTINE field_geometric_field_get(FIELD,GEOMETRIC_FIELD,ERR,ERROR,*)
11493 
11494  !Argument variables
11495  TYPE(field_type), POINTER :: field
11496  TYPE(field_type), POINTER :: geometric_field
11497  INTEGER(INTG), INTENT(OUT) :: err
11498  TYPE(varying_string), INTENT(OUT) :: error
11499  !Local Variables
11500  TYPE(varying_string) :: local_error
11501 
11502  enters("FIELD_GEOMETRIC_FIELD_GET",err,error,*999)
11503 
11504  IF(ASSOCIATED(field)) THEN
11505  IF(field%FIELD_FINISHED) THEN
11506  IF(ASSOCIATED(geometric_field)) THEN
11507  CALL flagerror("Geometric field is already associated.",err,error,*999)
11508  ELSE
11509  geometric_field=>field%GEOMETRIC_FIELD
11510  ENDIF
11511  ELSE
11512  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
11513  & " has not been finished."
11514  CALL flagerror(local_error,err,error,*999)
11515  ENDIF
11516  ELSE
11517  CALL flagerror("Field is not associated.",err,error,*999)
11518  ENDIF
11519 
11520  exits("FIELD_GEOMETRIC_FIELD_GET")
11521  RETURN
11522 999 errorsexits("FIELD_GEOMETRIC_FIELD_GET",err,error)
11523  RETURN 1
11524  END SUBROUTINE field_geometric_field_get
11525 
11526  !
11527  !================================================================================================================================
11528  !
11529 
11531  SUBROUTINE field_geometric_field_set(FIELD,GEOMETRIC_FIELD,ERR,ERROR,*)
11532 
11533  !Argument variables
11534  TYPE(field_type), POINTER :: field
11535  TYPE(field_type), POINTER :: geometric_field
11536  INTEGER(INTG), INTENT(OUT) :: err
11537  TYPE(varying_string), INTENT(OUT) :: error
11538  !Local Variables
11539  TYPE(varying_string) :: local_error
11540 
11541  enters("FIELD_GEOMETRIC_FIELD_SET",err,error,*999)
11542 
11543  IF(ASSOCIATED(field)) THEN
11544  IF(field%FIELD_FINISHED) THEN
11545  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
11546  & " has been finished."
11547  CALL flagerror(local_error,err,error,*999)
11548  ELSE
11549  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
11550  IF(field%CREATE_VALUES_CACHE%GEOMETRIC_FIELD_LOCKED) THEN
11551  local_error="The geometric field has been locked for field number "// &
11552  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
11553  CALL flagerror(local_error,err,error,*999)
11554  ELSE
11555  IF(ASSOCIATED(field%GEOMETRIC_FIELD)) THEN
11556  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
11557  & " already has a geometric field associated."
11558  CALL flagerror(local_error,err,error,*999)
11559  ELSE
11560  IF(ASSOCIATED(field%DECOMPOSITION)) THEN
11561  IF(ASSOCIATED(geometric_field)) THEN
11562  IF(geometric_field%TYPE==field_geometric_type) THEN
11563  IF(geometric_field%FIELD_FINISHED) THEN
11564  IF(field%DECOMPOSITION%MESH%USER_NUMBER==geometric_field%DECOMPOSITION%MESH%USER_NUMBER) THEN
11565  SELECT CASE(field%TYPE)
11566  CASE(field_fibre_type,field_general_type,field_material_type,field_geometric_general_type)
11567  field%GEOMETRIC_FIELD=>geometric_field
11568  CASE(field_geometric_type)
11569  CALL flagerror("Can not set the geometric field for a geometric field.",err,error,*999)
11570  CASE DEFAULT
11571  local_error="The field type "//trim(number_to_vstring(field%TYPE,"*",err,error))//" is invalid."
11572  CALL flagerror(local_error,err,error,*999)
11573  END SELECT
11574  ELSE
11575  local_error="The specified field is decomposed on mesh user number "// &
11576  & trim(number_to_vstring(field%DECOMPOSITION%MESH%USER_NUMBER,"*",err,error))// &
11577  & " and the geometric field is decomposed on mesh user number "// &
11578  & trim(number_to_vstring(geometric_field%DECOMPOSITION%MESH%USER_NUMBER,"*",err,error))// &
11579  & ". The two fields must use the same mesh."
11580  CALL flagerror(local_error,err,error,*999)
11581  ENDIF
11582  ELSE
11583  CALL flagerror("The specified geometric field has not been finished.",err,error,*999)
11584  ENDIF
11585  ELSE
11586  CALL flagerror("The specified geometric field is not a geometric field.",err,error,*999)
11587  ENDIF
11588  ELSE
11589  CALL flagerror("Geometric field is not associated.",err,error,*999)
11590  ENDIF
11591  ELSE
11592  CALL flagerror("The field does not have a decomposition associated.",err,error,*999)
11593  ENDIF
11594  ENDIF
11595  ENDIF
11596  ELSE
11597  local_error="Field create values cache is not associated for field number "// &
11598  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
11599  CALL flagerror(local_error,err,error,*999)
11600  ENDIF
11601  ENDIF
11602  ELSE
11603  CALL flagerror("Field is not associated.",err,error,*999)
11604  ENDIF
11605 
11606  exits("FIELD_GEOMETRIC_FIELD_SET")
11607  RETURN
11608 999 errorsexits("FIELD_GEOMETRIC_FIELD_SET",err,error)
11609  RETURN 1
11610  END SUBROUTINE field_geometric_field_set
11611 
11612  !
11613  !================================================================================================================================
11614  !
11615 
11617  SUBROUTINE field_geometric_field_set_and_lock(FIELD,GEOMETRIC_FIELD,ERR,ERROR,*)
11618 
11619  !Argument variables
11620  TYPE(field_type), POINTER :: field
11621  TYPE(field_type), POINTER :: geometric_field
11622  INTEGER(INTG), INTENT(OUT) :: err
11623  TYPE(varying_string), INTENT(OUT) :: error
11624  !Local Variables
11625  TYPE(varying_string) :: local_error
11626 
11627  enters("FIELD_GEOMETRIC_FIELD_SET_AND_LOCK",err,error,*999)
11628 
11629  CALL field_geometric_field_set(field,geometric_field,err,error,*999)
11630  IF(ASSOCIATED(field)) THEN
11631  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
11632  field%CREATE_VALUES_CACHE%GEOMETRIC_FIELD_LOCKED=.true.
11633  ELSE
11634  local_error="Field create values cache is not associated for field number "// &
11635  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
11636  CALL flagerror(local_error,err,error,*999)
11637  ENDIF
11638  ELSE
11639  CALL flagerror("Field is not associated.",err,error,*999)
11640  ENDIF
11641 
11642  exits("FIELD_GEOMETRIC_FIELD_SET_AND_LOCK")
11643  RETURN
11644 999 errorsexits("FIELD_GEOMETRIC_FIELD_SET_AND_LOCK",err,error)
11645  RETURN 1
11646  END SUBROUTINE field_geometric_field_set_and_lock
11647 
11648  !
11649  !================================================================================================================================
11650  !
11651 
11653  SUBROUTINE field_geometric_parameters_calculate(FIELD,ERR,ERROR,*)
11654 
11655  !Argument variables
11656  TYPE(field_type), POINTER :: field
11657  INTEGER(INTG), INTENT(OUT) :: err
11658  TYPE(varying_string), INTENT(OUT) :: error
11659  !Local Variables
11660  TYPE(varying_string) :: local_error
11661 
11662  enters("FIELD_GEOMETRIC_PARAMETERS_CALCULATE",err,error,*999)
11663 
11664  IF(ASSOCIATED(field)) THEN
11665  IF(field%FIELD_FINISHED) THEN
11666  IF(field%TYPE==field_geometric_type) THEN
11667  IF(field%DECOMPOSITION%CALCULATE_LINES) THEN
11668  CALL field_geometricparameterslinelengthscalculate(field,err,error,*999)
11669  ENDIF
11670 ! IF(FIELD%DECOMPOSITION%CALCULATE_FACES) THEN !temporarily commented out
11671 ! CALL Field_GeometricParametersFaceAreasCalculate(FIELD,ERR,ERROR,*999)
11672 ! ENDIF
11673  CALL field_geometricparameterselementvolumescalculate(field,err,error,*999)
11674  ELSE
11675  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is not a geometric field."
11676  CALL flagerror(local_error,err,error,*999)
11677  ENDIF
11678  ELSE
11679  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
11680  CALL flagerror(local_error,err,error,*999)
11681  ENDIF
11682  ELSE
11683  CALL flagerror("Field is not associated.",err,error,*999)
11684  ENDIF
11685 
11686  exits("FIELD_GEOMETRIC_PARAMETERS_CALCULATE")
11687  RETURN
11688 999 errorsexits("FIELD_GEOMETRIC_PARAMETERS_CALCULATE",err,error)
11689  RETURN 1
11690  END SUBROUTINE field_geometric_parameters_calculate
11691 
11692  !
11693  !================================================================================================================================
11694  !
11695 
11697  SUBROUTINE field_geometric_parameters_finalise(GEOMETRIC_PARAMETERS,ERR,ERROR,*)
11698 
11699  !Argument variables
11700  TYPE(field_geometric_parameters_type), POINTER :: geometric_parameters
11701  INTEGER(INTG), INTENT(OUT) :: err
11702  TYPE(varying_string), INTENT(OUT) :: error
11703  !Local Variables
11704  INTEGER(INTG) :: field_idx
11705  TYPE(field_type), POINTER :: field2
11706 
11707  enters("FIELD_GEOMETRIC_PARAMETERS_FINALISE",err,error,*999)
11708 
11709  IF(ASSOCIATED(geometric_parameters)) THEN
11710  !Nullify the geometric field pointer of those fields using this geometric field.
11711  DO field_idx=1,geometric_parameters%NUMBER_OF_FIELDS_USING
11712  field2=>geometric_parameters%FIELDS_USING(field_idx)%PTR
11713  IF(ASSOCIATED(field2)) NULLIFY(field2%GEOMETRIC_FIELD)
11714  ENDDO !field_idx
11715  IF(ASSOCIATED(geometric_parameters%FIELDS_USING)) DEALLOCATE(geometric_parameters%FIELDS_USING)
11716  IF(ALLOCATED(geometric_parameters%LENGTHS)) DEALLOCATE(geometric_parameters%LENGTHS)
11717 ! IF(ALLOCATED(GEOMETRIC_PARAMETERS%AREAS)) DEALLOCATE(GEOMETRIC_PARAMETERS%AREAS) !temporarily commented out
11718  IF(ALLOCATED(geometric_parameters%VOLUMES)) DEALLOCATE(geometric_parameters%VOLUMES)
11719  DEALLOCATE(geometric_parameters)
11720  ENDIF
11721 
11722  exits("FIELD_GEOMETRIC_PARAMETERS_FINALISE")
11723  RETURN
11724 999 errorsexits("FIELD_GEOMETRIC_PARAMETERS_FINALISE",err,error)
11725  RETURN 1
11726  END SUBROUTINE field_geometric_parameters_finalise
11727 
11728  !
11729  !================================================================================================================================
11730  !
11731 
11733  SUBROUTINE field_geometric_parameters_initialise(FIELD,ERR,ERROR,*)
11734 
11735  !Argument variables
11736  TYPE(field_type), POINTER :: field
11737  INTEGER(INTG), INTENT(OUT) :: err
11738  TYPE(varying_string), INTENT(OUT) :: error
11739  !Local Variables
11740  INTEGER(INTG) :: field_idx
11741  TYPE(field_ptr_type), POINTER :: new_fields_using(:)
11742 
11743  NULLIFY(new_fields_using)
11744 
11745  enters("FIELD_GEOMETRIC_PARAMETERS_INITIALISE",err,error,*999)
11746 
11747  IF(ASSOCIATED(field)) THEN
11748  IF(field%TYPE==field_geometric_type) THEN
11749  !Field is a geometric field
11750  ALLOCATE(field%GEOMETRIC_FIELD_PARAMETERS,stat=err)
11751  IF(err/=0) CALL flagerror("Could not allocate geometric field parameters.",err,error,*999)
11752  IF(field%DECOMPOSITION%CALCULATE_LINES) THEN
11753  field%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_LINES=field%DECOMPOSITION%TOPOLOGY%LINES%NUMBER_OF_LINES
11754  ALLOCATE(field%GEOMETRIC_FIELD_PARAMETERS%LENGTHS(field%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_LINES),stat=err)
11755  IF(err/=0) CALL flagerror("Could not allocate lengths.",err,error,*999)
11756  field%GEOMETRIC_FIELD_PARAMETERS%LENGTHS=0.0_dp
11757  ENDIF
11758 ! IF(FIELD%DECOMPOSITION%CALCULATE_FACES) THEN !temporarily commented out
11759 ! FIELD%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_AREAS=FIELD%DECOMPOSITION%TOPOLOGY%FACES%NUMBER_OF_FACES
11760 ! ALLOCATE(FIELD%GEOMETRIC_FIELD_PARAMETERS%AREAS(FIELD%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_AREAS),STAT=ERR)
11761 ! IF(ERR/=0) CALL FlagError("Could not allocate areas.",ERR,ERROR,*999)
11762 ! FIELD%GEOMETRIC_FIELD_PARAMETERS%AREAS=0.0_DP
11763 ! ENDIF
11764  field%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_VOLUMES=field%DECOMPOSITION%TOPOLOGY%ELEMENTS%NUMBER_OF_ELEMENTS
11765  ALLOCATE(field%GEOMETRIC_FIELD_PARAMETERS%VOLUMES(field%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_VOLUMES),stat=err)
11766  IF(err/=0) CALL flag_error("Could not allocate volumes.",err,error,*999)
11767  field%GEOMETRIC_FIELD_PARAMETERS%VOLUMES=0.0_dp
11768 
11769 
11770  !The field is a geometric field so it must use itself initiallly
11771  ALLOCATE(field%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING(1),stat=err)
11772  IF(err/=0) CALL flagerror("Could not allocate fields using.",err,error,*999)
11773  field%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING(1)%PTR=>field
11774  field%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_FIELDS_USING=1
11775  ELSE
11776  !Field is not a geometric field
11777  NULLIFY(field%GEOMETRIC_FIELD_PARAMETERS)
11778  IF(ASSOCIATED(field%GEOMETRIC_FIELD)) THEN
11779  !Set the geometric field so that it knows that this field is using it
11780  ALLOCATE(new_fields_using(field%GEOMETRIC_FIELD%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_FIELDS_USING+1),stat=err)
11781  IF(err/=0) CALL flagerror("Could not allocate new fields using.",err,error,*999)
11782  DO field_idx=1,field%GEOMETRIC_FIELD%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_FIELDS_USING
11783  new_fields_using(field_idx)%PTR=>field%GEOMETRIC_FIELD%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING(field_idx)%PTR
11784  ENDDO !field_idx
11785  new_fields_using(field%GEOMETRIC_FIELD%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_FIELDS_USING+1)%PTR=>field
11786  field%GEOMETRIC_FIELD%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_FIELDS_USING=field%GEOMETRIC_FIELD% &
11787  & geometric_field_parameters%NUMBER_OF_FIELDS_USING+1
11788  IF(ASSOCIATED(field%GEOMETRIC_FIELD%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING)) &
11789  & DEALLOCATE(field%GEOMETRIC_FIELD%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING)
11790  field%GEOMETRIC_FIELD%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING=>new_fields_using
11791  ELSE
11792  CALL flagerror("Field does not have a geometric field associated.",err,error,*999)
11793  ENDIF
11794  ENDIF
11795  ELSE
11796  CALL flagerror("Field is not associated.",err,error,*999)
11797  ENDIF
11798 
11799  exits("FIELD_GEOMETRIC_PARAMETERS_INITIALISE")
11800  RETURN
11801 999 IF(ASSOCIATED(new_fields_using)) DEALLOCATE(new_fields_using)
11802  errorsexits("FIELD_GEOMETRIC_PARAMETERS_INITIALISE",err,error)
11803  RETURN 1
11804  END SUBROUTINE field_geometric_parameters_initialise
11805 
11806  !
11807  !================================================================================================================================
11808  !
11809 
11811  SUBROUTINE field_geometricparameterselementlinelengthget(field,elementNumber,elementLineNumber,lineLength,err,error,*)
11812 
11813  !Argument variables
11814  TYPE(field_type), POINTER :: field
11815  INTEGER(INTG), INTENT(IN) :: elementnumber
11816  INTEGER(INTG), INTENT(IN) :: elementlinenumber
11817  REAL(DP), INTENT(OUT) :: linelength
11818  INTEGER(INTG), INTENT(OUT) :: err
11819  TYPE(varying_string), INTENT(OUT) :: error
11820  !Local variables
11821  TYPE(decomposition_element_type), POINTER :: decompositionelement
11822  TYPE(domain_element_type), POINTER :: domainelement
11823  TYPE(varying_string) :: localerror
11824  INTEGER(INTG) :: globallinenumber
11825 
11826  enters("Field_GeometricParametersElementLineLengthGet",err,error,*999)
11827 
11828  IF(ASSOCIATED(field)) THEN
11829  IF(field%FIELD_FINISHED) THEN
11830  IF(field%TYPE==field_geometric_type) THEN
11831  IF(ASSOCIATED(field%GEOMETRIC_FIELD_PARAMETERS)) THEN
11832  !\todo user to global element maps not in OpenCMISS?
11833  IF(elementnumber>=1.AND.elementnumber<=field%DECOMPOSITION%TOPOLOGY%ELEMENTS%NUMBER_OF_ELEMENTS) THEN
11834  domainelement=>field%DECOMPOSITION%DOMAIN(field%DECOMPOSITION%MESH_COMPONENT_NUMBER)%PTR% &
11835  & topology%ELEMENTS%ELEMENTS(elementnumber)
11836  decompositionelement=>field%DECOMPOSITION%TOPOLOGY%ELEMENTS%ELEMENTS(elementnumber)
11837  IF(elementlinenumber>=1.AND.elementlinenumber<=domainelement%BASIS%NUMBER_OF_LOCAL_LINES) THEN
11838  globallinenumber=decompositionelement%ELEMENT_LINES(elementlinenumber)
11839  linelength=field%GEOMETRIC_FIELD_PARAMETERS%LENGTHS(globallinenumber)
11840  ELSE
11841  localerror="Element basis line number "//trim(number_to_vstring(elementnumber,"*",err,error))// &
11842  & " is not valid and needs to be >=1 and <="//trim(number_to_vstring( &
11843  & domainelement%BASIS%NUMBER_OF_LOCAL_LINES,"*",err,error))
11844  CALL flagerror(localerror,err,error,*999)
11845  ENDIF
11846  ELSE
11847  localerror="Element number "//trim(number_to_vstring(elementnumber,"*",err,error))// &
11848  & " is not present in this fields decomposition"
11849  CALL flagerror(localerror,err,error,*999)
11850  ENDIF
11851  ELSE
11852  localerror="Geometric parameters are not associated for field number "// &
11853  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
11854  CALL flagerror(localerror,err,error,*999)
11855  ENDIF
11856  ELSE
11857  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is not a geometric field."
11858  CALL flagerror(localerror,err,error,*999)
11859  ENDIF
11860  ELSE
11861  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
11862  CALL flagerror(localerror,err,error,*999)
11863  ENDIF
11864  ELSE
11865  CALL flagerror("Field is not associated.",err,error,*999)
11866  ENDIF
11867 
11868  exits("Field_GeometricParametersElementLineLengthGet")
11869  RETURN
11870 999 errors("Field_GeometricParametersElementLineLengthGet",err,error)
11871  exits("Field_GeometricParametersElementLineLengthGet")
11872  RETURN 1
11873 
11874  END SUBROUTINE field_geometricparameterselementlinelengthget
11875 
11876  !
11877  !================================================================================================================================
11878  !
11879 
11880 
11882  SUBROUTINE field_geometricparameterselementvolumeget(field,elementNumber,elementVolume,err,error,*)
11883 
11884  !Argument variables
11885  TYPE(field_type), POINTER :: field
11886  INTEGER(INTG), INTENT(IN) :: elementnumber
11887  REAL(DP), INTENT(OUT) :: elementvolume
11888  INTEGER(INTG), INTENT(OUT) :: err
11889  TYPE(varying_string), INTENT(OUT) :: error
11890  !Local variables
11891  TYPE(decomposition_element_type), POINTER :: decompositionelement
11892  TYPE(domain_element_type), POINTER :: domainelement
11893  TYPE(varying_string) :: localerror
11894  INTEGER(INTG) :: globallinenumber
11895  TYPE(coordinate_system_type), POINTER :: coordinatesystem
11896  enters("Field_GeometricParametersElementVolumeGet",err,error,*999)
11897 
11898  IF(ASSOCIATED(field)) THEN
11899  IF(field%FIELD_FINISHED) THEN
11900  IF(field%TYPE==field_geometric_type) THEN
11901  IF(ASSOCIATED(field%GEOMETRIC_FIELD_PARAMETERS)) THEN
11902  !\todo user to global element maps not in OpenCMISS?
11903 
11904  IF(elementnumber>=1.AND.elementnumber<=field%DECOMPOSITION%TOPOLOGY%ELEMENTS%NUMBER_OF_ELEMENTS) THEN
11905  domainelement=>field%DECOMPOSITION%DOMAIN(field%DECOMPOSITION%MESH_COMPONENT_NUMBER)%PTR% &
11906  & topology%ELEMENTS%ELEMENTS(elementnumber)
11907  decompositionelement=>field%DECOMPOSITION%TOPOLOGY%ELEMENTS%ELEMENTS(elementnumber)
11908  NULLIFY(coordinatesystem)
11909  CALL field_coordinatesystemget(field,coordinatesystem,err,error,*999)
11910  IF(coordinatesystem%NUMBER_OF_DIMENSIONS.EQ.3) THEN
11911  elementvolume = field%GEOMETRIC_FIELD_PARAMETERS%VOLUMES(elementnumber)
11912  ELSE
11913  localerror = "Volumes can only be calculated for 3D elements."
11914  CALL flagerror(localerror,err,error,*999)
11915  ENDIF
11916 
11917  ELSE
11918  localerror="Element number "//trim(number_to_vstring(elementnumber,"*",err,error))// &
11919  & " is not present in this fields decomposition"
11920  CALL flagerror(localerror,err,error,*999)
11921  ENDIF
11922  ELSE
11923  localerror="Geometric parameters are not associated for field number "// &
11924  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
11925  CALL flagerror(localerror,err,error,*999)
11926  ENDIF
11927  ELSE
11928  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is not a geometric field."
11929  CALL flagerror(localerror,err,error,*999)
11930  ENDIF
11931  ELSE
11932  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
11933  CALL flagerror(localerror,err,error,*999)
11934  ENDIF
11935  ELSE
11936  CALL flagerror("Field is not associated.",err,error,*999)
11937  ENDIF
11938 
11939  exits("Field_GeometricParametersElementVolumeGet")
11940  RETURN
11941 999 errors("Field_GeometricParametersElementVolumeGet",err,error)
11942  exits("Field_GeometricParametersElementVolumeGet")
11943  RETURN 1
11944 
11945  END SUBROUTINE field_geometricparameterselementvolumeget
11946 
11947  !
11948  !================================================================================================================================
11949  !
11950 
11952  SUBROUTINE field_geometricparameterselementvolumescalculate(field,err,error,*)
11953 
11954  !Argument variables
11955  TYPE(field_type), POINTER :: field
11956  INTEGER(INTG), INTENT(OUT) :: err
11957  TYPE(varying_string), INTENT(OUT) :: error
11958  !Local Variables
11959  INTEGER(INTG) :: dummyerr,ng,ne,max_gauss
11960  INTEGER(INTG) :: numbergausspoints
11961  REAL(DP) :: w,elementvolume
11962  REAL(DP), ALLOCATABLE :: xig(:,:),wig(:),xi(:)
11963  TYPE(field_variable_type), POINTER :: fieldvariable
11964  TYPE(domain_type), POINTER :: domain
11965  TYPE(domain_topology_type), POINTER :: topology
11966  TYPE(decomposition_topology_type), POINTER :: decomptopology
11967  TYPE(decomposition_type), POINTER :: decomposition
11968  TYPE(decomposition_elements_type), POINTER :: decompelements
11969  TYPE(basis_type), POINTER:: basis
11970  TYPE(coordinate_system_type), POINTER :: coordinatesystem
11971  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolatedpoint(:)
11972  TYPE(field_interpolated_point_metrics_ptr_type), POINTER :: interpolatedpointmetrics(:)
11973  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolationparameters(:)
11974  TYPE(varying_string) :: dummyerror,localerror
11975 
11976 
11977  NULLIFY(interpolatedpoint)
11978  NULLIFY(interpolatedpointmetrics)
11979  NULLIFY(interpolationparameters)
11980  NULLIFY(fieldvariable)
11981 
11982  enters("Field_GeometricParametersElementVolumesCalculate",err,error,*999)
11983  IF(ASSOCIATED(field)) THEN
11984  IF(field%FIELD_FINISHED) THEN
11985  IF(field%TYPE==field_geometric_type) THEN
11986  IF(ASSOCIATED(field%GEOMETRIC_FIELD_PARAMETERS)) THEN
11987  NULLIFY(coordinatesystem)
11988  CALL field_coordinatesystemget(field,coordinatesystem,err,error,*999)
11989  IF(coordinatesystem%NUMBER_OF_DIMENSIONS.EQ.3) THEN !only calculate volumes if the object is in 3D
11990  CALL field_interpolationparametersinitialise(field,interpolationparameters,err,error,*999)
11991  CALL field_interpolatedpointsinitialise(interpolationparameters,interpolatedpoint,err,error,*999)
11992  CALL field_interpolatedpointsmetricsinitialise(interpolatedpoint,interpolatedpointmetrics,err,error,*999)
11993  !Get basis type for the first component of the mesh defined with this geometric field
11994  CALL field_variableget(field,field_u_variable_type,fieldvariable,err,error,*999)
11995  IF(ASSOCIATED(fieldvariable)) THEN
11996  domain=>fieldvariable%COMPONENTS(1)%DOMAIN
11997  IF(ASSOCIATED(domain))THEN
11998  topology=>domain%TOPOLOGY
11999  IF(ASSOCIATED(topology)) THEN
12000  decomposition=>field%DECOMPOSITION
12001  IF(ASSOCIATED(decomposition)) THEN
12002  decomptopology=>decomposition%TOPOLOGY
12003  IF(ASSOCIATED(decomptopology)) THEN
12004  decompelements=>decomptopology%ELEMENTS
12005  IF(ASSOCIATED(decompelements)) THEN
12006  basis=>topology%ELEMENTS%ELEMENTS(1)%BASIS
12007  SELECT CASE(basis%TYPE)
12008  CASE(basis_lagrange_hermite_tp_type)
12009  max_gauss=4*4*4
12010  ALLOCATE(xi(3),stat=err)
12011  IF(err/=0) CALL flag_error("Could not allocate XI matrix",err,error,*999)
12012  ALLOCATE(xig(3,max_gauss),stat=err)
12013  IF(err/=0) CALL flag_error("Could not allocate XIG matrix",err,error,*999)
12014  ALLOCATE(wig(max_gauss),stat=err)
12015  IF(err/=0) CALL flag_error("Could not allocate W matrix",err,error,*999)
12016  CALL basis_gauss_points_calculate(basis,4,3,numbergausspoints,xig,wig,err,error,*999)
12017  CASE(basis_simplex_type)
12018 
12019  max_gauss=4*4*4
12020  ALLOCATE(xi(4),stat=err)
12021  IF(err/=0) CALL flag_error("Could not allocate XI matrix",err,error,*999)
12022  ALLOCATE(xig(4,max_gauss),stat=err)
12023  IF(err/=0) CALL flag_error("Could not allocate XIG matrix",err,error,*999)
12024  ALLOCATE(wig(max_gauss),stat=err)
12025  IF(err/=0) CALL flag_error("Could not allocate W matrix",err,error,*999)
12026  CALL basis_gauss_points_calculate(basis,4,3,numbergausspoints,xig,wig,err,error,*999)
12027  CASE DEFAULT
12028  localerror="Basis type "//trim(number_to_vstring(basis%TYPE,"*",err,error))//" &
12029  & is invalid or not implemented"
12030  CALL flag_error(localerror,err,error,*999)
12031  END SELECT
12032  ELSE
12033  CALL flag_error("Elements are not associated with the decomposition",err,error,*999)
12034  ENDIF
12035  ELSE
12036  CALL flag_error("Decomposition topology is not associated",err,error,*999)
12037  ENDIF
12038  ELSE
12039  CALL flag_error("Decomposition is not associated",err,error,*999)
12040  ENDIF
12041  ELSE
12042  CALL flag_error("Domain topology is not associated",err,error,*999)
12043  ENDIF
12044  ELSE
12045  CALL flag_error("Domain is not associated with the geometric field component 1",err,error,*999)
12046  ENDIF
12047  ELSE
12048  CALL flag_error("Field variable is not associated",err,error,*999)
12049  ENDIF
12050 
12051  SELECT CASE(basis%TYPE)
12052  CASE(basis_lagrange_hermite_tp_type)
12053  !Loop over the elements
12054  DO ne=1,field%DECOMPOSITION%TOPOLOGY%ELEMENTS%NUMBER_OF_ELEMENTS
12055  CALL field_interpolation_parameters_element_get(field_values_set_type,ne, &
12056  & interpolationparameters(field_u_variable_type)%PTR,err,error,*999)
12057  elementvolume=0.0_dp
12058  DO ng=1,numbergausspoints
12059  xi(1:3)=xig(1:3,ng)
12060  w=wig(ng)
12061  CALL field_interpolate_xi(first_part_deriv,xi,interpolatedpoint(field_u_variable_type)%PTR,err,error,*999)
12062  CALL field_interpolated_point_metrics_calculate(coordinate_jacobian_volume_type, &
12063  & interpolatedpointmetrics(field_u_variable_type)%PTR,err,error,*999)
12064  elementvolume=elementvolume+w*interpolatedpointmetrics(field_u_variable_type)%PTR%JACOBIAN
12065  ENDDO !ng
12066  field%GEOMETRIC_FIELD_PARAMETERS%VOLUMES(ne)=elementvolume
12067  ENDDO !ne
12068  CASE(basis_simplex_type)
12069  !Loop over the elements
12070  DO ne=1,field%DECOMPOSITION%TOPOLOGY%ELEMENTS%NUMBER_OF_ELEMENTS
12071  CALL field_interpolation_parameters_element_get(field_values_set_type,ne, &
12072  & interpolationparameters(field_u_variable_type)%PTR,err,error,*999)
12073  elementvolume=0.0_dp
12074  DO ng=1,numbergausspoints
12075  xi(1:4)=xig(1:4,ng)
12076  w=wig(ng)
12077  CALL field_interpolate_xi(first_part_deriv,xi,interpolatedpoint(field_u_variable_type)%PTR,err,error,*999)
12078  CALL field_interpolated_point_metrics_calculate(coordinate_jacobian_volume_type, &
12079  & interpolatedpointmetrics(field_u_variable_type)%PTR,err,error,*999)
12080  elementvolume=elementvolume+w*interpolatedpointmetrics(field_u_variable_type)%PTR%JACOBIAN
12081  ENDDO !ng
12082  elementvolume = elementvolume
12083  field%GEOMETRIC_FIELD_PARAMETERS%VOLUMES(ne)=elementvolume
12084  ENDDO !ne
12085  CASE DEFAULT
12086  localerror="Basis type "//trim(number_to_vstring(basis%TYPE,"*",err,error))//" &
12087  & is invalid or not implemented"
12088  CALL flag_error(localerror,err,error,*999)
12089  END SELECT
12090 
12091  CALL field_interpolated_point_metrics_finalise(interpolatedpointmetrics(field_u_variable_type)%PTR,err,error,*999)
12092  CALL field_interpolated_points_finalise(interpolatedpoint,err,error,*999)
12093  CALL field_interpolation_parameters_finalise(interpolationparameters,err,error,*999)
12094  ENDIF
12095  ELSE
12096  localerror="Geometric parameters are not associated for field number "// &
12097  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12098  CALL flag_error(localerror,err,error,*999)
12099  ENDIF
12100  ELSE
12101  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is not a geometric field."
12102  CALL flag_error(localerror,err,error,*999)
12103  ENDIF
12104  ELSE
12105  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
12106  CALL flag_error(localerror,err,error,*999)
12107  ENDIF
12108  ELSE
12109  CALL flag_error("Field is not associated.",err,error,*999)
12110  ENDIF
12111 
12112  IF(diagnostics1) THEN
12113  CALL write_string(diagnostic_output_type,"Element volumes:",err,error,*999)
12114  CALL write_string_value(diagnostic_output_type," Number of elements = ", &
12115  & field%DECOMPOSITION%TOPOLOGY%ELEMENTS%NUMBER_OF_ELEMENTS, &
12116  & err,error,*999)
12117  DO ne=1,field%DECOMPOSITION%TOPOLOGY%ELEMENTS%NUMBER_OF_ELEMENTS
12118  CALL write_string_fmt_two_value(diagnostic_output_type," Element ",ne,"(I8)"," volume = ",field% &
12119  & geometric_field_parameters%VOLUMES(ne),"*",err,error,*999)
12120  ENDDO !nf
12121  ENDIF
12122 
12123 
12124  exits("Field_GeometricParametersElementVolumesCalculate")
12125  RETURN
12126 999 IF(ASSOCIATED(interpolatedpoint)) CALL field_interpolated_points_finalise(interpolatedpoint,dummyerr,dummyerror,*999)
12127  IF(ASSOCIATED(interpolationparameters)) CALL field_interpolation_parameters_finalise(interpolationparameters, &
12128  & dummyerr,dummyerror,*999)
12129  errors("Field_GeometricParametersElementVolumesCalculate",err,error)
12130  exits("Field_GeometricParametersElementVolumesCalculate")
12131  RETURN 1
12132  END SUBROUTINE field_geometricparameterselementvolumescalculate
12133 
12134 
12135 
12136  !
12137  !================================================================================================================================
12138  !
12139 
12141  SUBROUTINE field_geometricparameterslinelengthscalculate(FIELD,ERR,ERROR,*)
12142 
12143  !Argument variables
12144  TYPE(field_type), POINTER :: field
12145  INTEGER(INTG), INTENT(OUT) :: err
12146  TYPE(varying_string), INTENT(OUT) :: error
12147  !Local Variables
12148  INTEGER(INTG) :: dummy_err,iteration_number,maximum_difference_line,ng,nl
12149  INTEGER(INTG), PARAMETER :: lines_maximum_number_of_iterations=20
12150  INTEGER(INTG) :: gauss_start(4) = [ 0,1,3,6 ]
12151  INTEGER(INTG) :: number_of_gauss_points=4
12152  REAL(DP) :: last_maximum_length_difference,length_difference,maximum_length_difference,xi(1),w,deriv_norm,line_length, &
12153  & OLD_LINE_LENGTH
12154 ! Doxygen doesn't like this
12155 ! REAL(DP) :: XIG(10) = [ 0.500000000000000_DP, &
12156 ! & 0.211324865405187_DP,0.788675134594813_DP, &
12157 ! & 0.112701665379258_DP,0.500000000000000_DP,0.887298334620742_DP, &
12158 ! & 0.06943184420297349_DP,0.330009478207572_DP,0.669990521792428_DP,0.930568155797026_DP ]
12159 ! REAL(DP) :: WIG(10) = [ 1.000000000000000_DP, &
12160 ! & 0.500000000000000_DP,0.500000000000000_DP, &
12161 ! & 0.277777777777778_DP,0.444444444444444_DP,0.277777777777778_DP,
12162 ! & 0.173927422568727_DP,0.326072577431273_DP,0.326072577431273_DP,0.173927422568727_DP ]
12163  REAL(DP) :: xig(10),wig(10)
12164  REAL(DP), PARAMETER :: line_increment_tolerance=convergence_tolerance
12165  LOGICAL :: iterate,update_fields_using
12166  TYPE(coordinate_system_type), POINTER :: coordinate_system
12167  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolated_point(:)
12168  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolation_parameters(:)
12169  TYPE(varying_string) :: dummy_error,local_error
12170 
12171  xig = [ 0.500000000000000_dp, &
12172  & 0.211324865405187_dp,0.788675134594813_dp, &
12173  & 0.112701665379258_dp,0.500000000000000_dp,0.887298334620742_dp, &
12174  & 0.06943184420297349_dp,0.330009478207572_dp,0.669990521792428_dp,0.930568155797026_dp ]
12175  wig = [ 1.000000000000000_dp, &
12176  & 0.500000000000000_dp,0.500000000000000_dp, &
12177  & 0.277777777777778_dp,0.444444444444444_dp,0.277777777777778_dp, &
12178  & 0.173927422568727_dp,0.326072577431273_dp,0.326072577431273_dp,0.173927422568727_dp ]
12179 
12180  NULLIFY(interpolated_point)
12181  NULLIFY(interpolation_parameters)
12182 
12183  enters("Field_GeometricParametersLineLengthsCalculate",err,error,*997)
12184 
12185  IF(ASSOCIATED(field)) THEN
12186  IF(field%FIELD_FINISHED) THEN
12187  IF(field%TYPE==field_geometric_type) THEN
12188  IF(ASSOCIATED(field%GEOMETRIC_FIELD_PARAMETERS)) THEN
12189  NULLIFY(coordinate_system)
12190  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
12191  !Iterate to find the line lengths as the line lengths depend on the scaling factors and vise versa.
12192  CALL field_interpolation_parameters_initialise(field,interpolation_parameters,err,error,*999)
12193  CALL field_interpolated_points_initialise(interpolation_parameters,interpolated_point,err,error,*999)
12194  iterate=.true.
12195  iteration_number=0
12196  last_maximum_length_difference=0.0_dp
12197  DO WHILE(iterate.AND.iteration_number<=lines_maximum_number_of_iterations)
12198  maximum_length_difference=0.0_dp
12199  maximum_difference_line=1
12200  !Loop over the lines
12201  DO nl=1,field%DECOMPOSITION%TOPOLOGY%LINES%NUMBER_OF_LINES
12202  CALL field_interpolation_parameters_line_get(field_values_set_type,nl, &
12203  & interpolation_parameters(field_u_variable_type)%PTR,err,error,*999)
12204  old_line_length=field%GEOMETRIC_FIELD_PARAMETERS%LENGTHS(nl)
12205  line_length=0.0_dp
12206  !Integrate || dr(xi)/dt || from xi=0 to 1 to determine the arc length.
12207  DO ng=1,number_of_gauss_points
12208  xi(1)=xig(gauss_start(number_of_gauss_points)+ng)
12209  w=wig(gauss_start(number_of_gauss_points)+ng)
12210  CALL field_interpolate_xi(first_part_deriv,xi,interpolated_point(field_u_variable_type)%PTR,err,error,*999)
12211  CALL coordinate_derivative_norm(coordinate_system,part_deriv_s1, &
12212  & interpolated_point(field_u_variable_type)%PTR,deriv_norm,err,error,*999)
12213  line_length=line_length+w*deriv_norm
12214  ENDDO !ng
12215  field%GEOMETRIC_FIELD_PARAMETERS%LENGTHS(nl)=line_length
12216  length_difference=abs(line_length-old_line_length)/(1.0_dp+old_line_length)
12217  IF(length_difference>maximum_length_difference) THEN
12218  maximum_length_difference=length_difference
12219  maximum_difference_line=nl
12220  ENDIF
12221  ENDDO !nl
12222  iterate=maximum_length_difference>line_increment_tolerance
12223  IF(iterate) THEN
12224  IF(iteration_number==1) THEN
12225  last_maximum_length_difference=maximum_length_difference
12226  ELSE IF(maximum_length_difference<loose_tolerance.AND. &
12227  & maximum_length_difference>=last_maximum_length_difference) THEN
12228  !Seems to be at a numerical limit
12229  iterate=.false.
12230  ELSE
12231  last_maximum_length_difference=maximum_length_difference
12232  ENDIF
12233  ENDIF
12234  iteration_number=iteration_number+1
12235  IF(diagnostics2) THEN
12236  CALL write_string(diagnostic_output_type,"Line iteration report:",err,error,*999)
12237  CALL write_string_value(diagnostic_output_type," Number of iterations = ",iteration_number,err,error,*999)
12238  CALL write_string_value(diagnostic_output_type," Maximum length difference = ",maximum_length_difference, &
12239  & err,error,*999)
12240  CALL write_string_value(diagnostic_output_type," Difference tolerance = ",line_increment_tolerance, &
12241  err,error,*999)
12242  CALL write_string_value(diagnostic_output_type," Maximum difference line = ",maximum_difference_line, &
12243  err,error,*999)
12244  ENDIF
12245  IF(.NOT.iterate.OR.iteration_number==lines_maximum_number_of_iterations) THEN
12246  update_fields_using=.true.
12247  ELSE
12248  update_fields_using=.false.
12249  ENDIF
12250  CALL field_geometricparametersscalefactorsupdate(field,update_fields_using,err,error,*999)
12251  ENDDO !iterate
12252  CALL field_interpolated_points_finalise(interpolated_point,err,error,*999)
12253  CALL field_interpolation_parameters_finalise(interpolation_parameters,err,error,*999)
12254  ELSE
12255  local_error="Geometric parameters are not associated for field number "// &
12256  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12257  CALL flagerror(local_error,err,error,*999)
12258  ENDIF
12259  ELSE
12260  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is not a geometric field."
12261  CALL flagerror(local_error,err,error,*999)
12262  ENDIF
12263  ELSE
12264  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
12265  CALL flagerror(local_error,err,error,*999)
12266  ENDIF
12267  ELSE
12268  CALL flagerror("Field is not associated.",err,error,*999)
12269  ENDIF
12270 
12271  IF(diagnostics1) THEN
12272  CALL write_string(diagnostic_output_type,"Line lengths:",err,error,*999)
12273  CALL write_string_value(diagnostic_output_type," Number of iterations = ",iteration_number,err,error,*999)
12274  CALL write_string_value(diagnostic_output_type," Maximum length difference = ",maximum_length_difference,err,error,*999)
12275  CALL write_string_value(diagnostic_output_type," Difference tolerance = ",line_increment_tolerance,err,error,*999)
12276  CALL write_string_value(diagnostic_output_type," Maximum difference line = ",maximum_difference_line,err,error,*999)
12277  CALL write_string_value(diagnostic_output_type," Number of lines = ",field%DECOMPOSITION%TOPOLOGY%LINES%NUMBER_OF_LINES, &
12278  & err,error,*999)
12279  DO nl=1,field%DECOMPOSITION%TOPOLOGY%LINES%NUMBER_OF_LINES
12280  CALL write_string_fmt_two_value(diagnostic_output_type," Line ",nl,"(I8)"," length = ",field% &
12281  & geometric_field_parameters% LENGTHS(nl),"*",err,error,*999)
12282  ENDDO !nl
12283  ENDIF
12284 
12285  exits("Field_GeometricParametersLineLengthsCalculate")
12286  RETURN
12287 999 IF(ASSOCIATED(interpolated_point)) CALL field_interpolated_points_finalise(interpolated_point,dummy_err,dummy_error,*998)
12288 998 IF(ASSOCIATED(interpolation_parameters)) CALL field_interpolation_parameters_finalise(interpolation_parameters, &
12289  & dummy_err,dummy_error,*997)
12290 997 errors("Field_GeometricParametersLineLengthsCalculate",err,error)
12291  exits("Field_GeometricParametersLineLengthsCalculate")
12292  RETURN 1
12293 
12294  END SUBROUTINE field_geometricparameterslinelengthscalculate
12295 
12296  !
12297  !================================================================================================================================
12298  !
12299 
12301  SUBROUTINE field_geometricparametersfaceareascalculate(FIELD,ERR,ERROR,*)
12302 
12303  !Argument variables
12304  TYPE(field_type), POINTER :: field
12305  INTEGER(INTG), INTENT(OUT) :: err
12306  TYPE(varying_string), INTENT(OUT) :: error
12307  !Local Variables
12308 
12309  INTEGER(INTG) :: dummy_err,ng,nf
12310  INTEGER(INTG) :: gauss_start(4) = [ 0,1,3,6 ]
12311  INTEGER(INTG) :: number_of_gauss_points=4
12312  REAL(DP) :: xi(1),w,face_area
12313  REAL(DP) :: xig(10),wig(10)
12314  TYPE(coordinate_system_type), POINTER :: coordinate_system
12315  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolated_point(:)
12316  TYPE(field_interpolated_point_metrics_ptr_type), POINTER :: interpolated_point_metrics(:)
12317  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolation_parameters(:)
12318  TYPE(varying_string) :: dummy_error,local_error
12319 
12320  xig = [ 0.500000000000000_dp, &
12321  & 0.211324865405187_dp,0.788675134594813_dp, &
12322  & 0.112701665379258_dp,0.500000000000000_dp,0.887298334620742_dp, &
12323  & 0.06943184420297349_dp,0.330009478207572_dp,0.669990521792428_dp,0.930568155797026_dp ]
12324  wig = [ 1.000000000000000_dp, &
12325  & 0.500000000000000_dp,0.500000000000000_dp, &
12326  & 0.277777777777778_dp,0.444444444444444_dp,0.277777777777778_dp, &
12327  & 0.173927422568727_dp,0.326072577431273_dp,0.326072577431273_dp,0.173927422568727_dp ]
12328  NULLIFY(interpolated_point)
12329  NULLIFY(interpolated_point_metrics)
12330  NULLIFY(interpolation_parameters)
12331 
12332  enters("Field_GeometricParametersFaceAreasCalculate",err,error,*999)
12333 
12334  IF(ASSOCIATED(field)) THEN
12335  IF(field%FIELD_FINISHED) THEN
12336  IF(field%TYPE==field_geometric_type) THEN
12337  IF(ASSOCIATED(field%GEOMETRIC_FIELD_PARAMETERS)) THEN
12338  NULLIFY(coordinate_system)
12339  CALL field_coordinate_system_get(field,coordinate_system,err,error,*999)
12340  CALL field_interpolation_parameters_initialise(field,interpolation_parameters,err,error,*999)
12341  CALL field_interpolated_points_initialise(interpolation_parameters,interpolated_point,err,error,*999)
12342  CALL field_interpolatedpointsmetricsinitialise(interpolated_point,interpolated_point_metrics,err,error,*999)
12343 
12344  !Loop over the faces
12345  DO nf=1,field%DECOMPOSITION%TOPOLOGY%FACES%NUMBER_OF_FACES
12346  CALL field_interpolation_parameters_face_get(field_values_set_type,nf, &
12347  & interpolation_parameters(field_u_variable_type)%PTR,err,error,*999)
12348  face_area=0.0_dp
12349  DO ng=1,number_of_gauss_points
12350  xi(1)=xig(gauss_start(number_of_gauss_points)+ng)
12351  w=wig(gauss_start(number_of_gauss_points)+ng)
12352  CALL field_interpolate_xi(first_part_deriv,xi,interpolated_point(field_u_variable_type)%PTR,err,error,*999)
12353  CALL field_interpolated_point_metrics_calculate(coordinate_jacobian_area_type, &
12354  & interpolated_point_metrics(field_u_variable_type)%PTR,err,error,*999)
12355  face_area=face_area+w*interpolated_point_metrics(field_u_variable_type)%PTR%JACOBIAN
12356  ENDDO !ng
12357  field%GEOMETRIC_FIELD_PARAMETERS%AREAS(nf)=face_area
12358  ENDDO !nf
12359 
12360  CALL field_interpolatedpointsmetricsfinalise(interpolated_point_metrics,err,error,*999)
12361  CALL field_interpolated_points_finalise(interpolated_point,err,error,*999)
12362  CALL field_interpolation_parameters_finalise(interpolation_parameters,err,error,*999)
12363  ELSE
12364  local_error="Geometric parameters are not associated for field number "// &
12365  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12366  CALL flagerror(local_error,err,error,*999)
12367  ENDIF
12368  ELSE
12369  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is not a geometric field."
12370  CALL flagerror(local_error,err,error,*999)
12371  ENDIF
12372  ELSE
12373  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
12374  CALL flagerror(local_error,err,error,*999)
12375  ENDIF
12376  ELSE
12377  CALL flagerror("Field is not associated.",err,error,*999)
12378  ENDIF
12379 
12380  IF(diagnostics1) THEN
12381  CALL write_string(diagnostic_output_type,"Face areas:",err,error,*999)
12382  CALL write_string_value(diagnostic_output_type," Number of faces = ",field%DECOMPOSITION%TOPOLOGY%FACES%NUMBER_OF_FACES, &
12383  & err,error,*999)
12384  DO nf=1,field%DECOMPOSITION%TOPOLOGY%FACES%NUMBER_OF_FACES
12385  CALL write_string_fmt_two_value(diagnostic_output_type," Face ",nf,"(I8)"," area = ",field% &
12386  & geometric_field_parameters%AREAS(nf),"*",err,error,*999)
12387  ENDDO !nf
12388  ENDIF
12389 
12390  exits("Field_GeometricParametersFaceAreasCalculate")
12391  RETURN
12392 999 IF(ASSOCIATED(interpolated_point_metrics)) CALL field_interpolatedpointsmetricsfinalise(interpolated_point_metrics, &
12393  & dummy_err,dummy_error,*999)
12394  IF(ASSOCIATED(interpolated_point)) CALL field_interpolated_points_finalise(interpolated_point,dummy_err,dummy_error,*999)
12395  IF(ASSOCIATED(interpolation_parameters)) CALL field_interpolation_parameters_finalise(interpolation_parameters, &
12396  & dummy_err,dummy_error,*999)
12397  errorsexits("Field_GeometricParametersFaceAreasCalculate",err,error)
12398  RETURN 1
12399 
12400  END SUBROUTINE field_geometricparametersfaceareascalculate
12401 
12402  !
12403  !================================================================================================================================
12404  !
12405 
12407  SUBROUTINE field_geometricparametersscalefactorsupdate(FIELD,UPDATE_FIELDS_USING,ERR,ERROR,*)
12408 
12409  !Argument variables
12410  TYPE(field_type), POINTER :: field
12411  LOGICAL, INTENT(IN) :: update_fields_using
12412  INTEGER(INTG), INTENT(OUT) :: err
12413  TYPE(varying_string), INTENT(OUT) :: error
12414  !Local Variables
12415  INTEGER(INTG) :: field_idx,last_field_idx
12416  TYPE(field_type), POINTER :: field2
12417 
12418  enters("Field_GeometricParametersScaleFactorsUpdate",err,error,*999)
12419 
12420  IF(ASSOCIATED(field)) THEN
12421  IF(field%TYPE==field_geometric_type) THEN
12422  IF(update_fields_using) THEN
12423  last_field_idx=field%GEOMETRIC_FIELD_PARAMETERS%NUMBER_OF_FIELDS_USING
12424  ELSE
12425  last_field_idx=1 !The first field using will be the current field
12426  ENDIF
12427  DO field_idx=1,last_field_idx
12428  field2=>field%GEOMETRIC_FIELD_PARAMETERS%FIELDS_USING(field_idx)%PTR
12429  CALL field_scalings_calculate(field2,err,error,*999)
12430  ENDDO !field_idx
12431  ELSE
12432  CALL flagerror("Field is not geometric field.",err,error,*999)
12433  ENDIF
12434  ELSE
12435  CALL flagerror("Field is not associated.",err,error,*999)
12436  ENDIF
12437 
12438  exits("Field_GeometricParametersScaleFactorsUpdate")
12439  RETURN
12440 999 errorsexits("Field_GeometricParametersScaleFactorsUpdate",err,error)
12441  RETURN 1
12442 
12443  END SUBROUTINE field_geometricparametersscalefactorsupdate
12444 
12445  !
12446  !================================================================================================================================
12447  !
12448 
12450  SUBROUTINE field_label_get_c(FIELD,LABEL,ERR,ERROR,*)
12451 
12452  !Argument variables
12453  TYPE(field_type), POINTER :: field
12454  CHARACTER(LEN=*), INTENT(OUT) :: label
12455  INTEGER(INTG), INTENT(OUT) :: err
12456  TYPE(varying_string), INTENT(OUT) :: error
12457  !Local Variables
12458  INTEGER(INTG) :: c_length,vs_length
12459  TYPE(varying_string) :: local_error
12460 
12461  enters("FIELD_LABEL_GET_C",err,error,*999)
12462 
12463  IF(ASSOCIATED(field)) THEN
12464  IF(field%FIELD_FINISHED) THEN
12465  c_length=len(label)
12466  vs_length=len_trim(field%LABEL)
12467  IF(c_length>vs_length) THEN
12468  label=char(len_trim(field%LABEL))
12469  ELSE
12470  label=char(field%LABEL,c_length)
12471  ENDIF
12472  ELSE
12473  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
12474  & " has not been finished."
12475  CALL flagerror(local_error,err,error,*999)
12476  ENDIF
12477  ELSE
12478  CALL flagerror("Field is not associated.",err,error,*999)
12479  ENDIF
12480 
12481  exits("FIELD_LABEL_GET_C")
12482  RETURN
12483 999 errorsexits("FIELD_LABEL_GET_C",err,error)
12484  RETURN 1
12485  END SUBROUTINE field_label_get_c
12486 
12487  !
12488  !================================================================================================================================
12489  !
12490 
12492  SUBROUTINE field_label_get_vs(FIELD,LABEL,ERR,ERROR,*)
12493 
12494  !Argument variables
12495  TYPE(field_type), POINTER :: field
12496  TYPE(varying_string), INTENT(OUT) :: label
12497  INTEGER(INTG), INTENT(OUT) :: err
12498  TYPE(varying_string), INTENT(OUT) :: error
12499  !Local Variables
12500  TYPE(varying_string) :: local_error
12501 
12502  enters("FIELD_LABEL_GET_VS",err,error,*999)
12503 
12504  IF(ASSOCIATED(field)) THEN
12505  IF(field%FIELD_FINISHED) THEN
12506  label=field%LABEL
12507  ELSE
12508  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
12509  & " has not been finished."
12510  CALL flagerror(local_error,err,error,*999)
12511  ENDIF
12512  ELSE
12513  CALL flagerror("Field is not associated.",err,error,*999)
12514  ENDIF
12515 
12516  exits("FIELD_LABEL_GET_VS")
12517  RETURN
12518 999 errorsexits("FIELD_LABEL_GET_VS",err,error)
12519  RETURN 1
12520  END SUBROUTINE field_label_get_vs
12521 
12522  !
12523  !================================================================================================================================
12524  !
12525 
12527  SUBROUTINE field_label_set_c(FIELD,LABEL,ERR,ERROR,*)
12528 
12529  !Argument variables
12530  TYPE(field_type), POINTER :: field
12531  CHARACTER(LEN=*), INTENT(IN) :: label
12532  INTEGER(INTG), INTENT(OUT) :: err
12533  TYPE(varying_string), INTENT(OUT) :: error
12534  !Local Variables
12535  TYPE(varying_string) :: local_error
12536 
12537  enters("FIELD_LABEL_SET_C",err,error,*999)
12538 
12539  IF(ASSOCIATED(field)) THEN
12540  IF(field%FIELD_FINISHED) THEN
12541  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
12542  & " has been finished."
12543  CALL flagerror(local_error,err,error,*999)
12544  ELSE
12545  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
12546  IF(field%CREATE_VALUES_CACHE%LABEL_LOCKED) THEN
12547  local_error="The field label has been locked for field number "// &
12548  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
12549  CALL flagerror(local_error,err,error,*999)
12550  ELSE
12551  field%LABEL=label
12552  ENDIF
12553  ELSE
12554  local_error="Field create values cache is not associated for field number "// &
12555  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12556  CALL flagerror(local_error,err,error,*999)
12557  ENDIF
12558  ENDIF
12559  ELSE
12560  CALL flagerror("Field is not associated.",err,error,*999)
12561  ENDIF
12562 
12563  exits("FIELD_LABEL_SET_C")
12564  RETURN
12565 999 errorsexits("FIELD_LABEL_SET_C",err,error)
12566  RETURN 1
12567  END SUBROUTINE field_label_set_c
12568 
12569  !
12570  !================================================================================================================================
12571  !
12572 
12574  SUBROUTINE field_label_set_vs(FIELD,LABEL,ERR,ERROR,*)
12575 
12576  !Argument variables
12577  TYPE(field_type), POINTER :: field
12578  TYPE(varying_string), INTENT(IN) :: label
12579  INTEGER(INTG), INTENT(OUT) :: err
12580  TYPE(varying_string), INTENT(OUT) :: error
12581  !Local Variables
12582  TYPE(varying_string) :: local_error
12583 
12584  enters("FIELD_LABEL_SET_VS",err,error,*999)
12585 
12586  IF(ASSOCIATED(field)) THEN
12587  IF(field%FIELD_FINISHED) THEN
12588  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
12589  & " has been finished."
12590  CALL flagerror(local_error,err,error,*999)
12591  ELSE
12592  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
12593  IF(field%CREATE_VALUES_CACHE%LABEL_LOCKED) THEN
12594  local_error="The field label has been locked for field number "// &
12595  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
12596  CALL flagerror(local_error,err,error,*999)
12597  ELSE
12598  field%LABEL=label
12599  ENDIF
12600  ELSE
12601  local_error="Field create values cache is not associated for field number "// &
12602  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12603  CALL flagerror(local_error,err,error,*999)
12604  ENDIF
12605  ENDIF
12606  ELSE
12607  CALL flagerror("Field is not associated.",err,error,*999)
12608  ENDIF
12609 
12610  exits("FIELD_LABEL_SET_VS")
12611  RETURN
12612 999 errorsexits("FIELD_LABEL_SET_VS",err,error)
12613  RETURN 1
12614  END SUBROUTINE field_label_set_vs
12615 
12616  !
12617  !================================================================================================================================
12618  !
12619 
12621  SUBROUTINE field_label_set_and_lock_c(FIELD,LABEL,ERR,ERROR,*)
12622 
12623  !Argument variables
12624  TYPE(field_type), POINTER :: field
12625  CHARACTER(LEN=*), INTENT(IN) :: label
12626  INTEGER(INTG), INTENT(OUT) :: err
12627  TYPE(varying_string), INTENT(OUT) :: error
12628  !Local Variables
12629  TYPE(varying_string) :: local_error
12630 
12631  enters("FIELD_LABEL_SET_AND_LOCK_C",err,error,*999)
12632 
12633  CALL field_label_set(field,label,err,error,*999)
12634  IF(ASSOCIATED(field)) THEN
12635  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
12636  field%CREATE_VALUES_CACHE%LABEL_LOCKED=.true.
12637  ELSE
12638  local_error="Field create values cache is not associated for field number "// &
12639  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12640  CALL flagerror(local_error,err,error,*999)
12641  ENDIF
12642  ELSE
12643  CALL flagerror("Field is not associated.",err,error,*999)
12644  ENDIF
12645 
12646  exits("FIELD_LABEL_SET_AND_LOCK_C")
12647  RETURN
12648 999 errorsexits("FIELD_LABEL_SET_AND_LOCK_C",err,error)
12649  RETURN 1
12650  END SUBROUTINE field_label_set_and_lock_c
12651 
12652  !
12653  !================================================================================================================================
12654  !
12655 
12657  SUBROUTINE field_label_set_and_lock_vs(FIELD,LABEL,ERR,ERROR,*)
12658 
12659  !Argument variables
12660  TYPE(field_type), POINTER :: field
12661  TYPE(varying_string), INTENT(IN) :: label
12662  INTEGER(INTG), INTENT(OUT) :: err
12663  TYPE(varying_string), INTENT(OUT) :: error
12664  !Local Variables
12665  TYPE(varying_string) :: local_error
12666 
12667  enters("FIELD_LABEL_SET_AND_LOCK_VS",err,error,*999)
12668 
12669  CALL field_label_set(field,label,err,error,*999)
12670  IF(ASSOCIATED(field)) THEN
12671  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
12672  field%CREATE_VALUES_CACHE%LABEL_LOCKED=.true.
12673  ELSE
12674  local_error="Field create values cache is not associated for field number "// &
12675  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12676  CALL flagerror(local_error,err,error,*999)
12677  ENDIF
12678  ELSE
12679  CALL flagerror("Field is not associated.",err,error,*999)
12680  ENDIF
12681 
12682  exits("FIELD_LABEL_SET_AND_LOCK_VS")
12683  RETURN
12684 999 errorsexits("FIELD_LABEL_SET_AND_LOCK_VS",err,error)
12685  RETURN 1
12686  END SUBROUTINE field_label_set_and_lock_vs
12687 
12688  !
12689  !================================================================================================================================
12690  !
12691 
12693  SUBROUTINE field_mesh_decomposition_get(FIELD,MESH_DECOMPOSITION,ERR,ERROR,*)
12694 
12695  !Argument variables
12696  TYPE(field_type), POINTER :: field
12697  TYPE(decomposition_type), POINTER :: mesh_decomposition
12698  INTEGER(INTG), INTENT(OUT) :: err
12699  TYPE(varying_string), INTENT(OUT) :: error
12700  !Local Variables
12701  TYPE(varying_string) :: local_error
12702 
12703  enters("FIELD_MESH_DECOMPOSITION_GET",err,error,*999)
12704 
12705  IF(ASSOCIATED(field)) THEN
12706  IF(field%FIELD_FINISHED) THEN
12707  IF(ASSOCIATED(mesh_decomposition)) THEN
12708  CALL flagerror("Mesh decomposition is already associated.",err,error,*999)
12709  ELSE
12710  NULLIFY(mesh_decomposition)
12711  mesh_decomposition=>field%DECOMPOSITION
12712  IF(.NOT.ASSOCIATED(mesh_decomposition)) CALL flagerror("Field decomposition is not associated.",err,error,*999)
12713  ENDIF
12714  ELSE
12715  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
12716  & " has not been finished."
12717  CALL flagerror(local_error,err,error,*999)
12718  ENDIF
12719  ELSE
12720  CALL flagerror("Field is not associated.",err,error,*999)
12721  ENDIF
12722 
12723  exits("FIELD_MESH_DECOMPOSITION_GET")
12724  RETURN
12725 999 errorsexits("FIELD_MESH_DECOMPOSITION_GET",err,error)
12726  RETURN 1
12727  END SUBROUTINE field_mesh_decomposition_get
12728 
12729  !
12730  !================================================================================================================================
12731  !
12732 
12734  SUBROUTINE field_mesh_decomposition_set(FIELD,MESH_DECOMPOSITION,ERR,ERROR,*)
12735 
12736  !Argument variables
12737  TYPE(field_type), POINTER :: field
12738  TYPE(decomposition_type), POINTER :: mesh_decomposition
12739  INTEGER(INTG), INTENT(OUT) :: err
12740  TYPE(varying_string), INTENT(OUT) :: error
12741  !Local Variables
12742  TYPE(mesh_type), POINTER :: mesh
12743  TYPE(interface_type), POINTER :: mesh_interface,field_interface
12744  TYPE(region_type), POINTER :: mesh_region,field_region,parent_region
12745  TYPE(varying_string) :: local_error
12746 
12747  enters("FIELD_MESH_DECOMPOSITION_SET",err,error,*999)
12748 
12749  IF(ASSOCIATED(field)) THEN
12750  IF(field%FIELD_FINISHED) THEN
12751  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
12752  & " has been finished."
12753  CALL flagerror(local_error,err,error,*999)
12754  ELSE
12755  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
12756  IF(field%CREATE_VALUES_CACHE%DECOMPOSITION_LOCKED) THEN
12757  local_error="The mesh decomposition has been locked for field number "// &
12758  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
12759  CALL flagerror(local_error,err,error,*999)
12760  ELSE
12761  IF(ASSOCIATED(mesh_decomposition)) THEN
12762  mesh=>mesh_decomposition%MESH
12763  IF(ASSOCIATED(mesh)) THEN
12764  NULLIFY(mesh_interface)
12765  mesh_region=>mesh%REGION
12766  IF(ASSOCIATED(mesh_region)) THEN
12767  NULLIFY(field_interface)
12768  field_region=>field%REGION
12769  IF(ASSOCIATED(field_region)) THEN
12770  IF(mesh_region%USER_NUMBER==field_region%USER_NUMBER) THEN
12771  field%DECOMPOSITION=>mesh_decomposition
12772  ELSE
12773  local_error="Inconsitent regions. The field is defined on region number "// &
12774  & trim(number_to_vstring(field%REGION%USER_NUMBER,"*",err,error))// &
12775  & " and the mesh decomposition is defined on region number "//&
12776  & trim(number_to_vstring(mesh_decomposition%MESH%REGION%USER_NUMBER,"*",err,error))//"."
12777  CALL flagerror(local_error,err,error,*999)
12778  ENDIF
12779  ELSE
12780  field_interface=>field%INTERFACE
12781  IF(ASSOCIATED(field_interface)) THEN
12782  parent_region=>field_interface%PARENT_REGION
12783  IF(ASSOCIATED(parent_region)) THEN
12784  local_error="Inconsitent setup. The field is defined on interface number "// &
12785  & trim(number_to_vstring(field_interface%USER_NUMBER,"*",err,error))// &
12786  & " of parent region number "//trim(number_to_vstring(parent_region%USER_NUMBER,"*",err,error))// &
12787  & " and the mesh decomposition is defined on region number "// &
12788  & trim(number_to_vstring(mesh_region%USER_NUMBER,"*",err,error))//"."
12789  CALL flagerror(local_error,err,error,*999)
12790  ELSE
12791  CALL flagerror("Field interface has no parent region.",err,error,*999)
12792  ENDIF
12793  ELSE
12794  local_error="Region or interface is not associated for field number "// &
12795  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12796  CALL flagerror(local_error,err,error,*999)
12797  ENDIF
12798  ENDIF
12799  ELSE
12800  mesh_interface=>mesh%INTERFACE
12801  IF(ASSOCIATED(mesh_interface)) THEN
12802  parent_region=>mesh_interface%PARENT_REGION
12803  IF(ASSOCIATED(parent_region)) THEN
12804  field_region=>field%REGION
12805  IF(ASSOCIATED(field_region)) THEN
12806  local_error="Inconsitent setup. The field is defined on region number "// &
12807  & trim(number_to_vstring(field_region%USER_NUMBER,"*",err,error))// &
12808  & " and the mesh decomposition is defined on interface number "// &
12809  & trim(number_to_vstring(mesh_interface%USER_NUMBER,"*",err,error))// &
12810  & " of parent region number "//trim(number_to_vstring(parent_region%USER_NUMBER,"*",err,error))//"."
12811  CALL flagerror(local_error,err,error,*999)
12812  ELSE
12813  field_interface=>field%INTERFACE
12814  IF(ASSOCIATED(field_interface)) THEN
12815  parent_region=>field_interface%PARENT_REGION
12816  IF(ASSOCIATED(parent_region)) THEN
12817  IF(mesh_interface%USER_NUMBER==field_interface%USER_NUMBER) THEN
12818  field%DECOMPOSITION=>mesh_decomposition
12819  ELSE
12820  local_error="Inconsitent interfaces. The field is defined on interface number "// &
12821  & trim(number_to_vstring(field_interface%USER_NUMBER,"*",err,error))// &
12822  & " of parent region number "// &
12823  & trim(number_to_vstring(parent_region%USER_NUMBER,"*",err,error))// &
12824  & " and the mesh decomposition is defined on region number "//&
12825  & trim(number_to_vstring(mesh_region%USER_NUMBER,"*",err,error))//"."
12826  CALL flagerror(local_error,err,error,*999)
12827 
12828  ENDIF
12829  ELSE
12830  CALL flagerror("Field interface parent region is not associated.",err,error,*999)
12831  ENDIF
12832  ELSE
12833  local_error="Region or interface is not associated for field number "// &
12834  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12835  CALL flagerror(local_error,err,error,*999)
12836  ENDIF
12837  ENDIF
12838  ELSE
12839  CALL flagerror("Mesh interface parent region is not associated.",err,error,*999)
12840  ENDIF
12841  ELSE
12842  local_error="Region or interface is not associated for mesh number "// &
12843  & trim(number_to_vstring(mesh%USER_NUMBER,"*",err,error))//"."
12844  CALL flagerror(local_error,err,error,*999)
12845  ENDIF
12846  ENDIF
12847  ELSE
12848  CALL flagerror("Mesh is not associated for the mesh decomposition.",err,error,*999)
12849  ENDIF
12850  ELSE
12851  CALL flagerror("Mesh decomposition is not assocaited.",err,error,*999)
12852  ENDIF
12853  ENDIF
12854  ELSE
12855  local_error="Field create values cache is not associated for field number "// &
12856  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12857  CALL flagerror(local_error,err,error,*999)
12858  ENDIF
12859  ENDIF
12860  ELSE
12861  CALL flagerror("Field is not associated.",err,error,*999)
12862  ENDIF
12863 
12864  exits("FIELD_MESH_DECOMPOSITION_SET")
12865  RETURN
12866 999 errorsexits("FIELD_MESH_DECOMPOSITION_SET",err,error)
12867  RETURN 1
12868  END SUBROUTINE field_mesh_decomposition_set
12869 
12870  !
12871  !================================================================================================================================
12872  !
12873 
12875  SUBROUTINE field_mesh_decomposition_set_and_lock(FIELD,MESH_DECOMPOSITION,ERR,ERROR,*)
12876 
12877  !Argument variables
12878  TYPE(field_type), POINTER :: field
12879  TYPE(decomposition_type), POINTER :: mesh_decomposition
12880  INTEGER(INTG), INTENT(OUT) :: err
12881  TYPE(varying_string), INTENT(OUT) :: error
12882  !Local Variables
12883  TYPE(varying_string) :: local_error
12884 
12885  enters("FIELD_MESH_DECOMPOSITION_SET_AND_LOCK",err,error,*999)
12886 
12887  CALL field_mesh_decomposition_set(field,mesh_decomposition,err,error,*999)
12888  IF(ASSOCIATED(field)) THEN
12889  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
12890  field%CREATE_VALUES_CACHE%DECOMPOSITION_LOCKED=.true.
12891  ELSE
12892  local_error="Field create values cache is not associated for field number "// &
12893  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12894  CALL flagerror(local_error,err,error,*999)
12895  ENDIF
12896  ELSE
12897  CALL flagerror("Field is not associated.",err,error,*999)
12898  ENDIF
12899 
12900  exits("FIELD_MESH_DECOMPOSITION_SET_AND_LOCK")
12901  RETURN
12902 999 errorsexits("FIELD_MESH_DECOMPOSITION_SET_AND_LOCK",err,error)
12903  RETURN 1
12904  END SUBROUTINE field_mesh_decomposition_set_and_lock
12905 
12906  !
12907  !================================================================================================================================
12908  !
12909 
12911  SUBROUTINE field_dataprojectionset(field,dataProjection,err,error,*)
12912 
12913  !Argument variables
12914  TYPE(field_type), POINTER :: field
12915  TYPE(data_projection_type), POINTER :: dataprojection
12916  INTEGER(INTG), INTENT(OUT) :: err
12917  TYPE(varying_string), INTENT(OUT) :: error
12918  TYPE(varying_string) :: localerror
12919 
12920  enters("Field_DataProjectionSet",err,error,*999)
12921 
12922  IF(ASSOCIATED(field)) THEN
12923  IF(field%FIELD_FINISHED) THEN
12924  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
12925  & " has been finished."
12926  CALL flagerror(localerror,err,error,*999)
12927  ELSE
12928  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
12929  IF(field%CREATE_VALUES_CACHE%DataProjectionLocked) THEN
12930  localerror="The data projection has been locked for field number "// &
12931  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
12932  CALL flagerror(localerror,err,error,*999)
12933  ELSE
12934  IF(ASSOCIATED(dataprojection)) THEN
12935  field%DataProjection=>dataprojection
12936  ELSE
12937  CALL flagerror("Data projection is not associated.",err,error,*999)
12938  ENDIF
12939  ENDIF
12940  ELSE
12941  localerror="Field create values cache is not associated for field number "// &
12942  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12943  CALL flagerror(localerror,err,error,*999)
12944  ENDIF
12945  ENDIF
12946  ELSE
12947  CALL flagerror("Field is not associated.",err,error,*999)
12948  ENDIF
12949 
12950  exits("Field_DataProjectionSet")
12951  RETURN
12952 999 errorsexits("Field_DataProjectionSet",err,error)
12953  RETURN 1
12954  END SUBROUTINE field_dataprojectionset
12955 
12956  !
12957  !================================================================================================================================
12958  !
12959 
12961  SUBROUTINE field_number_of_components_check(FIELD,VARIABLE_TYPE,NUMBER_OF_COMPONENTS,ERR,ERROR,*)
12962 
12963  !Argument variables
12964  TYPE(field_type), POINTER :: field
12965  INTEGER(INTG), INTENT(IN) :: variable_type
12966  INTEGER(INTG), INTENT(IN) :: number_of_components !The number of components in the field variable to check
12967  INTEGER(INTG), INTENT(OUT) :: err
12968  TYPE(varying_string), INTENT(OUT) :: error
12969  !Local Variables
12970  TYPE(field_variable_type), POINTER :: field_variable
12971  TYPE(varying_string) :: local_error
12972 
12973  enters("FIELD_NUMBER_OF_COMPONENTS_CHECK",err,error,*999)
12974 
12975  IF(ASSOCIATED(field)) THEN
12976  IF(field%FIELD_FINISHED) THEN
12977  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
12978  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
12979  IF(ASSOCIATED(field_variable)) THEN
12980  IF(field_variable%NUMBER_OF_COMPONENTS/=number_of_components) THEN
12981  local_error="Invalid number of components. The number components for variable type "// &
12982  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
12983  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
12984  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
12985  & " which does not correspond to the specified number of components of "// &
12986  & trim(number_to_vstring(number_of_components,"*",err,error))//"."
12987  CALL flagerror(local_error,err,error,*999)
12988  ENDIF
12989  ELSE
12990  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
12991  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
12992  ENDIF
12993  ELSE
12994  local_error="The supplied variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
12995  & " is invalid. The field variable type must be > 1 and <= "// &
12996  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
12997  CALL flagerror(local_error,err,error,*999)
12998  ENDIF
12999  ELSE
13000  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
13001  & " has not been finished."
13002  CALL flagerror(local_error,err,error,*999)
13003  ENDIF
13004  ELSE
13005  CALL flagerror("Field is not associated.",err,error,*999)
13006  ENDIF
13007 
13008  exits("FIELD_NUMBER_OF_COMPONENTS_CHECK")
13009  RETURN
13010 999 errorsexits("FIELD_NUMBER_OF_COMPONENTS_CHECK",err,error)
13011  RETURN 1
13012  END SUBROUTINE field_number_of_components_check
13013 
13014  !
13015  !================================================================================================================================
13016  !
13017 
13019  SUBROUTINE field_number_of_components_get(FIELD,VARIABLE_TYPE,NUMBER_OF_COMPONENTS,ERR,ERROR,*)
13020 
13021  !Argument variables
13022  TYPE(field_type), POINTER :: field
13023  INTEGER(INTG), INTENT(IN) :: variable_type
13024  INTEGER(INTG), INTENT(OUT) :: number_of_components
13025  INTEGER(INTG), INTENT(OUT) :: err
13026  TYPE(varying_string), INTENT(OUT) :: error
13027  !Local Variables
13028  TYPE(field_variable_type), POINTER :: field_variable
13029  TYPE(varying_string) :: local_error
13030 
13031  enters("FIELD_NUMBER_OF_COMPONENTS_GET",err,error,*999)
13032 
13033  IF(ASSOCIATED(field)) THEN
13034  IF(field%FIELD_FINISHED) THEN
13035  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
13036  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
13037  IF(ASSOCIATED(field_variable)) THEN
13038  number_of_components=field_variable%NUMBER_OF_COMPONENTS
13039  ELSE
13040  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
13041  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13042  ENDIF
13043  ELSE
13044  local_error="The supplied variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
13045  & " is invalid. The field variable type must be > 1 and <= "// &
13046  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
13047  CALL flagerror(local_error,err,error,*999)
13048  ENDIF
13049  ELSE
13050  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
13051  & " has not been finished."
13052  CALL flagerror(local_error,err,error,*999)
13053  ENDIF
13054  ELSE
13055  CALL flagerror("Field is not associated.",err,error,*999)
13056  ENDIF
13057 
13058  exits("FIELD_NUMBER_OF_COMPONENTS_GET")
13059  RETURN
13060 999 errorsexits("FIELD_NUMBER_OF_COMPONENTS_GET",err,error)
13061  RETURN 1
13062  END SUBROUTINE field_number_of_components_get
13063 
13064  !
13065  !================================================================================================================================
13066  !
13067 
13069  SUBROUTINE field_number_of_components_set(FIELD,VARIABLE_TYPE,NUMBER_OF_COMPONENTS,ERR,ERROR,*)
13070 
13071  !Argument variables
13072  TYPE(field_type), POINTER :: field
13073  INTEGER(INTG), INTENT(IN) :: variable_type
13074  INTEGER(INTG), INTENT(IN) :: number_of_components
13075  INTEGER(INTG), INTENT(OUT) :: err
13076  TYPE(varying_string), INTENT(OUT) :: error
13077  !Local Variables
13078  INTEGER(INTG) :: component_idx,new_number_of_components,old_number_of_components,overlap_number_of_components,variable_idx
13079  INTEGER(INTG), ALLOCATABLE :: new_interpolation_type(:,:),new_mesh_component_number(:,:)
13080  LOGICAL, ALLOCATABLE ::new_component_labels_locked(:,:), new_interpolation_type_locked(:,:), &
13081  & NEW_MESH_COMPONENT_NUMBER_LOCKED(:,:)
13082  TYPE(varying_string) :: local_error
13083  TYPE(varying_string), ALLOCATABLE :: new_component_labels(:,:)
13084 
13085  enters("FIELD_NUMBER_OF_COMPONENTS_SET",err,error,*999)
13086 
13087  IF(ASSOCIATED(field)) THEN
13088  IF(field%FIELD_FINISHED) THEN
13089  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
13090  CALL flagerror(local_error,err,error,*999)
13091  ELSE
13092  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
13093  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
13094  IF(any(field%CREATE_VALUES_CACHE%VARIABLE_TYPES==variable_type)) THEN
13095  IF(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS_LOCKED(variable_type)) THEN
13096  local_error="The number of components has been locked for variable type "// &
13097  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
13098  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
13099  CALL flagerror(local_error,err,error,*999)
13100  ELSE
13101  SELECT CASE(field%CREATE_VALUES_CACHE%DIMENSION(variable_type))
13102  CASE(field_scalar_dimension_type)
13103  IF(number_of_components/=1) THEN
13104  local_error="Scalar fields cannot have "//trim(number_to_vstring(number_of_components,"*",err,error))// &
13105  & " components."
13106  CALL flagerror(local_error,err,error,*999)
13107  ENDIF
13108  CASE(field_vector_dimension_type)
13109  IF(number_of_components>0) THEN
13110  IF(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)/=number_of_components) THEN
13111  old_number_of_components=maxval(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS)
13112  new_number_of_components=number_of_components
13113  DO variable_idx=1,field_number_of_variable_types
13114  IF (field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_idx) > new_number_of_components) THEN
13115  IF (variable_idx /= variable_type) THEN
13116  new_number_of_components=field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_idx)
13117  ENDIF
13118  ENDIF
13119  ENDDO
13120  overlap_number_of_components=min(old_number_of_components,new_number_of_components)
13121  ALLOCATE(new_component_labels(new_number_of_components,field_number_of_variable_types),stat=err)
13122  IF(err/=0) CALL flagerror("Could not allocate new component labels.",err,error,*999)
13123  ALLOCATE(new_component_labels_locked(new_number_of_components,field_number_of_variable_types),stat=err)
13124  IF(err/=0) CALL flagerror("Could not allocate new component labels locked.",err,error,*999)
13125  ALLOCATE(new_interpolation_type(new_number_of_components,field_number_of_variable_types),stat=err)
13126  IF(err/=0) CALL flagerror("Could not allocate new interpolation type.",err,error,*999)
13127  ALLOCATE(new_interpolation_type_locked(new_number_of_components,field_number_of_variable_types),stat=err)
13128  IF(err/=0) CALL flagerror("Could not allocate new interpolation type locked.",err,error,*999)
13129  ALLOCATE(new_mesh_component_number(new_number_of_components,field_number_of_variable_types),stat=err)
13130  IF(err/=0) CALL flagerror("Could not allocate new mesh component number.",err,error,*999)
13131  ALLOCATE(new_mesh_component_number_locked(new_number_of_components,field_number_of_variable_types),stat=err)
13132  IF(err/=0) CALL flagerror("Could not allocate new mesh component number locked.",err,error,*999)
13133 
13134  new_component_labels=''
13135  new_component_labels_locked=.false.
13136  new_interpolation_type=0
13137  new_interpolation_type_locked=.false.
13138  new_mesh_component_number=0
13139  new_mesh_component_number_locked=.false.
13140  new_component_labels(1:overlap_number_of_components,:) = &
13141  & field%CREATE_VALUES_CACHE%COMPONENT_LABELS(1:overlap_number_of_components,:)
13142  new_component_labels_locked(1:overlap_number_of_components,:) = &
13143  & field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED(1:overlap_number_of_components,:)
13144  new_interpolation_type(1:overlap_number_of_components,:) = &
13145  & field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(1:overlap_number_of_components,:)
13146  new_interpolation_type_locked(1:overlap_number_of_components,:) = &
13147  & field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED(1:overlap_number_of_components,:)
13148  new_mesh_component_number(1:overlap_number_of_components,:) = &
13149  & field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(1:overlap_number_of_components,:)
13150  new_mesh_component_number_locked(1:overlap_number_of_components,:) = &
13151  & field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED(1:overlap_number_of_components,:)
13152  !Update remaining terms
13153  IF(old_number_of_components<number_of_components) THEN
13154  DO variable_idx=1,field_number_of_variable_types
13155  DO component_idx=old_number_of_components+1,number_of_components
13156  new_component_labels(component_idx,variable_idx)= &
13157  & trim(number_to_vstring(component_idx,"*",err,error))
13158  IF(err/=0) GOTO 999
13159  ENDDO
13160  new_interpolation_type(old_number_of_components+1:number_of_components,variable_idx) = &
13161  & field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(1,variable_idx)
13162  new_mesh_component_number(old_number_of_components+1:number_of_components,variable_idx) = &
13163  & field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(1,variable_idx)
13164  ENDDO
13165  ENDIF
13166 
13167  CALL move_alloc(new_component_labels,field%CREATE_VALUES_CACHE%COMPONENT_LABELS)
13168  CALL move_alloc(new_component_labels_locked,field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED)
13169  CALL move_alloc(new_interpolation_type,field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE)
13170  CALL move_alloc(new_interpolation_type_locked,field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED)
13171  CALL move_alloc(new_mesh_component_number,field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER)
13172  CALL move_alloc(new_mesh_component_number_locked,field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED)
13173 
13174  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)=number_of_components
13175  ENDIF
13176  ELSE
13177  local_error="Vector fields cannot have "//trim(number_to_vstring(number_of_components,"*",err,error))// &
13178  & " components."
13179  CALL flagerror(local_error,err,error,*999)
13180  ENDIF
13181  CASE(field_tensor_dimension_type)
13182  CALL flagerror("Not implemented.",err,error,*999)
13183  CASE DEFAULT
13184  local_error="Field dimension "//trim(number_to_vstring(field%CREATE_VALUES_CACHE%DIMENSION( &
13185  & variable_type),"*",err,error))//" is not valid."
13186  CALL flagerror(local_error,err,error,*999)
13187  END SELECT
13188  ENDIF
13189  ELSE
13190  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
13191  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13192  CALL flagerror(local_error,err,error,*999)
13193  ENDIF
13194  ELSE
13195  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
13196  & " is invalid. The variable type must be between 1 and "// &
13197  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
13198  CALL flagerror(local_error,err,error,*999)
13199  ENDIF
13200  ELSE
13201  local_error="Field create values cache is not associated for field number "// &
13202  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13203  CALL flagerror(local_error,err,error,*999)
13204  ENDIF
13205  ENDIF
13206  ELSE
13207  CALL flagerror("Field is not associated.",err,error,*999)
13208  ENDIF
13209 
13210  exits("FIELD_NUMBER_OF_COMPONENTS_SET")
13211  RETURN
13212 999 IF(ALLOCATED(new_component_labels)) DEALLOCATE(new_component_labels)
13213  IF(ALLOCATED(new_component_labels_locked)) DEALLOCATE(new_component_labels_locked)
13214  IF(ALLOCATED(new_interpolation_type)) DEALLOCATE(new_interpolation_type)
13215  IF(ALLOCATED(new_interpolation_type_locked)) DEALLOCATE(new_interpolation_type_locked)
13216  IF(ALLOCATED(new_mesh_component_number)) DEALLOCATE(new_mesh_component_number)
13217  IF(ALLOCATED(new_mesh_component_number_locked)) DEALLOCATE(new_mesh_component_number_locked)
13218  errorsexits("FIELD_NUMBER_OF_COMPONENTS_SET",err,error)
13219  RETURN 1
13220  END SUBROUTINE field_number_of_components_set
13221 
13222  !
13223  !================================================================================================================================
13224  !
13225 
13227  SUBROUTINE field_number_of_components_set_and_lock(FIELD,VARIABLE_TYPE,NUMBER_OF_COMPONENTS,ERR,ERROR,*)
13228 
13229  !Argument variables
13230  TYPE(field_type), POINTER :: field
13231  INTEGER(INTG), INTENT(IN) :: variable_type
13232  INTEGER(INTG), INTENT(IN) :: number_of_components
13233  INTEGER(INTG), INTENT(OUT) :: err
13234  TYPE(varying_string), INTENT(OUT) :: error
13235  !Local Variables
13236  TYPE(varying_string) :: local_error
13237 
13238  enters("FIELD_NUMBER_OF_COMPONENTS_SET_AND_LOCK",err,error,*999)
13239 
13240  CALL field_number_of_components_set(field,variable_type,number_of_components,err,error,*999)
13241  IF(ASSOCIATED(field)) THEN
13242  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
13243  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS_LOCKED(variable_type)=.true.
13244  ELSE
13245  local_error="Field create values cache is not associated for field number "// &
13246  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13247  CALL flagerror(local_error,err,error,*999)
13248  ENDIF
13249  ELSE
13250  CALL flagerror("Field is not associated.",err,error,*999)
13251  ENDIF
13252 
13253  exits("FIELD_NUMBER_OF_COMPONENTS_SET_AND_LOCK")
13254  RETURN
13255 999 errorsexits("FIELD_NUMBER_OF_COMPONENTS_SET_AND_LOCK",err,error)
13256  RETURN 1
13257  END SUBROUTINE field_number_of_components_set_and_lock
13258 
13259  !
13260  !================================================================================================================================
13261  !
13262 
13264  SUBROUTINE field_number_of_variables_check(FIELD,NUMBER_OF_VARIABLES,ERR,ERROR,*)
13265 
13266  !Argument variables
13267  TYPE(field_type), POINTER :: field
13268  INTEGER(INTG), INTENT(IN) :: number_of_variables
13269  INTEGER(INTG), INTENT(OUT) :: err
13270  TYPE(varying_string), INTENT(OUT) :: error
13271  !Local Variables
13272  TYPE(varying_string) :: local_error
13273 
13274  enters("FIELD_NUMBER_OF_VARIABLES_CHECK",err,error,*999)
13275 
13276  IF(ASSOCIATED(field)) THEN
13277  IF(field%FIELD_FINISHED) THEN
13278  IF(field%NUMBER_OF_VARIABLES/=number_of_variables) THEN
13279  local_error="Invalid number of variables. The number of variables for field number "// &
13280  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
13281  & trim(number_to_vstring(field%NUMBER_OF_VARIABLES,"*",err,error))// &
13282  & " which is does correspond to the specified number of variables of "// &
13283  & trim(number_to_vstring(number_of_variables,"*",err,error))//"."
13284  CALL flagerror(local_error,err,error,*999)
13285  ENDIF
13286  ELSE
13287  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
13288  & " has not been finished."
13289  CALL flagerror(local_error,err,error,*999)
13290  ENDIF
13291  ELSE
13292  CALL flagerror("Field is not associated.",err,error,*999)
13293  ENDIF
13294 
13295  exits("FIELD_NUMBER_OF_VARIABLES_CHECK")
13296  RETURN
13297 999 errorsexits("FIELD_NUMBER_OF_VARIABLES_CHECK",err,error)
13298  RETURN 1
13299  END SUBROUTINE field_number_of_variables_check
13300 
13301  !
13302  !================================================================================================================================
13303  !
13304 
13306  SUBROUTINE field_number_of_variables_get(FIELD,NUMBER_OF_VARIABLES,ERR,ERROR,*)
13307 
13308  !Argument variables
13309  TYPE(field_type), POINTER :: field
13310  INTEGER(INTG), INTENT(OUT) :: number_of_variables
13311  INTEGER(INTG), INTENT(OUT) :: err
13312  TYPE(varying_string), INTENT(OUT) :: error
13313  !Local Variables
13314  TYPE(varying_string) :: local_error
13315 
13316  enters("FIELD_NUMBER_OF_VARIABLES_GET",err,error,*999)
13317 
13318  IF(ASSOCIATED(field)) THEN
13319  IF(field%FIELD_FINISHED) THEN
13320  number_of_variables=field%NUMBER_OF_VARIABLES
13321  ELSE
13322  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
13323  & " has not been finished."
13324  CALL flagerror(local_error,err,error,*999)
13325  ENDIF
13326  ELSE
13327  CALL flagerror("Field is not associated.",err,error,*999)
13328  ENDIF
13329 
13330  exits("FIELD_NUMBER_OF_VARIABLES_GET")
13331  RETURN
13332 999 errorsexits("FIELD_NUMBER_OF_VARIABLES_GET",err,error)
13333  RETURN 1
13334  END SUBROUTINE field_number_of_variables_get
13335 
13336  !
13337  !================================================================================================================================
13338  !
13339 
13341  SUBROUTINE field_number_of_variables_set(FIELD,NUMBER_OF_VARIABLES,ERR,ERROR,*)
13342 
13343  !Argument variables
13344  TYPE(field_type), POINTER :: field
13345  INTEGER(INTG), INTENT(IN) :: number_of_variables
13346  INTEGER(INTG), INTENT(OUT) :: err
13347  TYPE(varying_string), INTENT(OUT) :: error
13348  !Local Variables
13349  INTEGER(INTG) :: variable_idx,variable_idx2,variable_type
13350  INTEGER(INTG), ALLOCATABLE :: old_variable_types(:)
13351  LOGICAL :: found
13352  TYPE(varying_string) :: local_error
13353 
13354  enters("FIELD_NUMBER_OF_VARIABLES_SET",err,error,*999)
13355 
13356  IF(ASSOCIATED(field)) THEN
13357  IF(field%FIELD_FINISHED) THEN
13358  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
13359  & " has been finished."
13360  CALL flagerror(local_error,err,error,*999)
13361  ELSE
13362  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
13363  IF(field%CREATE_VALUES_CACHE%NUMBER_OF_VARIABLES_LOCKED) THEN
13364  local_error="The number of variables has been locked field number "// &
13365  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
13366  CALL flagerror(local_error,err,error,*999)
13367  ELSE
13368  IF(number_of_variables>0.AND.number_of_variables<=field_number_of_variable_types) THEN
13369  IF(field%NUMBER_OF_VARIABLES/=number_of_variables) THEN
13370  ALLOCATE(old_variable_types(field%NUMBER_OF_VARIABLES),stat=err)
13371  IF(err/=0) CALL flagerror("Could not allocate old variable types.",err,error,*999)
13372  old_variable_types(1:field%NUMBER_OF_VARIABLES)=field%CREATE_VALUES_CACHE%VARIABLE_TYPES(1: &
13373  & field%NUMBER_OF_VARIABLES)
13374  DEALLOCATE(field%CREATE_VALUES_CACHE%VARIABLE_TYPES)
13375  ALLOCATE(field%CREATE_VALUES_CACHE%VARIABLE_TYPES(number_of_variables),stat=err)
13376  IF(err/=0) CALL flagerror("Could not allocate variable types.",err,error,*999)
13377  field%CREATE_VALUES_CACHE%VARIABLE_TYPES=0
13378  IF(number_of_variables<field%NUMBER_OF_VARIABLES) THEN
13379  field%CREATE_VALUES_CACHE%VARIABLE_TYPES(1:number_of_variables)=old_variable_types(1:number_of_variables)
13380  DO variable_idx=number_of_variables+1,field%NUMBER_OF_VARIABLES
13381  variable_type=old_variable_types(variable_idx)
13382  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)=""
13383  field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED(variable_type)=.false.
13384  field%CREATE_VALUES_CACHE%DIMENSION(variable_type)=0
13385  field%CREATE_VALUES_CACHE%DIMENSION_LOCKED(variable_type)=.false.
13386  field%CREATE_VALUES_CACHE%DATA_TYPES(variable_type)=0
13387  field%CREATE_VALUES_CACHE%DATA_TYPES_LOCKED(variable_type)=.false.
13388  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES(variable_type)=0
13389  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES_LOCKED(variable_type)=.false.
13390  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)=0
13391  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS_LOCKED(variable_type)=.false.
13392  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(:,variable_type)=0
13393  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED(:,variable_type)=.false.
13394  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(:,variable_type)=0
13395  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED(:,variable_type)=.false.
13396  ENDDO !variable_idx
13397  ELSE
13398  field%CREATE_VALUES_CACHE%VARIABLE_TYPES(1:field%NUMBER_OF_VARIABLES)= &
13399  & old_variable_types(1:field%NUMBER_OF_VARIABLES)
13400  DO variable_idx=field%NUMBER_OF_VARIABLES+1,number_of_variables
13401  !Find the next available variable type
13402  DO variable_type=1,field_number_of_variable_types
13403  found=.false.
13404  DO variable_idx2=1,field%NUMBER_OF_VARIABLES
13405  IF(field%CREATE_VALUES_CACHE%VARIABLE_TYPES(variable_idx2)==variable_type) THEN
13406  found=.true.
13407  EXIT
13408  ENDIF
13409  ENDDO !variable_idx2
13410  IF(.NOT.found) EXIT
13411  ENDDO !variable_type
13412  IF(found) THEN
13413  CALL flagerror("Could not find free variable type???",err,error,*999)
13414  ELSE
13415  field%CREATE_VALUES_CACHE%VARIABLE_TYPES(variable_idx)=variable_type
13416  SELECT CASE(variable_type)
13417  CASE(field_u_variable_type)
13418  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)="U"
13419  CASE(field_deludeln_variable_type)
13420  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)="del U/del n"
13421  CASE(field_deludelt_variable_type)
13422  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)="del U/del t"
13423  CASE(field_del2udelt2_variable_type)
13424  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)="del^2 U/del t^2"
13425  CASE(field_v_variable_type)
13426  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)="V"
13427  CASE(field_delvdeln_variable_type)
13428  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)="del V/del n"
13429  CASE DEFAULT
13430  local_error="The variable type of "//trim(number_to_vstring(variable_type,"*",err,error))//" is invalid."
13431  CALL flagerror(local_error,err,error,*999)
13432  END SELECT
13433  field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED(variable_type)=.false.
13434  field%CREATE_VALUES_CACHE%DIMENSION(variable_type)=field%CREATE_VALUES_CACHE%DIMENSION( &
13435  & old_variable_types(1))
13436  field%CREATE_VALUES_CACHE%DIMENSION_LOCKED(variable_type)=.false.
13437  field%CREATE_VALUES_CACHE%DATA_TYPES(variable_type)=field%CREATE_VALUES_CACHE%DATA_TYPES( &
13438  & old_variable_types(1))
13439  field%CREATE_VALUES_CACHE%DATA_TYPES_LOCKED(variable_type)=.false.
13440  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES(variable_type)=field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES( &
13441  & old_variable_types(1))
13442  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES_LOCKED(variable_type)=.false.
13443  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)=field%CREATE_VALUES_CACHE% &
13444  & number_of_components(old_variable_types(1))
13445  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS_LOCKED(variable_type)=.false.
13446  field%CREATE_VALUES_CACHE%COMPONENT_LABELS(:,variable_type)=field%CREATE_VALUES_CACHE% &
13447  component_labels(:,field%CREATE_VALUES_CACHE%VARIABLE_TYPES(old_variable_types(1)))
13448  field%CREATE_VALUES_CACHE%COMPONENT_LABELS_LOCKED(:,variable_type)=.false.
13449  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(:,variable_type)=field%CREATE_VALUES_CACHE% &
13450  interpolation_type(:,field%CREATE_VALUES_CACHE%VARIABLE_TYPES(old_variable_types(1)))
13451  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED(:,variable_type)=.false.
13452  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(:,variable_type)=field%CREATE_VALUES_CACHE% &
13453  mesh_component_number(:,field%CREATE_VALUES_CACHE%VARIABLE_TYPES(old_variable_types(1)))
13454  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED(:,variable_type)=.false.
13455  ENDIF
13456  ENDDO !variable_idx
13457  ENDIF
13458  DEALLOCATE(old_variable_types)
13459  field%NUMBER_OF_VARIABLES=number_of_variables
13460  ENDIF
13461  ELSE
13462  local_error="The specified number of variables of "//trim(number_to_vstring(number_of_variables,"*",err,error))// &
13463  & " is invalid. The number of variables must be between 1 and "// &
13464  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
13465  CALL flagerror(local_error,err,error,*999)
13466  ENDIF
13467  ENDIF
13468  ELSE
13469  local_error="Field create values cache is not associated for field number "// &
13470  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13471  CALL flagerror(local_error,err,error,*999)
13472  ENDIF
13473  ENDIF
13474  ELSE
13475  CALL flagerror("Field is not associated.",err,error,*999)
13476  ENDIF
13477 
13478  exits("FIELD_NUMBER_OF_VARIABLES_SET")
13479  RETURN
13480 999 IF(ALLOCATED(old_variable_types)) DEALLOCATE(old_variable_types)
13481  errorsexits("FIELD_NUMBER_OF_VARIABLES_SET",err,error)
13482  RETURN 1
13483  END SUBROUTINE field_number_of_variables_set
13484 
13485  !
13486  !================================================================================================================================
13487  !
13488 
13490  SUBROUTINE field_number_of_variables_set_and_lock(FIELD,NUMBER_OF_VARIABLES,ERR,ERROR,*)
13491 
13492  !Argument variables
13493  TYPE(field_type), POINTER :: field
13494  INTEGER(INTG), INTENT(IN) :: number_of_variables
13495  INTEGER(INTG), INTENT(OUT) :: err
13496  TYPE(varying_string), INTENT(OUT) :: error
13497  !Local Variables
13498  TYPE(varying_string) :: local_error
13499 
13500  enters("FIELD_NUMBER_OF_VARIABLES_SET_AND_LOCK",err,error,*999)
13501 
13502  CALL field_number_of_variables_set(field,number_of_variables,err,error,*999)
13503  IF(ASSOCIATED(field)) THEN
13504  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
13505  field%CREATE_VALUES_CACHE%NUMBER_OF_VARIABLES_LOCKED=.true.
13506 
13507  ELSE
13508  local_error="Field create values cache is not associated for field number "// &
13509  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13510  CALL flagerror(local_error,err,error,*999)
13511  ENDIF
13512  ELSE
13513  CALL flagerror("Field is not associated.",err,error,*999)
13514  ENDIF
13515 
13516  exits("FIELD_NUMBER_OF_VARIABLES_SET_AND_LOCK")
13517  RETURN
13518 999 errorsexits("FIELD_NUMBER_OF_VARIABLES_SET_AND_LOCK",err,error)
13519  RETURN 1
13520  END SUBROUTINE field_number_of_variables_set_and_lock
13521 
13522  !
13523  !================================================================================================================================
13524  !
13525 
13527  SUBROUTINE field_parameter_sets_add_dp(FIELD,VARIABLE_TYPE,ALPHA,FIELD_FROM_SET_TYPE,FIELD_TO_SET_TYPE,ERR,ERROR,*)
13528 
13529  !Argument variables
13530  TYPE(field_type), POINTER :: field
13531  INTEGER(INTG), INTENT(IN) :: variable_type
13532  REAL(DP), INTENT(IN) :: alpha(:)
13533  INTEGER(INTG), INTENT(IN) :: field_from_set_type(:)
13534  INTEGER(INTG), INTENT(IN) :: field_to_set_type
13535  INTEGER(INTG), INTENT(OUT) :: err
13536  TYPE(varying_string), INTENT(OUT) :: error
13537  !Local Variables
13538  INTEGER(INTG) :: dof_idx,parameter_set_idx
13539  REAL(DP) :: value
13540  TYPE(real_dp_ptr_type) :: field_from_parameters(size(field_from_set_type,1))
13541  TYPE(field_parameter_set_type), POINTER :: field_from_parameter_set,field_to_parameter_set
13542  TYPE(field_parameter_set_ptr_type) :: field_from_parameter_sets(size(field_from_set_type,1))
13543  TYPE(field_variable_type), POINTER :: field_variable
13544  TYPE(varying_string) :: local_error
13545 
13546  enters("FIELD_PARAMETER_SETS_ADD_DP",err,error,*999)
13547 
13548  IF(ASSOCIATED(field)) THEN
13549  IF(field%FIELD_FINISHED) THEN
13550  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
13551  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
13552  IF(ASSOCIATED(field_variable)) THEN
13553  !Check the to set type input
13554  IF(field_to_set_type>0.AND.field_to_set_type<field_number_of_set_types) THEN
13555  field_to_parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_to_set_type)%PTR
13556  IF(ASSOCIATED(field_to_parameter_set)) THEN
13557  IF(SIZE(alpha,1)==SIZE(field_from_set_type,1)) THEN
13558  DO parameter_set_idx=1,SIZE(field_from_set_type,1)
13559  IF(field_from_set_type(parameter_set_idx)>0.AND. &
13560  & field_from_set_type(parameter_set_idx)<field_number_of_set_types) THEN
13561  field_from_parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_from_set_type( &
13562  & parameter_set_idx))%PTR
13563  IF(ASSOCIATED(field_to_parameter_set)) THEN
13564  field_from_parameter_sets(parameter_set_idx)%PTR=>field_from_parameter_set
13565  NULLIFY(field_from_parameters(parameter_set_idx)%PTR)
13566  CALL distributed_vector_data_get(field_from_parameter_sets(parameter_set_idx)%PTR%PARAMETERS, &
13567  & field_from_parameters(parameter_set_idx)%PTR,err,error,*999)
13568  ELSE
13569  local_error="The field from set type of "// &
13570  & trim(number_to_vstring(field_from_set_type(parameter_set_idx),"*",err,error))// &
13571  & " in parameter set index "//trim(number_to_vstring(parameter_set_idx,"*",err,error))// &
13572  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
13573  & "."
13574  CALL flagerror(local_error,err,error,*999)
13575  ENDIF
13576  ELSE
13577  local_error="The field from set type of "// &
13578  & trim(number_to_vstring(field_from_set_type(parameter_set_idx),"*",err,error))// &
13579  & " for parameter set index "//trim(number_to_vstring(parameter_set_idx,"*",err,error))// &
13580  & " is invalid. The field parameter set type must be between 1 and "// &
13581  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
13582  CALL flagerror(local_error,err,error,*999)
13583  ENDIF
13584  ENDDO !parameter_set_idx
13585  !Do not need to do an update here as each rank already has the values.
13586  !Add the field dofs
13587  DO dof_idx=1,field_variable%TOTAL_NUMBER_OF_DOFS
13588  VALUE=0.0_dp
13589  DO parameter_set_idx=1,SIZE(field_from_set_type,1)
13590  VALUE=VALUE+alpha(parameter_set_idx)*field_from_parameters(parameter_set_idx)%PTR(dof_idx)
13591  ENDDO !parameter_set_idx
13592  CALL distributed_vector_values_add(field_to_parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
13593  ENDDO !dof_idx
13594  !Restore the from parameter set transfer
13595  DO parameter_set_idx=1,SIZE(field_from_set_type,1)
13596  CALL distributed_vector_data_restore(field_from_parameter_sets(parameter_set_idx)%PTR%PARAMETERS, &
13597  & field_from_parameters(parameter_set_idx)%PTR,err,error,*999)
13598  ENDDO !parameter_set_idx
13599  ELSE
13600  local_error="The size of the alpha array ("//trim(number_to_vstring(SIZE(alpha,1),"*",err,error))// &
13601  & ") does not match the size of the from set type array ("// &
13602  & trim(number_to_vstring(SIZE(field_from_set_type,1),"*",err,error))//"."
13603  ENDIF
13604  ELSE
13605  local_error="The field to set type of "//trim(number_to_vstring(field_to_set_type,"*",err,error))// &
13606  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13607  CALL flagerror(local_error,err,error,*999)
13608  ENDIF
13609  ELSE
13610  local_error="The field to set type of "//trim(number_to_vstring(field_to_set_type,"*",err,error))// &
13611  & " is invalid. The field parameter set type must be between 1 and "// &
13612  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
13613  CALL flagerror(local_error,err,error,*999)
13614  ENDIF
13615  ELSE
13616  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
13617  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13618  CALL flagerror(local_error,err,error,*999)
13619  ENDIF
13620  ELSE
13621  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
13622  & " is invalid. The variable type must be between 1 and "// &
13623  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
13624  CALL flagerror(local_error,err,error,*999)
13625  ENDIF
13626  ELSE
13627  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
13628  CALL flagerror(local_error,err,error,*999)
13629  ENDIF
13630  ELSE
13631  CALL flagerror("Field is not associated.",err,error,*999)
13632  ENDIF
13633 
13634  exits("FIELD_PARAMETER_SETS_ADD_DP")
13635 
13636  RETURN
13637 999 errorsexits("FIELD_PARAMETER_SETS_ADD_DP",err,error)
13638  RETURN 1
13639  END SUBROUTINE field_parameter_sets_add_dp
13640 
13641  !
13642  !================================================================================================================================
13643  !
13644 
13646  SUBROUTINE field_parameter_sets_add_dp1(FIELD,VARIABLE_TYPE,ALPHA,FIELD_FROM_SET_TYPE,FIELD_TO_SET_TYPE,ERR,ERROR,*)
13647 
13648  !Argument variables
13649  TYPE(field_type), POINTER :: field
13650  INTEGER(INTG), INTENT(IN) :: variable_type
13651  REAL(DP), INTENT(IN) :: alpha
13652  INTEGER(INTG), INTENT(IN) :: field_from_set_type
13653  INTEGER(INTG), INTENT(IN) :: field_to_set_type
13654  INTEGER(INTG), INTENT(OUT) :: err
13655  TYPE(varying_string), INTENT(OUT) :: error
13656  !Local Variables
13657 
13658  enters("FIELD_PARAMETER_SETS_ADD_DP1",err,error,*999)
13659 
13660  CALL field_parameter_sets_add_dp(field,variable_type,[alpha],[field_from_set_type],field_to_set_type,err,error,*999)
13661 
13662  exits("FIELD_PARAMETER_SETS_ADD_DP1")
13663  RETURN
13664 999 errorsexits("FIELD_PARAMETER_SETS_ADD_DP1",err,error)
13665  RETURN 1
13666  END SUBROUTINE field_parameter_sets_add_dp1
13667 
13668  !
13669  !================================================================================================================================
13670  !
13671 
13673  SUBROUTINE field_parameter_sets_copy(FIELD,VARIABLE_TYPE,FIELD_FROM_SET_TYPE,FIELD_TO_SET_TYPE,ALPHA,ERR,ERROR,*)
13674 
13675  !Argument variables
13676  TYPE(field_type), POINTER :: field
13677  INTEGER(INTG), INTENT(IN) :: variable_type
13678  INTEGER(INTG), INTENT(IN) :: field_from_set_type
13679  INTEGER(INTG), INTENT(IN) :: field_to_set_type
13680  REAL(DP), INTENT(IN) :: alpha
13681  INTEGER(INTG), INTENT(OUT) :: err
13682  TYPE(varying_string), INTENT(OUT) :: error
13683  !Local Variables
13684  TYPE(field_parameter_set_type), POINTER :: field_from_parameter_set,field_to_parameter_set
13685  TYPE(field_variable_type), POINTER :: field_variable
13686  TYPE(varying_string) :: local_error
13687 
13688  enters("FIELD_PARAMETER_SETS_COPY",err,error,*999)
13689 
13690  IF(ASSOCIATED(field)) THEN
13691  IF(field%FIELD_FINISHED) THEN
13692  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
13693  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
13694  IF(ASSOCIATED(field_variable)) THEN
13695  !Check the from set type input
13696  IF(field_from_set_type>0.AND.field_from_set_type<field_number_of_set_types) THEN
13697  field_from_parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_from_set_type)%PTR
13698  IF(ASSOCIATED(field_from_parameter_set)) THEN
13699  !Check the from set type input
13700  IF(field_to_set_type>0.AND.field_to_set_type<field_number_of_set_types) THEN
13701  field_to_parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_to_set_type)%PTR
13702  !Do not need to do an update here as each rank already has the values.
13703  IF(ASSOCIATED(field_to_parameter_set)) THEN
13704  CALL distributed_vector_copy(field_from_parameter_set%PARAMETERS,field_to_parameter_set%PARAMETERS, &
13705  & alpha,err,error,*999)
13706  ELSE
13707  ! CHECK what needs to be done here: LagrangeMultipliersField does not have SET_TYPE==PREVIOUS_VALUES
13708  IF(ASSOCIATED(field%INTERFACE)) THEN
13709  !OK if LagrangeMultipliersField?
13710  ELSE
13711  local_error="The field to set type of "//trim(number_to_vstring(field_to_set_type,"*",err,error))// &
13712  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13713  CALL flagerror(local_error,err,error,*999)
13714  ENDIF
13715  ENDIF
13716  ELSE
13717  local_error="The field to set type of "//trim(number_to_vstring(field_to_set_type,"*",err,error))// &
13718  & " is invalid. The field parameter set type must be between 1 and "// &
13719  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
13720  CALL flagerror(local_error,err,error,*999)
13721  ENDIF
13722  ELSE
13723  local_error="The field from set type of "//trim(number_to_vstring(field_from_set_type,"*",err,error))// &
13724  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13725  CALL flagerror(local_error,err,error,*999)
13726  ENDIF
13727  ELSE
13728  local_error="The field from set type of "//trim(number_to_vstring(field_from_set_type,"*",err,error))// &
13729  & " is invalid. The field parameter set type must be between 1 and "// &
13730  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
13731  CALL flagerror(local_error,err,error,*999)
13732  ENDIF
13733  ELSE
13734  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
13735  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
13736  CALL flagerror(local_error,err,error,*999)
13737  ENDIF
13738  ELSE
13739  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
13740  & " is invalid. The variable type must be between 1 and "// &
13741  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
13742  CALL flagerror(local_error,err,error,*999)
13743  ENDIF
13744  ELSE
13745  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
13746  CALL flagerror(local_error,err,error,*999)
13747  ENDIF
13748  ELSE
13749  CALL flagerror("Field is not associated.",err,error,*999)
13750  ENDIF
13751 
13752  exits("FIELD_PARAMETER_SETS_COPY")
13753  RETURN
13754 999 errorsexits("FIELD_PARAMETER_SETS_COPY",err,error)
13755  RETURN 1
13756 
13757  END SUBROUTINE field_parameter_sets_copy
13758 
13759  !
13760  !================================================================================================================================
13761  !
13762 
13765  SUBROUTINE field_parameterstofieldparameterscopy(FROM_FIELD,FROM_VARIABLE_TYPE,FROM_PARAMETER_SET_TYPE, &
13766  & from_component_number,to_field,to_variable_type,to_parameter_set_type,to_component_number,err,error,*)
13767 
13768  !Argument variables
13769  TYPE(field_type), POINTER :: from_field
13770  INTEGER(INTG), INTENT(IN) :: from_variable_type
13771  INTEGER(INTG), INTENT(IN) :: from_parameter_set_type
13772  INTEGER(INTG), INTENT(IN) :: from_component_number
13773  TYPE(field_type), POINTER :: to_field
13774  INTEGER(INTG), INTENT(IN) :: to_variable_type
13775  INTEGER(INTG), INTENT(IN) :: to_parameter_set_type
13776  INTEGER(INTG), INTENT(IN) :: to_component_number
13777  INTEGER(INTG), INTENT(OUT) :: err
13778  TYPE(varying_string), INTENT(OUT) :: error
13779  !Local Variables
13780  INTEGER(INTG) :: elem_idx,deriv_idx,version_idx,local_ny,node_idx,value_intg,gausspoint_idx
13781  INTEGER(INTG), POINTER :: from_parameter_data_intg(:)
13782  REAL(SP) :: value_sp
13783  REAL(SP), POINTER :: from_parameter_data_sp(:)
13784  REAL(DP) :: value_dp
13785  REAL(DP), POINTER :: from_parameter_data_dp(:)
13786  LOGICAL :: value_l
13787  LOGICAL, POINTER :: from_parameter_data_l(:)
13788  TYPE(domain_type), POINTER :: from_domain,to_domain
13789  TYPE(domain_elements_type), POINTER :: from_domain_elements
13790  TYPE(domain_nodes_type), POINTER :: from_domain_nodes
13791  TYPE(domain_topology_type), POINTER :: from_domain_topology
13792  TYPE(field_variable_type), POINTER :: from_field_variable,to_field_variable
13793  TYPE(varying_string) :: local_error
13794 
13795  NULLIFY(from_parameter_data_intg)
13796  NULLIFY(from_parameter_data_sp)
13797  NULLIFY(from_parameter_data_dp)
13798  NULLIFY(from_parameter_data_l)
13799 
13800  enters("Field_ParametersToFieldParametersCopy",err,error,*999)
13801 
13802  IF(ASSOCIATED(from_field)) THEN
13803  IF(from_field%FIELD_FINISHED) THEN
13804  IF(from_variable_type>0.AND.from_variable_type<=field_number_of_variable_types) THEN
13805  from_field_variable=>from_field%VARIABLE_TYPE_MAP(from_variable_type)%PTR
13806  IF(ASSOCIATED(from_field_variable)) THEN
13807  IF(from_component_number>=1.AND.from_component_number<=from_field_variable%NUMBER_OF_COMPONENTS) THEN
13808  IF(ASSOCIATED(to_field)) THEN
13809  IF(to_field%FIELD_FINISHED) THEN
13810  IF(to_variable_type>0.AND.to_variable_type<=field_number_of_variable_types) THEN
13811  to_field_variable=>to_field%VARIABLE_TYPE_MAP(to_variable_type)%PTR
13812  IF(ASSOCIATED(to_field_variable)) THEN
13813  IF(to_component_number>=1.AND.to_component_number<=to_field_variable%NUMBER_OF_COMPONENTS) THEN
13814  from_domain=>from_field_variable%COMPONENTS(from_component_number)%DOMAIN
13815  to_domain=>to_field_variable%COMPONENTS(to_component_number)%DOMAIN
13816  IF(ASSOCIATED(from_domain)) THEN
13817  IF(ASSOCIATED(from_domain,to_domain)) THEN
13818  IF(from_field_variable%COMPONENTS(from_component_number)%INTERPOLATION_TYPE== &
13819  & to_field_variable%COMPONENTS(to_component_number)%INTERPOLATION_TYPE) THEN
13820  IF(from_field_variable%DATA_TYPE==to_field_variable%DATA_TYPE) THEN
13821  SELECT CASE(from_field_variable%COMPONENTS(from_component_number)%INTERPOLATION_TYPE)
13822  CASE(field_constant_interpolation)
13823  SELECT CASE(from_field_variable%DATA_TYPE)
13824  CASE(field_intg_type)
13825  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13826  & from_parameter_data_intg,err,error,*999)
13827  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13828  & constant_param2dof_map
13829  value_intg=from_parameter_data_intg(local_ny)
13830  CALL field_parameter_set_update_constant(to_field,to_variable_type,to_parameter_set_type, &
13831  & to_component_number,value_intg,err,error,*999)
13832  CALL field_parameter_set_data_restore(from_field,from_variable_type,from_parameter_set_type, &
13833  & from_parameter_data_intg,err,error,*999)
13834  CASE(field_sp_type)
13835  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13836  & from_parameter_data_sp,err,error,*999)
13837  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13838  & constant_param2dof_map
13839  value_sp=from_parameter_data_sp(local_ny)
13840  CALL field_parameter_set_update_constant(to_field,to_variable_type,to_parameter_set_type, &
13841  & to_component_number,value_sp,err,error,*999)
13842  CALL field_parameter_set_data_restore(from_field,from_variable_type,from_parameter_set_type, &
13843  & from_parameter_data_sp,err,error,*999)
13844  CASE(field_dp_type)
13845  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13846  & from_parameter_data_dp,err,error,*999)
13847  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13848  & constant_param2dof_map
13849  value_dp=from_parameter_data_dp(local_ny)
13850  CALL field_parameter_set_update_constant(to_field,to_variable_type,to_parameter_set_type, &
13851  & to_component_number,value_dp,err,error,*999)
13852  CALL field_parameter_set_data_restore(from_field,from_variable_type,from_parameter_set_type, &
13853  & from_parameter_data_dp,err,error,*999)
13854  CASE(field_l_type)
13855  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13856  & from_parameter_data_l,err,error,*999)
13857  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13858  & constant_param2dof_map
13859  value_l=from_parameter_data_l(local_ny)
13860  CALL field_parameter_set_update_constant(to_field,to_variable_type,to_parameter_set_type, &
13861  & to_component_number,value_l,err,error,*999)
13862  CALL field_parameter_set_data_restore(from_field,from_variable_type,from_parameter_set_type, &
13863  & from_parameter_data_l,err,error,*999)
13864  CASE DEFAULT
13865  local_error="The from field variable data type of "// &
13866  & trim(number_to_vstring(from_field_variable%DATA_TYPE,"*",err,error))// &
13867  & " is invalid."
13868  CALL flagerror(local_error,err,error,*999)
13869  END SELECT
13870  CASE(field_element_based_interpolation)
13871  from_domain_topology=>from_domain%TOPOLOGY
13872  IF(ASSOCIATED(from_domain_topology)) THEN
13873  from_domain_elements=>from_domain_topology%ELEMENTS
13874  IF(ASSOCIATED(from_domain_elements)) THEN
13875  SELECT CASE(from_field_variable%DATA_TYPE)
13876  CASE(field_intg_type)
13877  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13878  & from_parameter_data_intg,err,error,*999)
13879  DO elem_idx=1,from_domain_elements%TOTAL_NUMBER_OF_ELEMENTS
13880  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13881  & element_param2dof_map%ELEMENTS(elem_idx)
13882  value_intg=from_parameter_data_intg(local_ny)
13883  CALL field_parameter_set_update_local_element(to_field,to_variable_type, &
13884  & to_parameter_set_type,elem_idx,to_component_number,value_intg,err,error,*999)
13885  ENDDO !elem_idx
13886  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
13887  & from_parameter_set_type,from_parameter_data_intg,err,error,*999)
13888  CASE(field_sp_type)
13889  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13890  & from_parameter_data_sp,err,error,*999)
13891  DO elem_idx=1,from_domain_elements%TOTAL_NUMBER_OF_ELEMENTS
13892  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13893  & element_param2dof_map%ELEMENTS(elem_idx)
13894  value_sp=from_parameter_data_sp(local_ny)
13895  CALL field_parameter_set_update_local_element(to_field,to_variable_type, &
13896  & to_parameter_set_type,elem_idx,to_component_number,value_sp,err,error,*999)
13897  ENDDO !elem_idx
13898  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
13899  & from_parameter_set_type,from_parameter_data_sp,err,error,*999)
13900  CASE(field_dp_type)
13901  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13902  & from_parameter_data_dp,err,error,*999)
13903  DO elem_idx=1,from_domain_elements%TOTAL_NUMBER_OF_ELEMENTS
13904  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13905  & element_param2dof_map%ELEMENTS(elem_idx)
13906  value_dp=from_parameter_data_dp(local_ny)
13907  CALL field_parameter_set_update_local_element(to_field,to_variable_type, &
13908 
13909  & to_parameter_set_type,elem_idx,to_component_number,value_dp,err,error,*999)
13910  ENDDO !elem_idx
13911  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
13912  & from_parameter_set_type,from_parameter_data_dp,err,error,*999)
13913  CASE(field_l_type)
13914  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13915  & from_parameter_data_l,err,error,*999)
13916  DO elem_idx=1,from_domain_elements%TOTAL_NUMBER_OF_ELEMENTS
13917  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13918  & element_param2dof_map%ELEMENTS(elem_idx)
13919  value_l=from_parameter_data_l(local_ny)
13920  CALL field_parameter_set_update_local_element(to_field,to_variable_type, &
13921  & to_parameter_set_type,elem_idx,to_component_number,value_l,err,error,*999)
13922  ENDDO !elem_idx
13923  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
13924  & from_parameter_set_type,from_parameter_data_l,err,error,*999)
13925  CASE DEFAULT
13926  local_error="The from field variable data type of "// &
13927  & trim(number_to_vstring(from_field_variable%DATA_TYPE,"*",err,error))// &
13928  & " is invalid."
13929  CALL flagerror(local_error,err,error,*999)
13930  END SELECT
13931  ELSE
13932  CALL flagerror("From domain topology elements is not associated.",err,error,*999)
13933  ENDIF
13934  ELSE
13935  CALL flagerror("From domain topology is not associated.",err,error,*999)
13936  ENDIF
13937  CASE(field_node_based_interpolation)
13938  from_domain_topology=>from_domain%TOPOLOGY
13939  IF(ASSOCIATED(from_domain_topology)) THEN
13940  from_domain_nodes=>from_domain_topology%NODES
13941  IF(ASSOCIATED(from_domain_nodes)) THEN
13942  SELECT CASE(from_field_variable%DATA_TYPE)
13943  CASE(field_intg_type)
13944  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13945  & from_parameter_data_intg,err,error,*999)
13946  DO node_idx=1,from_domain_nodes%TOTAL_NUMBER_OF_NODES
13947  DO deriv_idx=1,from_domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
13948  DO version_idx=1,from_domain_nodes%NODES(node_idx)%DERIVATIVES(deriv_idx)% &
13949  & numberofversions
13950  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13951  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(deriv_idx)%VERSIONS(version_idx)
13952  value_intg=from_parameter_data_intg(local_ny)
13953  CALL field_parameter_set_update_local_node(to_field,to_variable_type, &
13954  & to_parameter_set_type,version_idx,deriv_idx,node_idx,to_component_number, &
13955  & value_intg,err,error,*999)
13956  ENDDO !version_idx
13957  ENDDO !deriv_idx
13958  ENDDO !node_idx
13959  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
13960  & from_parameter_set_type,from_parameter_data_intg,err,error,*999)
13961  CASE(field_sp_type)
13962  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13963  & from_parameter_data_sp,err,error,*999)
13964  DO node_idx=1,from_domain_nodes%TOTAL_NUMBER_OF_NODES
13965  DO deriv_idx=1,from_domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
13966  DO version_idx=1,from_domain_nodes%NODES(node_idx)%DERIVATIVES(deriv_idx)% &
13967  & numberofversions
13968  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13969  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(deriv_idx)%VERSIONS(version_idx)
13970  value_sp=from_parameter_data_sp(local_ny)
13971  CALL field_parameter_set_update_local_node(to_field,to_variable_type, &
13972  & to_parameter_set_type,version_idx,deriv_idx,node_idx,to_component_number, &
13973  & value_sp,err,error,*999)
13974  ENDDO !version_idx
13975  ENDDO !deriv_idx
13976  ENDDO !node_idx
13977  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
13978  & from_parameter_set_type,from_parameter_data_sp,err,error,*999)
13979  CASE(field_dp_type)
13980  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13981  & from_parameter_data_dp,err,error,*999)
13982  DO node_idx=1,from_domain_nodes%TOTAL_NUMBER_OF_NODES
13983  DO deriv_idx=1,from_domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
13984  DO version_idx=1,from_domain_nodes%NODES(node_idx)%DERIVATIVES(deriv_idx)% &
13985  & numberofversions
13986  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
13987  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(deriv_idx)%VERSIONS(version_idx)
13988  value_dp=from_parameter_data_dp(local_ny)
13989  CALL field_parameter_set_update_local_node(to_field,to_variable_type, &
13990  & to_parameter_set_type,version_idx,deriv_idx,node_idx,to_component_number, &
13991  & value_dp,err,error,*999)
13992  ENDDO !version_idx
13993  ENDDO !deriv_idx
13994  ENDDO !node_idx
13995  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
13996  & from_parameter_set_type,from_parameter_data_dp,err,error,*999)
13997  CASE(field_l_type)
13998  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
13999  & from_parameter_data_l,err,error,*999)
14000  DO node_idx=1,from_domain_nodes%TOTAL_NUMBER_OF_NODES
14001  DO deriv_idx=1,from_domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
14002  DO version_idx=1,from_domain_nodes%NODES(node_idx)%DERIVATIVES(deriv_idx)% &
14003  & numberofversions
14004  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
14005  & node_param2dof_map%NODES(node_idx)%DERIVATIVES(deriv_idx)%VERSIONS(version_idx)
14006  value_l=from_parameter_data_l(local_ny)
14007  CALL field_parameter_set_update_local_node(to_field,to_variable_type, &
14008  & to_parameter_set_type,version_idx,deriv_idx,node_idx,to_component_number, &
14009  & value_l,err,error,*999)
14010  ENDDO !version_idx
14011  ENDDO !deriv_idx
14012  ENDDO !node_idx
14013  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
14014  & from_parameter_set_type,from_parameter_data_l,err,error,*999)
14015  CASE DEFAULT
14016  local_error="The from field variable data type of "// &
14017  & trim(number_to_vstring(from_field_variable%DATA_TYPE,"*",err,error))// &
14018  & " is invalid."
14019  CALL flagerror(local_error,err,error,*999)
14020  END SELECT
14021  ELSE
14022  CALL flagerror("From domain topology nodes is not associated.",err,error,*999)
14023  ENDIF
14024  ELSE
14025  CALL flagerror("From domain topology is not associated.",err,error,*999)
14026  ENDIF
14027  CASE(field_grid_point_based_interpolation)
14028  CALL flagerror("Not implmented.",err,error,*999)
14029  CASE(field_gauss_point_based_interpolation)
14030  ! gp based.
14031  from_domain_topology=>from_domain%TOPOLOGY
14032  IF(ASSOCIATED(from_domain_topology)) THEN
14033  from_domain_elements=>from_domain_topology%ELEMENTS
14034  IF(ASSOCIATED(from_domain_elements)) THEN
14035  SELECT CASE(from_field_variable%DATA_TYPE)
14036  CASE(field_intg_type)
14037  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
14038  & from_parameter_data_intg,err,error,*999)
14039  DO elem_idx=1,from_domain_elements%TOTAL_NUMBER_OF_ELEMENTS
14040  DO gausspoint_idx=1,size(from_field_variable%COMPONENTS(from_component_number)% &
14041  & param_to_dof_map%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)
14042  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
14043  & gauss_point_param2dof_map%GAUSS_POINTS(gausspoint_idx,elem_idx)
14044  value_intg=from_parameter_data_intg(local_ny)
14045  local_ny=to_field%VARIABLE_TYPE_MAP(to_variable_type)%PTR%&
14046  &components(to_component_number)%PARAM_TO_DOF_MAP% &
14047  & gauss_point_param2dof_map%GAUSS_POINTS(gausspoint_idx,elem_idx)
14048  CALL distributed_vector_values_set(to_field%VARIABLE_TYPE_MAP(to_variable_type)%PTR%&
14049  & parameter_sets%SET_TYPE(to_parameter_set_type)%PTR%PARAMETERS,local_ny,value_intg,&
14050  & err,error,*999)
14051  ENDDO !gausspoint_idx
14052  ENDDO !elem_idx
14053  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
14054  & from_parameter_set_type,from_parameter_data_intg,err,error,*999)
14055  CASE(field_sp_type)
14056  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
14057  & from_parameter_data_sp,err,error,*999)
14058  DO elem_idx=1,from_domain_elements%TOTAL_NUMBER_OF_ELEMENTS
14059  DO gausspoint_idx=1,size(from_field_variable%COMPONENTS(from_component_number)% &
14060  & param_to_dof_map%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)
14061  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
14062  & gauss_point_param2dof_map%GAUSS_POINTS(gausspoint_idx,elem_idx)
14063  value_sp=from_parameter_data_sp(local_ny)
14064  local_ny=to_field%VARIABLE_TYPE_MAP(to_variable_type)%PTR%&
14065  &components(to_component_number)%PARAM_TO_DOF_MAP% &
14066  & gauss_point_param2dof_map%GAUSS_POINTS(gausspoint_idx,elem_idx)
14067  CALL distributed_vector_values_set(to_field%VARIABLE_TYPE_MAP(to_variable_type)%PTR%&
14068  & parameter_sets%SET_TYPE(to_parameter_set_type)%PTR%PARAMETERS,local_ny,value_sp,&
14069  & err,error,*999)
14070  ENDDO !gausspoint_idx
14071  ENDDO !elem_idx
14072  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
14073  & from_parameter_set_type,from_parameter_data_sp,err,error,*999)
14074  CASE(field_dp_type)
14075  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
14076  & from_parameter_data_dp,err,error,*999)
14077  DO elem_idx=1,from_domain_elements%TOTAL_NUMBER_OF_ELEMENTS
14078  DO gausspoint_idx=1,size(from_field_variable%COMPONENTS(from_component_number)% &
14079  & param_to_dof_map%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)
14080  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
14081  & gauss_point_param2dof_map%GAUSS_POINTS(gausspoint_idx,elem_idx)
14082  value_dp=from_parameter_data_dp(local_ny)
14083  local_ny=to_field%VARIABLE_TYPE_MAP(to_variable_type)%PTR%&
14084  &components(to_component_number)%PARAM_TO_DOF_MAP% &
14085  & gauss_point_param2dof_map%GAUSS_POINTS(gausspoint_idx,elem_idx)
14086  CALL distributed_vector_values_set(to_field%VARIABLE_TYPE_MAP(to_variable_type)%PTR%&
14087  & parameter_sets%SET_TYPE(to_parameter_set_type)%PTR%PARAMETERS,local_ny,value_dp,&
14088  & err,error,*999)
14089  ENDDO !gausspoint_idx
14090  ENDDO !elem_idx
14091  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
14092  & from_parameter_set_type,from_parameter_data_dp,err,error,*999)
14093  CASE(field_l_type)
14094  CALL field_parameter_set_data_get(from_field,from_variable_type,from_parameter_set_type, &
14095  & from_parameter_data_l,err,error,*999)
14096  DO elem_idx=1,from_domain_elements%TOTAL_NUMBER_OF_ELEMENTS
14097  DO gausspoint_idx=1,size(from_field_variable%COMPONENTS(from_component_number)% &
14098  & param_to_dof_map%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)
14099  local_ny=from_field_variable%COMPONENTS(from_component_number)%PARAM_TO_DOF_MAP% &
14100  & gauss_point_param2dof_map%GAUSS_POINTS(gausspoint_idx,elem_idx)
14101  value_l=from_parameter_data_l(local_ny)
14102  local_ny=to_field%VARIABLE_TYPE_MAP(to_variable_type)%PTR%&
14103  &components(to_component_number)%PARAM_TO_DOF_MAP% &
14104  & gauss_point_param2dof_map%GAUSS_POINTS(gausspoint_idx,elem_idx)
14105  CALL distributed_vector_values_set(to_field%VARIABLE_TYPE_MAP(to_variable_type)%PTR%&
14106  & parameter_sets%SET_TYPE(to_parameter_set_type)%PTR%PARAMETERS,local_ny,value_l,&
14107  & err,error,*999)
14108  ENDDO !gausspoint_idx
14109  ENDDO !elem_idx
14110  CALL field_parameter_set_data_restore(from_field,from_variable_type, &
14111  & from_parameter_set_type,from_parameter_data_l,err,error,*999)
14112  CASE DEFAULT
14113  CALL flagerror("Invalid data type or not implemented.",err,error,*999)
14114  END SELECT
14115  ELSE
14116  CALL flagerror("From domain topology elements is not associated.",err,error,*999)
14117  ENDIF
14118  ELSE
14119  CALL flagerror("From domain topology is not associated.",err,error,*999)
14120  ENDIF
14121  ! / gp based
14122  CASE(field_data_point_based_interpolation)
14123  CALL flagerror("Not implemented.",err,error,*999)
14124  CASE DEFAULT
14125  local_error="The from field variable component interpolation type of "// &
14126  & trim(number_to_vstring(from_field_variable%COMPONENTS(from_component_number)% &
14127  & interpolation_type,"*",err,error))//" is invalid."
14128  CALL flagerror(local_error,err,error,*999)
14129  END SELECT
14130  ELSE
14131  local_error="The from field variable data type of "// &
14132  & trim(number_to_vstring(from_field_variable%DATA_TYPE,"*",err,error))// &
14133  & " does not match the to variable data type of "// &
14134  & trim(number_to_vstring(to_field_variable%DATA_TYPE,"*",err,error))//"."
14135  CALL flagerror(local_error,err,error,*999)
14136  ENDIF
14137  ELSE
14138  local_error="The from field variable component interpolation type of "// &
14139  & trim(number_to_vstring(from_field_variable%COMPONENTS(from_component_number)% &
14140  & interpolation_type,"*",err,error))// &
14141  & " does not match the to variable component interpolation type of "// &
14142  & trim(number_to_vstring(to_field_variable%COMPONENTS(to_component_number)% &
14143  & interpolation_type,"*",err,error))//"."
14144  CALL flagerror(local_error,err,error,*999)
14145  ENDIF
14146  ELSE
14147  CALL flagerror("The from field variable component domain is not associated with the "// &
14148  & "to field variable component domain.",err,error,*999)
14149  ENDIF
14150  ELSE
14151  CALL flagerror("The from variable component domain is not associated.",err,error,*999)
14152  ENDIF
14153  ELSE
14154  local_error="To component number "//trim(number_to_vstring(to_component_number,"*",err,error))// &
14155  & " is invalid for to variable type "//trim(number_to_vstring(to_variable_type,"*",err,error))// &
14156  & " of field number "//trim(number_to_vstring(to_field%USER_NUMBER,"*",err,error))//" which has "// &
14157  & trim(number_to_vstring(to_field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
14158  & " components."
14159  CALL flagerror(local_error,err,error,*999)
14160  ENDIF
14161  ELSE
14162  local_error="The to field variable type of "//trim(number_to_vstring(to_variable_type,"*",err,error))// &
14163  & " has not been created on field number "//trim(number_to_vstring(to_field%USER_NUMBER,"*",err,error))//"."
14164  CALL flagerror(local_error,err,error,*999)
14165  ENDIF
14166  ELSE
14167  local_error="The to field variable type of "//trim(number_to_vstring(to_variable_type,"*",err,error))// &
14168  & " is invalid. The variable type must be between 1 and "// &
14169  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
14170  CALL flagerror(local_error,err,error,*999)
14171  ENDIF
14172  ELSE
14173  local_error="To field number "//trim(number_to_vstring(to_field%USER_NUMBER,"*",err,error))// &
14174  & " has not been finished."
14175  CALL flagerror(local_error,err,error,*999)
14176  ENDIF
14177  ELSE
14178  CALL flagerror("The to field is not associated.",err,error,*999)
14179  ENDIF
14180  ELSE
14181  local_error="From component number "//trim(number_to_vstring(from_component_number,"*",err,error))// &
14182  & " is invalid for from variable type "//trim(number_to_vstring(from_variable_type,"*",err,error))// &
14183  & " of field number "//trim(number_to_vstring(from_field%USER_NUMBER,"*",err,error))//" which has "// &
14184  & trim(number_to_vstring(from_field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
14185  & " components."
14186  CALL flagerror(local_error,err,error,*999)
14187  ENDIF
14188  ELSE
14189  local_error="The from field variable type of "//trim(number_to_vstring(from_variable_type,"*",err,error))// &
14190  & " has not been created on field number "//trim(number_to_vstring(from_field%USER_NUMBER,"*",err,error))//"."
14191  CALL flagerror(local_error,err,error,*999)
14192  ENDIF
14193  ELSE
14194  local_error="The from field variable type of "//trim(number_to_vstring(from_variable_type,"*",err,error))// &
14195  & " is invalid. The variable type must be between 1 and "// &
14196  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
14197  CALL flagerror(local_error,err,error,*999)
14198  ENDIF
14199  ELSE
14200  local_error="From field number "//trim(number_to_vstring(from_field%USER_NUMBER,"*",err,error))// &
14201  & " has not been finished."
14202  CALL flagerror(local_error,err,error,*999)
14203  ENDIF
14204  ELSE
14205  CALL flagerror("The from field is not associated.",err,error,*999)
14206  ENDIF
14207 
14208  exits("Field_ParametersToFieldParametersCopy")
14209  RETURN
14210 999 errorsexits("Field_ParametersToFieldParametersCopy",err,error)
14211  RETURN 1
14212 
14213  END SUBROUTINE field_parameterstofieldparameterscopy
14214 
14215 
14216  !
14217  !================================================================================================================================
14218  !
14219 
14221  SUBROUTINE field_parameter_set_add_constant_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
14222 
14223  !Argument variables
14224  TYPE(field_type), POINTER :: field
14225  INTEGER(INTG), INTENT(IN) :: variable_type
14226  INTEGER(INTG), INTENT(IN) :: field_set_type
14227  INTEGER(INTG), INTENT(IN) :: component_number
14228  INTEGER(INTG), INTENT(IN) :: VALUE
14229  INTEGER(INTG), INTENT(OUT) :: err
14230  TYPE(varying_string), INTENT(OUT) :: error
14231  !Local Variables
14232  INTEGER(INTG) :: ny
14233  TYPE(field_parameter_set_type), POINTER :: parameter_set
14234  TYPE(field_variable_type), POINTER :: field_variable
14235  TYPE(varying_string) :: local_error
14236 
14237  enters("FIELD_PARAMETER_SET_ADD_CONSTANT_INTG",err,error,*999)
14238 
14239  IF(ASSOCIATED(field)) THEN
14240  IF(field%FIELD_FINISHED) THEN
14241  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
14242  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
14243  IF(ASSOCIATED(field_variable)) THEN
14244  IF(field_variable%DATA_TYPE==field_intg_type) THEN
14245  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
14246  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
14247  IF(ASSOCIATED(parameter_set)) THEN
14248  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
14249  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
14250  CASE(field_constant_interpolation)
14251  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
14252  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
14253  CALL distributed_vector_values_add(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
14254  ELSE
14255  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
14256  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
14257  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
14258  & " does not have any constant parameters."
14259  CALL flagerror(local_error,err,error,*999)
14260  ENDIF
14261  CASE(field_element_based_interpolation)
14262  local_error="Can not add constant for component number "// &
14263  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14264  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14265  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
14266  CALL flagerror(local_error,err,error,*999)
14267  CASE(field_node_based_interpolation)
14268  local_error="Can not add constant for component number "// &
14269  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14270  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14271  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
14272  CALL flagerror(local_error,err,error,*999)
14273  CASE(field_grid_point_based_interpolation)
14274  local_error="Can not add constant for component number "// &
14275  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14276  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14277  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
14278  CALL flagerror(local_error,err,error,*999)
14279  CASE(field_gauss_point_based_interpolation)
14280  local_error="Can not add constant for component number "// &
14281  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14282  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14283  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
14284  CALL flagerror(local_error,err,error,*999)
14285  CASE(field_data_point_based_interpolation)
14286  local_error="Can not add constant for component number "// &
14287  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14288  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14289  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
14290  CALL flagerror(local_error,err,error,*999)
14291  CASE DEFAULT
14292  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
14293  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
14294  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14295  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14296  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14297  CALL flagerror(local_error,err,error,*999)
14298  END SELECT
14299  ELSE
14300  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
14301  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
14302  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
14303  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
14304  & " components."
14305  CALL flagerror(local_error,err,error,*999)
14306  ENDIF
14307  ELSE
14308  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14309  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14310  CALL flagerror(local_error,err,error,*999)
14311  ENDIF
14312  ELSE
14313  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14314  & " is invalid. The field parameter set type must be between 1 and "// &
14315  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
14316  CALL flagerror(local_error,err,error,*999)
14317  ENDIF
14318  ELSE
14319  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
14320  & " does not correspond to the integer data type of the given value."
14321  CALL flagerror(local_error,err,error,*999)
14322  ENDIF
14323  ELSE
14324  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14325  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14326  CALL flagerror(local_error,err,error,*999)
14327  ENDIF
14328  ELSE
14329  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14330  & " is invalid. The variable type must be between 1 and "// &
14331  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
14332  CALL flagerror(local_error,err,error,*999)
14333  ENDIF
14334  ELSE
14335  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
14336  & " has not been finished."
14337  CALL flagerror(local_error,err,error,*999)
14338  ENDIF
14339  ELSE
14340  CALL flagerror("Field is not associated.",err,error,*999)
14341  ENDIF
14342 
14343  exits("FIELD_PARAMETER_SET_ADD_CONSTANT_INTG")
14344  RETURN
14345 999 errorsexits("FIELD_PARAMETER_SET_ADD_CONSTANT_INTG",err,error)
14346  RETURN 1
14347  END SUBROUTINE field_parameter_set_add_constant_intg
14348 
14349  !
14350  !================================================================================================================================
14351  !
14352 
14354  SUBROUTINE field_parameter_set_add_constant_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
14355 
14356  !Argument variables
14357  TYPE(field_type), POINTER :: field
14358  INTEGER(INTG), INTENT(IN) :: variable_type
14359  INTEGER(INTG), INTENT(IN) :: field_set_type
14360  INTEGER(INTG), INTENT(IN) :: component_number
14361  REAL(SP), INTENT(IN) :: VALUE
14362  INTEGER(INTG), INTENT(OUT) :: err
14363  TYPE(varying_string), INTENT(OUT) :: error
14364  !Local Variables
14365  INTEGER(INTG) :: ny
14366  TYPE(field_parameter_set_type), POINTER :: parameter_set
14367  TYPE(field_variable_type), POINTER :: field_variable
14368  TYPE(varying_string) :: local_error
14369 
14370  enters("FIELD_PARAMETER_SET_ADD_CONSTANT_SP",err,error,*999)
14371 
14372  IF(ASSOCIATED(field)) THEN
14373  IF(field%FIELD_FINISHED) THEN
14374  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
14375  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
14376  IF(ASSOCIATED(field_variable)) THEN
14377  IF(field_variable%DATA_TYPE==field_sp_type) THEN
14378  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
14379  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
14380  IF(ASSOCIATED(parameter_set)) THEN
14381  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
14382  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
14383  CASE(field_constant_interpolation)
14384  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
14385  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
14386  CALL distributed_vector_values_add(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
14387  ELSE
14388  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
14389  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
14390  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
14391  & " does not have any constant parameters."
14392  CALL flagerror(local_error,err,error,*999)
14393  ENDIF
14394  CASE(field_element_based_interpolation)
14395  local_error="Can not add constant for component number "// &
14396  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14397  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14398  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
14399  CALL flagerror(local_error,err,error,*999)
14400  CASE(field_node_based_interpolation)
14401  local_error="Can not add constant for component number "// &
14402  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14403  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14404  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
14405  CALL flagerror(local_error,err,error,*999)
14406  CASE(field_grid_point_based_interpolation)
14407  local_error="Can not add constant for component number "// &
14408  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14409  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14410  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
14411  CALL flagerror(local_error,err,error,*999)
14412  CASE(field_gauss_point_based_interpolation)
14413  local_error="Can not add constant for component number "// &
14414  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14415  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14416  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
14417  CALL flagerror(local_error,err,error,*999)
14418  CASE(field_data_point_based_interpolation)
14419  local_error="Can not add constant for component number "// &
14420  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14421  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14422  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
14423  CALL flagerror(local_error,err,error,*999)
14424  CASE DEFAULT
14425  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
14426  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
14427  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14428  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14429  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14430  CALL flagerror(local_error,err,error,*999)
14431  END SELECT
14432  ELSE
14433  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
14434  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
14435  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
14436  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
14437  & " components."
14438  CALL flagerror(local_error,err,error,*999)
14439  ENDIF
14440  ELSE
14441  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14442  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14443  CALL flagerror(local_error,err,error,*999)
14444  ENDIF
14445  ELSE
14446  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14447  & " is invalid. The field parameter set type must be between 1 and "// &
14448  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
14449  CALL flagerror(local_error,err,error,*999)
14450  ENDIF
14451  ELSE
14452  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
14453  & " does not correspond to the single precision data type of the given value."
14454  CALL flagerror(local_error,err,error,*999)
14455  ENDIF
14456  ELSE
14457  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14458  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14459  CALL flagerror(local_error,err,error,*999)
14460  ENDIF
14461  ELSE
14462  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14463  & " is invalid. The variable type must be between 1 and "// &
14464  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
14465  CALL flagerror(local_error,err,error,*999)
14466  ENDIF
14467  ELSE
14468  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
14469  & " has not been finished."
14470  CALL flagerror(local_error,err,error,*999)
14471  ENDIF
14472  ELSE
14473  CALL flagerror("Field is not associated.",err,error,*999)
14474  ENDIF
14475 
14476  exits("FIELD_PARAMETER_SET_ADD_CONSTANT_SP")
14477  RETURN
14478 999 errorsexits("FIELD_PARAMETER_SET_ADD_CONSTANT_SP",err,error)
14479  RETURN 1
14480  END SUBROUTINE field_parameter_set_add_constant_sp
14481 
14482  !
14483  !================================================================================================================================
14484  !
14485 
14487  SUBROUTINE field_parameter_set_add_constant_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
14488 
14489  !Argument variables
14490  TYPE(field_type), POINTER :: field
14491  INTEGER(INTG), INTENT(IN) :: variable_type
14492  INTEGER(INTG), INTENT(IN) :: field_set_type
14493  INTEGER(INTG), INTENT(IN) :: component_number
14494  REAL(DP), INTENT(IN) :: VALUE
14495  INTEGER(INTG), INTENT(OUT) :: err
14496  TYPE(varying_string), INTENT(OUT) :: error
14497  !Local Variables
14498  INTEGER(INTG) :: ny
14499  TYPE(field_parameter_set_type), POINTER :: parameter_set
14500  TYPE(field_variable_type), POINTER :: field_variable
14501  TYPE(varying_string) :: local_error
14502 
14503  enters("FIELD_PARAMETER_SET_ADD_CONSTANT_DP",err,error,*999)
14504 
14505  IF(ASSOCIATED(field)) THEN
14506  IF(field%FIELD_FINISHED) THEN
14507  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
14508  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
14509  IF(ASSOCIATED(field_variable)) THEN
14510  IF(field_variable%DATA_TYPE==field_dp_type) THEN
14511  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
14512  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
14513  IF(ASSOCIATED(parameter_set)) THEN
14514  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
14515  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
14516  CASE(field_constant_interpolation)
14517  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
14518  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
14519  CALL distributed_vector_values_add(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
14520  ELSE
14521  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
14522  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
14523  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
14524  & " does not have any constant parameters."
14525  CALL flagerror(local_error,err,error,*999)
14526  ENDIF
14527  CASE(field_element_based_interpolation)
14528  local_error="Can not add constant for component number "// &
14529  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14530  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14531  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
14532  CALL flagerror(local_error,err,error,*999)
14533  CASE(field_node_based_interpolation)
14534  local_error="Can not add constant for component number "// &
14535  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14536  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14537  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
14538  CALL flagerror(local_error,err,error,*999)
14539  CASE(field_grid_point_based_interpolation)
14540  local_error="Can not add constant for component number "// &
14541  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14542  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14543  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
14544  CALL flagerror(local_error,err,error,*999)
14545  CASE(field_gauss_point_based_interpolation)
14546  local_error="Can not add constant for component number "// &
14547  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14548  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14549  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
14550  CALL flagerror(local_error,err,error,*999)
14551  CASE(field_data_point_based_interpolation)
14552  local_error="Can not add constant for component number "// &
14553  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14554  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14555  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
14556  CALL flagerror(local_error,err,error,*999)
14557  CASE DEFAULT
14558  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
14559  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
14560  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14561  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14562  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14563  CALL flagerror(local_error,err,error,*999)
14564  END SELECT
14565  ELSE
14566  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
14567  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
14568  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
14569  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
14570  & " components."
14571  CALL flagerror(local_error,err,error,*999)
14572  ENDIF
14573  ELSE
14574  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14575  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14576  CALL flagerror(local_error,err,error,*999)
14577  ENDIF
14578  ELSE
14579  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14580  & " is invalid. The field parameter set type must be between 1 and "// &
14581  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
14582  CALL flagerror(local_error,err,error,*999)
14583  ENDIF
14584  ELSE
14585  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
14586  & " does not correspond to the double precision data type of the given value."
14587  CALL flagerror(local_error,err,error,*999)
14588  ENDIF
14589  ELSE
14590  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14591  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14592  CALL flagerror(local_error,err,error,*999)
14593  ENDIF
14594  ELSE
14595  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14596  & " is invalid. The variable type must be between 1 and "// &
14597  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
14598  CALL flagerror(local_error,err,error,*999)
14599  ENDIF
14600  ELSE
14601  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
14602  & " has not been finished."
14603  CALL flagerror(local_error,err,error,*999)
14604  ENDIF
14605  ELSE
14606  CALL flagerror("Field is not associated.",err,error,*999)
14607  ENDIF
14608 
14609  exits("FIELD_PARAMETER_SET_ADD_CONSTANT_DP")
14610  RETURN
14611 999 errorsexits("FIELD_PARAMETER_SET_ADD_CONSTANT_DP",err,error)
14612  RETURN 1
14613  END SUBROUTINE field_parameter_set_add_constant_dp
14614 
14615  !
14616  !================================================================================================================================
14617  !
14618 
14620  SUBROUTINE field_parameter_set_add_constant_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
14621 
14622  !Argument variables
14623  TYPE(field_type), POINTER :: field
14624  INTEGER(INTG), INTENT(IN) :: variable_type
14625  INTEGER(INTG), INTENT(IN) :: field_set_type
14626  INTEGER(INTG), INTENT(IN) :: component_number
14627  LOGICAL, INTENT(IN) :: VALUE
14628  INTEGER(INTG), INTENT(OUT) :: err
14629  TYPE(varying_string), INTENT(OUT) :: error
14630  !Local Variables
14631  INTEGER(INTG) :: ny
14632  TYPE(field_parameter_set_type), POINTER :: parameter_set
14633  TYPE(field_variable_type), POINTER :: field_variable
14634  TYPE(varying_string) :: local_error
14635 
14636  enters("FIELD_PARAMETER_SET_ADD_CONSTANT_L",err,error,*999)
14637 
14638  IF(ASSOCIATED(field)) THEN
14639  IF(field%FIELD_FINISHED) THEN
14640  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
14641  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
14642  IF(ASSOCIATED(field_variable)) THEN
14643  IF(field_variable%DATA_TYPE==field_l_type) THEN
14644  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
14645  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
14646  IF(ASSOCIATED(parameter_set)) THEN
14647  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
14648  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
14649  CASE(field_constant_interpolation)
14650  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
14651  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
14652  CALL distributed_vector_values_add(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
14653  ELSE
14654  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
14655  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
14656  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
14657  & " does not have any constant parameters."
14658  CALL flagerror(local_error,err,error,*999)
14659  ENDIF
14660  CASE(field_element_based_interpolation)
14661  local_error="Can not add constant for component number "// &
14662  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14663  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14664  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
14665  CALL flagerror(local_error,err,error,*999)
14666  CASE(field_node_based_interpolation)
14667  local_error="Can not add constant for component number "// &
14668  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14669  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14670  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
14671  CALL flagerror(local_error,err,error,*999)
14672  CASE(field_grid_point_based_interpolation)
14673  local_error="Can not add constant for component number "// &
14674  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14675  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14676  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
14677  CALL flagerror(local_error,err,error,*999)
14678  CASE(field_gauss_point_based_interpolation)
14679  local_error="Can not add constant for component number "// &
14680  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14681  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14682  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
14683  CALL flagerror(local_error,err,error,*999)
14684  CASE(field_data_point_based_interpolation)
14685  local_error="Can not add constant for component number "// &
14686  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14687  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14688  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
14689  CALL flagerror(local_error,err,error,*999)
14690  CASE DEFAULT
14691  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
14692  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
14693  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
14694  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
14695  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14696  CALL flagerror(local_error,err,error,*999)
14697  END SELECT
14698  ELSE
14699  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
14700  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
14701  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
14702  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
14703  & " components."
14704  CALL flagerror(local_error,err,error,*999)
14705  ENDIF
14706  ELSE
14707  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14708  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14709  CALL flagerror(local_error,err,error,*999)
14710  ENDIF
14711  ELSE
14712  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14713  & " is invalid. The field parameter set type must be between 1 and "// &
14714  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
14715  CALL flagerror(local_error,err,error,*999)
14716  ENDIF
14717  ELSE
14718  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
14719  & " does not correspond to the logical data type of the given value."
14720  CALL flagerror(local_error,err,error,*999)
14721  ENDIF
14722  ELSE
14723  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14724  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14725  CALL flagerror(local_error,err,error,*999)
14726  ENDIF
14727  ELSE
14728  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14729  & " is invalid. The variable type must be between 1 and "// &
14730  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
14731  CALL flagerror(local_error,err,error,*999)
14732  ENDIF
14733  ELSE
14734  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
14735  & " has not been finished."
14736  CALL flagerror(local_error,err,error,*999)
14737  ENDIF
14738  ELSE
14739  CALL flagerror("Field is not associated.",err,error,*999)
14740  ENDIF
14741 
14742  exits("FIELD_PARAMETER_SET_ADD_CONSTANT_L")
14743  RETURN
14744 999 errorsexits("FIELD_PARAMETER_SET_ADD_CONSTANT_L",err,error)
14745  RETURN 1
14746  END SUBROUTINE field_parameter_set_add_constant_l
14747 
14748  !
14749  !================================================================================================================================
14750  !
14751 
14753  SUBROUTINE field_parameter_set_add_local_dof_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
14754 
14755  !Argument variables
14756  TYPE(field_type), POINTER :: field
14757  INTEGER(INTG), INTENT(IN) :: variable_type
14758  INTEGER(INTG), INTENT(IN) :: field_set_type
14759  INTEGER(INTG), INTENT(IN) :: dof_number
14760  INTEGER(INTG), INTENT(IN) :: VALUE
14761  INTEGER(INTG), INTENT(OUT) :: err
14762  TYPE(varying_string), INTENT(OUT) :: error
14763  !Local Variables
14764  INTEGER(INTG) :: global_dof_number
14765  TYPE(field_parameter_set_type), POINTER :: parameter_set
14766  TYPE(field_variable_type), POINTER :: field_variable
14767  TYPE(varying_string) :: local_error
14768 
14769  enters("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_INTG",err,error,*999)
14770 
14771 !!TODO: Allow multiple dof number and values updates.
14772  IF(ASSOCIATED(field)) THEN
14773  IF(field%FIELD_FINISHED) THEN
14774  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
14775  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
14776  IF(ASSOCIATED(field_variable)) THEN
14777  IF(field_variable%DATA_TYPE==field_intg_type) THEN
14778  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
14779  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
14780  IF(ASSOCIATED(parameter_set)) THEN
14781  !Note that dofs are slightly different from other mappings in that all the local dofs are not all at the start.
14782  !This is because the dof indicies are from combined field components. Thus need to check that a ghost value is
14783  !not being set.
14784  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL) THEN
14785  global_dof_number=field_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_number)
14786  IF(field_variable%DOMAIN_MAPPING%GLOBAL_TO_LOCAL_MAP(global_dof_number)%LOCAL_TYPE(1)/=domain_local_ghost) THEN
14787  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
14788  ELSE
14789  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
14790  & " is invalid as it is a ghost dof for this domain."
14791  CALL flagerror(local_error,err,error,*999)
14792  ENDIF
14793  ELSE
14794  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
14795  & " is invalid. It must be >0 and <="// &
14796  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL,"*",err,error))// &
14797  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14798  CALL flagerror(local_error,err,error,*999)
14799  ENDIF
14800  ELSE
14801  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14802  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14803  CALL flagerror(local_error,err,error,*999)
14804  ENDIF
14805  ELSE
14806  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14807  & " is invalid. The field parameter set type must be between 1 and "// &
14808  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
14809  CALL flagerror(local_error,err,error,*999)
14810  ENDIF
14811  ELSE
14812  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
14813  & " does not correspond to the integer data type of the given value."
14814  CALL flagerror(local_error,err,error,*999)
14815  ENDIF
14816  ELSE
14817  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14818  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14819  CALL flagerror(local_error,err,error,*999)
14820  ENDIF
14821  ELSE
14822  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14823  & " is invalid. The variable type must be between 1 and "// &
14824  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
14825  CALL flagerror(local_error,err,error,*999)
14826  ENDIF
14827  ELSE
14828  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
14829  & " has not been finished."
14830  CALL flagerror(local_error,err,error,*999)
14831  ENDIF
14832  ELSE
14833  CALL flagerror("Field is not associated.",err,error,*999)
14834  ENDIF
14835 
14836  exits("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_INTG")
14837  RETURN
14838 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_INTG",err,error)
14839  RETURN 1
14840  END SUBROUTINE field_parameter_set_add_local_dof_intg
14841 
14842  !
14843  !================================================================================================================================
14844  !
14845 
14847  SUBROUTINE field_parameter_set_add_local_dof_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
14848 
14849  !Argument variables
14850  TYPE(field_type), POINTER :: field
14851  INTEGER(INTG), INTENT(IN) :: variable_type
14852  INTEGER(INTG), INTENT(IN) :: field_set_type
14853  INTEGER(INTG), INTENT(IN) :: dof_number
14854  REAL(SP), INTENT(IN) :: VALUE
14855  INTEGER(INTG), INTENT(OUT) :: err
14856  TYPE(varying_string), INTENT(OUT) :: error
14857  !Local Variables
14858  INTEGER(INTG) :: global_dof_number
14859  TYPE(field_parameter_set_type), POINTER :: parameter_set
14860  TYPE(field_variable_type), POINTER :: field_variable
14861  TYPE(varying_string) :: local_error
14862 
14863  enters("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_SP",err,error,*999)
14864 
14865 !!TODO: Allow multiple dof number and values updates.
14866  IF(ASSOCIATED(field)) THEN
14867  IF(field%FIELD_FINISHED) THEN
14868  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
14869  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
14870  IF(ASSOCIATED(field_variable)) THEN
14871  IF(field_variable%DATA_TYPE==field_sp_type) THEN
14872  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
14873  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
14874  IF(ASSOCIATED(parameter_set)) THEN
14875  !Note that dofs are slightly different from other mappings in that all the local dofs are not all at the start.
14876  !This is because the dof indicies are from combined field components. Thus need to check that a ghost value is
14877  !not being set.
14878  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL) THEN
14879  global_dof_number=field_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_number)
14880  IF(field_variable%DOMAIN_MAPPING%GLOBAL_TO_LOCAL_MAP(global_dof_number)%LOCAL_TYPE(1)/=domain_local_ghost) THEN
14881  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
14882  ELSE
14883  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
14884  & " is invalid as it is a ghost dof for this domain."
14885  CALL flagerror(local_error,err,error,*999)
14886  ENDIF
14887  ELSE
14888  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
14889  & " is invalid. It must be >0 and <="// &
14890  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL,"*",err,error))// &
14891  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14892  CALL flagerror(local_error,err,error,*999)
14893  ENDIF
14894  ELSE
14895  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14896  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14897  CALL flagerror(local_error,err,error,*999)
14898  ENDIF
14899  ELSE
14900  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14901  & " is invalid. The field parameter set type must be between 1 and "// &
14902  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
14903  CALL flagerror(local_error,err,error,*999)
14904  ENDIF
14905  ELSE
14906  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
14907  & " does not correspond to the single precision data type of the given value."
14908  CALL flagerror(local_error,err,error,*999)
14909  ENDIF
14910  ELSE
14911  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14912  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14913  CALL flagerror(local_error,err,error,*999)
14914  ENDIF
14915  ELSE
14916  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
14917  & " is invalid. The variable type must be between 1 and "// &
14918  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
14919  CALL flagerror(local_error,err,error,*999)
14920  ENDIF
14921  ELSE
14922  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
14923  & " has not been finished."
14924  CALL flagerror(local_error,err,error,*999)
14925  ENDIF
14926  ELSE
14927  CALL flagerror("Field is not associated.",err,error,*999)
14928  ENDIF
14929 
14930  exits("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_SP")
14931  RETURN
14932 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_SP",err,error)
14933  RETURN 1
14934  END SUBROUTINE field_parameter_set_add_local_dof_sp
14935 
14936  !
14937  !================================================================================================================================
14938  !
14939 
14941  SUBROUTINE field_parameter_set_add_local_dof_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
14942 
14943  !Argument variables
14944  TYPE(field_type), POINTER :: field
14945  INTEGER(INTG), INTENT(IN) :: variable_type
14946  INTEGER(INTG), INTENT(IN) :: field_set_type
14947  INTEGER(INTG), INTENT(IN) :: dof_number
14948  REAL(DP), INTENT(IN) :: VALUE
14949  INTEGER(INTG), INTENT(OUT) :: err
14950  TYPE(varying_string), INTENT(OUT) :: error
14951  !Local Variables
14952  INTEGER(INTG) :: global_dof_number
14953  TYPE(field_parameter_set_type), POINTER :: parameter_set
14954  TYPE(field_variable_type), POINTER :: field_variable
14955  TYPE(varying_string) :: local_error
14956 
14957  enters("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_DP",err,error,*999)
14958 
14959 !!TODO: Allow multiple dof number and values updates.
14960  IF(ASSOCIATED(field)) THEN
14961  IF(field%FIELD_FINISHED) THEN
14962  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
14963  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
14964  IF(ASSOCIATED(field_variable)) THEN
14965  IF(field_variable%DATA_TYPE==field_dp_type) THEN
14966  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
14967  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
14968  IF(ASSOCIATED(parameter_set)) THEN
14969  !Note that dofs are slightly different from other mappings in that all the local dofs are not all at the start.
14970  !This is because the dof indicies are from combined field components. Thus need to check that a ghost value is
14971  !not being set.
14972  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL) THEN
14973  global_dof_number=field_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_number)
14974  IF(field_variable%DOMAIN_MAPPING%GLOBAL_TO_LOCAL_MAP(global_dof_number)%LOCAL_TYPE(1)/=domain_local_ghost) THEN
14975  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
14976  ELSE
14977  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
14978  & " is invalid as it is a ghost dof for this domain."
14979  CALL flagerror(local_error,err,error,*999)
14980  ENDIF
14981  ELSE
14982  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
14983  & " is invalid. It must be >0 and <="// &
14984  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL,"*",err,error))// &
14985  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14986  CALL flagerror(local_error,err,error,*999)
14987  ENDIF
14988  ELSE
14989  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14990  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
14991  CALL flagerror(local_error,err,error,*999)
14992  ENDIF
14993  ELSE
14994  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
14995  & " is invalid. The field parameter set type must be between 1 and "// &
14996  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
14997  CALL flagerror(local_error,err,error,*999)
14998  ENDIF
14999  ELSE
15000  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
15001  & " does not correspond to the double precision data type of the given value."
15002  CALL flagerror(local_error,err,error,*999)
15003  ENDIF
15004  ELSE
15005  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15006  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15007  CALL flagerror(local_error,err,error,*999)
15008  ENDIF
15009  ELSE
15010  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15011  & " is invalid. The variable type must be between 1 and "// &
15012  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
15013  CALL flagerror(local_error,err,error,*999)
15014  ENDIF
15015  ELSE
15016  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
15017  & " has not been finished."
15018  CALL flagerror(local_error,err,error,*999)
15019  ENDIF
15020  ELSE
15021  CALL flagerror("Field is not associated.",err,error,*999)
15022  ENDIF
15023 
15024  exits("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_DP")
15025  RETURN
15026 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_DP",err,error)
15027  RETURN 1
15028  END SUBROUTINE field_parameter_set_add_local_dof_dp
15029 
15030  !
15031  !================================================================================================================================
15032  !
15033 
15035  SUBROUTINE field_parameter_set_add_local_dof_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
15036 
15037  !Argument variables
15038  TYPE(field_type), POINTER :: field
15039  INTEGER(INTG), INTENT(IN) :: variable_type
15040  INTEGER(INTG), INTENT(IN) :: field_set_type
15041  INTEGER(INTG), INTENT(IN) :: dof_number
15042  LOGICAL, INTENT(IN) :: VALUE
15043  INTEGER(INTG), INTENT(OUT) :: err
15044  TYPE(varying_string), INTENT(OUT) :: error
15045  !Local Variables
15046  INTEGER(INTG) :: global_dof_number
15047  TYPE(field_parameter_set_type), POINTER :: parameter_set
15048  TYPE(field_variable_type), POINTER :: field_variable
15049  TYPE(varying_string) :: local_error
15050 
15051  enters("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_L",err,error,*999)
15052 
15053 !!TODO: Allow multiple dof number and values updates.
15054  IF(ASSOCIATED(field)) THEN
15055  IF(field%FIELD_FINISHED) THEN
15056  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
15057  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
15058  IF(ASSOCIATED(field_variable)) THEN
15059  IF(field_variable%DATA_TYPE==field_l_type) THEN
15060  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
15061  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
15062  IF(ASSOCIATED(parameter_set)) THEN
15063  !Note that dofs are slightly different from other mappings in that all the local dofs are not all at the start.
15064  !This is because the dof indicies are from combined field components. Thus need to check that a ghost value is
15065  !not being set.
15066  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL) THEN
15067  global_dof_number=field_variable%DOMAIN_MAPPING%LOCAL_TO_GLOBAL_MAP(dof_number)
15068  IF(field_variable%DOMAIN_MAPPING%GLOBAL_TO_LOCAL_MAP(global_dof_number)%LOCAL_TYPE(1)/=domain_local_ghost) THEN
15069  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
15070  ELSE
15071  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
15072  & " is invalid as it is a ghost dof for this domain."
15073  CALL flagerror(local_error,err,error,*999)
15074  ENDIF
15075  ELSE
15076  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
15077  & " is invalid. It must be >0 and <="// &
15078  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL,"*",err,error))// &
15079  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15080  CALL flagerror(local_error,err,error,*999)
15081  ENDIF
15082  ELSE
15083  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15084  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15085  CALL flagerror(local_error,err,error,*999)
15086  ENDIF
15087  ELSE
15088  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15089  & " is invalid. The field parameter set type must be between 1 and "// &
15090  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
15091  CALL flagerror(local_error,err,error,*999)
15092  ENDIF
15093  ELSE
15094  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
15095  & " does not correspond to the logical data type of the given value."
15096  CALL flagerror(local_error,err,error,*999)
15097  ENDIF
15098  ELSE
15099  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15100  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15101  CALL flagerror(local_error,err,error,*999)
15102  ENDIF
15103  ELSE
15104  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15105  & " is invalid. The variable type must be between 1 and "// &
15106  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
15107  CALL flagerror(local_error,err,error,*999)
15108  ENDIF
15109  ELSE
15110  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
15111  & " has not been finished."
15112  CALL flagerror(local_error,err,error,*999)
15113  ENDIF
15114  ELSE
15115  CALL flagerror("Field is not associated.",err,error,*999)
15116  ENDIF
15117 
15118  exits("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_L")
15119  RETURN
15120 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_DOF_L",err,error)
15121  RETURN 1
15122  END SUBROUTINE field_parameter_set_add_local_dof_l
15123 
15124  !
15125  !================================================================================================================================
15126  !
15127 
15129  SUBROUTINE field_parameter_set_add_element_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
15130  & VALUE,err,error,*)
15131 
15132  !Argument variables
15133  TYPE(field_type), POINTER :: field
15134  INTEGER(INTG), INTENT(IN) :: variable_type
15135  INTEGER(INTG), INTENT(IN) :: field_set_type
15136  INTEGER(INTG), INTENT(IN) :: user_element_number
15137  INTEGER(INTG), INTENT(IN) :: component_number
15138  INTEGER(INTG), INTENT(IN) :: VALUE
15139  INTEGER(INTG), INTENT(OUT) :: err
15140  TYPE(varying_string), INTENT(OUT) :: error
15141  !Local Variables
15142  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
15143  LOGICAL :: ghost_element,user_element_exists
15144  TYPE(decomposition_type), POINTER :: decomposition
15145  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
15146  TYPE(field_parameter_set_type), POINTER :: parameter_set
15147  TYPE(field_variable_type), POINTER :: field_variable
15148  TYPE(varying_string) :: local_error
15149 
15150  enters("FIELD_PARAMETER_SET_ADD_ELEMENT_INTG",err,error,*999)
15151 
15152  IF(ASSOCIATED(field)) THEN
15153  IF(field%FIELD_FINISHED) THEN
15154  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
15155  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
15156  IF(ASSOCIATED(field_variable)) THEN
15157  IF(field_variable%DATA_TYPE==field_intg_type) THEN
15158  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
15159  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
15160  IF(ASSOCIATED(parameter_set)) THEN
15161  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
15162  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
15163  CASE(field_constant_interpolation)
15164  local_error="Can not add element for component number "// &
15165  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15166  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15167  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
15168  CALL flagerror(local_error,err,error,*999)
15169  CASE(field_element_based_interpolation)
15170  decomposition=>field%DECOMPOSITION
15171  IF(ASSOCIATED(decomposition)) THEN
15172  decomposition_topology=>decomposition%TOPOLOGY
15173  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
15174  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
15175  IF(user_element_exists) THEN
15176  IF(ghost_element) THEN
15177  local_error="Cannot add element for user element "// &
15178  & trim(number_to_vstring(user_element_number,"*",err,error))//" as it is a ghost element."
15179  CALL flagerror(local_error,err,error,*999)
15180  ELSE
15181  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
15182  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
15183  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
15184  ENDIF
15185  ELSE
15186  local_error="The specified user element number of "// &
15187  & trim(number_to_vstring(user_element_number,"*",err,error))// &
15188  & " does not exist in the decomposition for field component number "// &
15189  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
15190  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15191  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15192  CALL flagerror(local_error,err,error,*999)
15193  ENDIF
15194  ELSE
15195  CALL flagerror("Field decomposition is not associated.",err,error,*999)
15196  ENDIF
15197  CASE(field_node_based_interpolation)
15198  local_error="Can not add element for component number "// &
15199  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15200  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15201  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
15202  CALL flagerror(local_error,err,error,*999)
15203  CASE(field_grid_point_based_interpolation)
15204  local_error="Can not add element for component number "// &
15205  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15206  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15207  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
15208  CALL flagerror(local_error,err,error,*999)
15209  CASE(field_gauss_point_based_interpolation)
15210  local_error="Can not add element for component number "// &
15211  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15212  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15213  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
15214  CALL flagerror(local_error,err,error,*999)
15215  CASE(field_data_point_based_interpolation)
15216  local_error="Can not add element for component number "// &
15217  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15218  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15219  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
15220  CALL flagerror(local_error,err,error,*999)
15221  CASE DEFAULT
15222  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
15223  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
15224  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15225  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15226  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15227  CALL flagerror(local_error,err,error,*999)
15228  END SELECT
15229  ELSE
15230  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
15231  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
15232  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
15233  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
15234  & " components."
15235  CALL flagerror(local_error,err,error,*999)
15236  ENDIF
15237  ELSE
15238  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15239  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15240  CALL flagerror(local_error,err,error,*999)
15241  ENDIF
15242  ELSE
15243  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15244  & " is invalid. The field parameter set type must be between 1 and "// &
15245  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
15246  CALL flagerror(local_error,err,error,*999)
15247  ENDIF
15248  ELSE
15249  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
15250  & " does not correspond to the integer data type of the given value."
15251  CALL flagerror(local_error,err,error,*999)
15252  ENDIF
15253  ELSE
15254  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15255  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15256  CALL flagerror(local_error,err,error,*999)
15257  ENDIF
15258  ELSE
15259  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15260  & " is invalid. The variable type must be between 1 and "// &
15261  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
15262  CALL flagerror(local_error,err,error,*999)
15263  ENDIF
15264  ELSE
15265  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
15266  & " has not been finished."
15267  CALL flagerror(local_error,err,error,*999)
15268  ENDIF
15269  ELSE
15270  CALL flagerror("Field is not associated.",err,error,*999)
15271  ENDIF
15272 
15273  exits("FIELD_PARAMETER_SET_ADD_ELEMENT_INTG")
15274  RETURN
15275 999 errorsexits("FIELD_PARAMETER_SET_ADD_ELEMENT_INTG",err,error)
15276  RETURN 1
15277  END SUBROUTINE field_parameter_set_add_element_intg
15278 
15279  !
15280  !================================================================================================================================
15281  !
15282 
15284  SUBROUTINE field_parameter_set_add_element_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
15285  & VALUE,err,error,*)
15286 
15287  !Argument variables
15288  TYPE(field_type), POINTER :: field
15289  INTEGER(INTG), INTENT(IN) :: variable_type
15290  INTEGER(INTG), INTENT(IN) :: field_set_type
15291  INTEGER(INTG), INTENT(IN) :: user_element_number
15292  INTEGER(INTG), INTENT(IN) :: component_number
15293  REAL(SP), INTENT(IN) :: VALUE
15294  INTEGER(INTG), INTENT(OUT) :: err
15295  TYPE(varying_string), INTENT(OUT) :: error
15296  !Local Variables
15297  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
15298  LOGICAL :: ghost_element,user_element_exists
15299  TYPE(decomposition_type), POINTER :: decomposition
15300  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
15301  TYPE(field_parameter_set_type), POINTER :: parameter_set
15302  TYPE(field_variable_type), POINTER :: field_variable
15303  TYPE(varying_string) :: local_error
15304 
15305  enters("FIELD_PARAMETER_SET_ADD_ELEMENT_SP",err,error,*999)
15306 
15307  IF(ASSOCIATED(field)) THEN
15308  IF(field%FIELD_FINISHED) THEN
15309  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
15310  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
15311  IF(ASSOCIATED(field_variable)) THEN
15312  IF(field_variable%DATA_TYPE==field_sp_type) THEN
15313  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
15314  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
15315  IF(ASSOCIATED(parameter_set)) THEN
15316  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
15317  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
15318  CASE(field_constant_interpolation)
15319  local_error="Can not add element for component number "// &
15320  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15321  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15322  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
15323  CALL flagerror(local_error,err,error,*999)
15324  CASE(field_element_based_interpolation)
15325  decomposition=>field%DECOMPOSITION
15326  IF(ASSOCIATED(decomposition)) THEN
15327  decomposition_topology=>decomposition%TOPOLOGY
15328  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
15329  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
15330  IF(user_element_exists) THEN
15331  IF(ghost_element) THEN
15332  local_error="Cannot add element for user element "// &
15333  & trim(number_to_vstring(user_element_number,"*",err,error))//" as it is a ghost element."
15334  CALL flagerror(local_error,err,error,*999)
15335  ELSE
15336  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
15337  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
15338  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
15339  ENDIF
15340  ELSE
15341  local_error="The specified user element number of "// &
15342  & trim(number_to_vstring(user_element_number,"*",err,error))// &
15343  & " does not exist in the decomposition for field component number "// &
15344  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
15345  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15346  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15347  CALL flagerror(local_error,err,error,*999)
15348  ENDIF
15349  ELSE
15350  CALL flagerror("Field decomposition is not associated.",err,error,*999)
15351  ENDIF
15352  CASE(field_node_based_interpolation)
15353  local_error="Can not add element for component number "// &
15354  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15355  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15356  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
15357  CALL flagerror(local_error,err,error,*999)
15358  CASE(field_grid_point_based_interpolation)
15359  local_error="Can not add element for component number "// &
15360  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15361  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15362  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
15363  CALL flagerror(local_error,err,error,*999)
15364  CASE(field_gauss_point_based_interpolation)
15365  local_error="Can not add element for component number "// &
15366  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15367  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15368  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
15369  CALL flagerror(local_error,err,error,*999)
15370  CASE(field_data_point_based_interpolation)
15371  local_error="Can not add element for component number "// &
15372  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15373  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15374  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
15375  CALL flagerror(local_error,err,error,*999)
15376  CASE DEFAULT
15377  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
15378  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
15379  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15380  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15381  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15382  CALL flagerror(local_error,err,error,*999)
15383  END SELECT
15384  ELSE
15385  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
15386  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
15387  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
15388  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
15389  & " components."
15390  CALL flagerror(local_error,err,error,*999)
15391  ENDIF
15392  ELSE
15393  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15394  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15395  CALL flagerror(local_error,err,error,*999)
15396  ENDIF
15397  ELSE
15398  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15399  & " is invalid. The field parameter set type must be between 1 and "// &
15400 
15401  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
15402  CALL flagerror(local_error,err,error,*999)
15403  ENDIF
15404  ELSE
15405  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
15406  & " does not correspond to the single precision data type of the given value."
15407  CALL flagerror(local_error,err,error,*999)
15408  ENDIF
15409  ELSE
15410  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15411  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15412  CALL flagerror(local_error,err,error,*999)
15413  ENDIF
15414  ELSE
15415  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15416  & " is invalid. The variable type must be between 1 and "// &
15417  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
15418  CALL flagerror(local_error,err,error,*999)
15419  ENDIF
15420  ELSE
15421  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
15422  & " has not been finished."
15423  CALL flagerror(local_error,err,error,*999)
15424  ENDIF
15425  ELSE
15426  CALL flagerror("Field is not associated.",err,error,*999)
15427  ENDIF
15428 
15429  exits("FIELD_PARAMETER_SET_ADD_ELEMENT_SP")
15430  RETURN
15431 999 errorsexits("FIELD_PARAMETER_SET_ADD_ELEMENT_SP",err,error)
15432  RETURN 1
15433  END SUBROUTINE field_parameter_set_add_element_sp
15434 
15435  !
15436  !================================================================================================================================
15437  !
15438 
15440  SUBROUTINE field_parameter_set_add_element_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
15441  & VALUE,err,error,*)
15442 
15443  !Argument variables
15444  TYPE(field_type), POINTER :: field
15445  INTEGER(INTG), INTENT(IN) :: variable_type
15446  INTEGER(INTG), INTENT(IN) :: field_set_type
15447  INTEGER(INTG), INTENT(IN) :: user_element_number
15448  INTEGER(INTG), INTENT(IN) :: component_number
15449  REAL(DP), INTENT(IN) :: VALUE
15450  INTEGER(INTG), INTENT(OUT) :: err
15451  TYPE(varying_string), INTENT(OUT) :: error
15452  !Local Variables
15453  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
15454  LOGICAL :: ghost_element,user_element_exists
15455  TYPE(decomposition_type), POINTER :: decomposition
15456  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
15457  TYPE(field_parameter_set_type), POINTER :: parameter_set
15458  TYPE(field_variable_type), POINTER :: field_variable
15459  TYPE(varying_string) :: local_error
15460 
15461  enters("FIELD_PARAMETER_SET_ADD_ELEMENT_DP",err,error,*999)
15462 
15463  IF(ASSOCIATED(field)) THEN
15464  IF(field%FIELD_FINISHED) THEN
15465  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
15466  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
15467  IF(ASSOCIATED(field_variable)) THEN
15468  IF(field_variable%DATA_TYPE==field_dp_type) THEN
15469  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
15470  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
15471  IF(ASSOCIATED(parameter_set)) THEN
15472  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
15473  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
15474  CASE(field_constant_interpolation)
15475  local_error="Can not add element for component number "// &
15476  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15477  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15478  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
15479  CALL flagerror(local_error,err,error,*999)
15480  CASE(field_element_based_interpolation)
15481  decomposition=>field%DECOMPOSITION
15482  IF(ASSOCIATED(decomposition)) THEN
15483  decomposition_topology=>decomposition%TOPOLOGY
15484  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
15485  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
15486  IF(user_element_exists) THEN
15487  IF(ghost_element) THEN
15488  local_error="Cannot add element for user element "// &
15489  & trim(number_to_vstring(user_element_number,"*",err,error))//" as it is a ghost element."
15490  CALL flagerror(local_error,err,error,*999)
15491  ELSE
15492  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
15493  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
15494  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
15495  ENDIF
15496  ELSE
15497  local_error="The specified user element number of "// &
15498  & trim(number_to_vstring(user_element_number,"*",err,error))// &
15499  & " does not exist in the decomposition for field component number "// &
15500  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
15501  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15502  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15503  CALL flagerror(local_error,err,error,*999)
15504  ENDIF
15505  ELSE
15506  CALL flagerror("Field decomposition is not associated.",err,error,*999)
15507  ENDIF
15508  CASE(field_node_based_interpolation)
15509  local_error="Can not add element for component number "// &
15510  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15511  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15512  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
15513  CALL flagerror(local_error,err,error,*999)
15514  CASE(field_grid_point_based_interpolation)
15515  local_error="Can not add element for component number "// &
15516  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15517  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15518  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
15519  CALL flagerror(local_error,err,error,*999)
15520  CASE(field_gauss_point_based_interpolation)
15521  local_error="Can not add element for component number "// &
15522  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15523  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15524  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
15525  CALL flagerror(local_error,err,error,*999)
15526  CASE(field_data_point_based_interpolation)
15527  local_error="Can not add element for component number "// &
15528  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15529  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15530  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
15531  CALL flagerror(local_error,err,error,*999)
15532  CASE DEFAULT
15533  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
15534  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
15535  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15536  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15537  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15538  CALL flagerror(local_error,err,error,*999)
15539  END SELECT
15540  ELSE
15541  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
15542  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
15543  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
15544  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
15545  & " components."
15546  CALL flagerror(local_error,err,error,*999)
15547  ENDIF
15548  ELSE
15549  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15550  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15551  CALL flagerror(local_error,err,error,*999)
15552  ENDIF
15553  ELSE
15554  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15555  & " is invalid. The field parameter set type must be between 1 and "// &
15556  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
15557  CALL flagerror(local_error,err,error,*999)
15558  ENDIF
15559  ELSE
15560  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
15561  & " does not correspond to the double precision data type of the given value."
15562  CALL flagerror(local_error,err,error,*999)
15563  ENDIF
15564  ELSE
15565  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15566  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15567  CALL flagerror(local_error,err,error,*999)
15568  ENDIF
15569  ELSE
15570  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15571  & " is invalid. The variable type must be between 1 and "// &
15572  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
15573  CALL flagerror(local_error,err,error,*999)
15574  ENDIF
15575  ELSE
15576  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
15577  & " has not been finished."
15578  CALL flagerror(local_error,err,error,*999)
15579  ENDIF
15580  ELSE
15581  CALL flagerror("Field is not associated.",err,error,*999)
15582  ENDIF
15583 
15584  exits("FIELD_PARAMETER_SET_ADD_ELEMENT_DP")
15585  RETURN
15586 999 errorsexits("FIELD_PARAMETER_SET_ADD_ELEMENT_DP",err,error)
15587  RETURN 1
15588  END SUBROUTINE field_parameter_set_add_element_dp
15589 
15590  !
15591  !================================================================================================================================
15592  !
15593 
15595  SUBROUTINE field_parameter_set_add_element_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
15596  & VALUE,err,error,*)
15597 
15598  !Argument variables
15599  TYPE(field_type), POINTER :: field
15600  INTEGER(INTG), INTENT(IN) :: variable_type
15601  INTEGER(INTG), INTENT(IN) :: field_set_type
15602  INTEGER(INTG), INTENT(IN) :: user_element_number
15603  INTEGER(INTG), INTENT(IN) :: component_number
15604  LOGICAL, INTENT(IN) :: VALUE
15605  INTEGER(INTG), INTENT(OUT) :: err
15606  TYPE(varying_string), INTENT(OUT) :: error
15607  !Local Variables
15608  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
15609  LOGICAL :: ghost_element,user_element_exists
15610  TYPE(decomposition_type), POINTER :: decomposition
15611  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
15612  TYPE(field_parameter_set_type), POINTER :: parameter_set
15613  TYPE(field_variable_type), POINTER :: field_variable
15614  TYPE(varying_string) :: local_error
15615 
15616  enters("FIELD_PARAMETER_SET_ADD_ELEMENT_L",err,error,*999)
15617 
15618  IF(ASSOCIATED(field)) THEN
15619  IF(field%FIELD_FINISHED) THEN
15620  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
15621  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
15622  IF(ASSOCIATED(field_variable)) THEN
15623  IF(field_variable%DATA_TYPE==field_l_type) THEN
15624  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
15625  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
15626  IF(ASSOCIATED(parameter_set)) THEN
15627  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
15628  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
15629  CASE(field_constant_interpolation)
15630  local_error="Can not add element for component number "// &
15631  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15632  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15633  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
15634  CALL flagerror(local_error,err,error,*999)
15635  CASE(field_element_based_interpolation)
15636  decomposition=>field%DECOMPOSITION
15637  IF(ASSOCIATED(decomposition)) THEN
15638  decomposition_topology=>decomposition%TOPOLOGY
15639  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
15640  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
15641  IF(user_element_exists) THEN
15642  IF(ghost_element) THEN
15643  local_error="Cannot add element for user element "// &
15644  & trim(number_to_vstring(user_element_number,"*",err,error))//" as it is a ghost element."
15645  CALL flagerror(local_error,err,error,*999)
15646  ELSE
15647  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
15648  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
15649  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
15650  ENDIF
15651  ELSE
15652  local_error="The specified user element number of "// &
15653  & trim(number_to_vstring(user_element_number,"*",err,error))// &
15654  & " does not exist in the decomposition for field component number "// &
15655  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
15656  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15657  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15658  CALL flagerror(local_error,err,error,*999)
15659  ENDIF
15660  ELSE
15661  CALL flagerror("Field decomposition is not associated.",err,error,*999)
15662  ENDIF
15663  CASE(field_node_based_interpolation)
15664  local_error="Can not add element for component number "// &
15665  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15666  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15667  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
15668  CALL flagerror(local_error,err,error,*999)
15669  CASE(field_grid_point_based_interpolation)
15670  local_error="Can not add element for component number "// &
15671  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15672  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15673  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
15674  CALL flagerror(local_error,err,error,*999)
15675  CASE(field_gauss_point_based_interpolation)
15676  local_error="Can not add element for component number "// &
15677  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15678  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15679  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
15680  CALL flagerror(local_error,err,error,*999)
15681  CASE(field_data_point_based_interpolation)
15682  local_error="Can not add element for component number "// &
15683  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15684  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15685  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
15686  CALL flagerror(local_error,err,error,*999)
15687  CASE DEFAULT
15688  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
15689  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
15690  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15691  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15692  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15693  CALL flagerror(local_error,err,error,*999)
15694  END SELECT
15695  ELSE
15696  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
15697  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
15698  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
15699  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
15700  & " components."
15701  CALL flagerror(local_error,err,error,*999)
15702  ENDIF
15703  ELSE
15704  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15705  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15706  CALL flagerror(local_error,err,error,*999)
15707  ENDIF
15708  ELSE
15709  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15710  & " is invalid. The field parameter set type must be between 1 and "// &
15711  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
15712  CALL flagerror(local_error,err,error,*999)
15713  ENDIF
15714  ELSE
15715  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
15716  & " does not correspond to the double precision data type of the given value."
15717  CALL flagerror(local_error,err,error,*999)
15718  ENDIF
15719  ELSE
15720  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15721  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15722  CALL flagerror(local_error,err,error,*999)
15723  ENDIF
15724  ELSE
15725  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15726  & " is invalid. The variable type must be between 1 and "// &
15727  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
15728  CALL flagerror(local_error,err,error,*999)
15729  ENDIF
15730  ELSE
15731  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
15732  & " has not been finished."
15733  CALL flagerror(local_error,err,error,*999)
15734  ENDIF
15735  ELSE
15736  CALL flagerror("Field is not associated.",err,error,*999)
15737  ENDIF
15738 
15739  exits("FIELD_PARAMETER_SET_ADD_ELEMENT_L")
15740  RETURN
15741 999 errorsexits("FIELD_PARAMETER_SET_ADD_ELEMENT_L",err,error)
15742  RETURN 1
15743  END SUBROUTINE field_parameter_set_add_element_l
15744 
15745  !
15746  !================================================================================================================================
15747  !
15748 
15750  SUBROUTINE field_parameter_set_add_local_element_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,LOCAL_ELEMENT_NUMBER,COMPONENT_NUMBER, &
15751  & VALUE,err,error,*)
15752 
15753  !Argument variables
15754  TYPE(field_type), POINTER :: field
15755  INTEGER(INTG), INTENT(IN) :: variable_type
15756  INTEGER(INTG), INTENT(IN) :: field_set_type
15757  INTEGER(INTG), INTENT(IN) :: local_element_number
15758  INTEGER(INTG), INTENT(IN) :: component_number
15759  INTEGER(INTG), INTENT(IN) :: VALUE
15760  INTEGER(INTG), INTENT(OUT) :: err
15761  TYPE(varying_string), INTENT(OUT) :: error
15762  !Local Variables
15763  INTEGER(INTG) :: ny
15764  TYPE(field_parameter_set_type), POINTER :: parameter_set
15765  TYPE(field_variable_type), POINTER :: field_variable
15766  TYPE(varying_string) :: local_error
15767 
15768  enters("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_INTG",err,error,*999)
15769 
15770  IF(ASSOCIATED(field)) THEN
15771  IF(field%FIELD_FINISHED) THEN
15772  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
15773  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
15774  IF(ASSOCIATED(field_variable)) THEN
15775  IF(field_variable%DATA_TYPE==field_intg_type) THEN
15776  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
15777  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
15778  IF(ASSOCIATED(parameter_set)) THEN
15779  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
15780  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
15781  CASE(field_constant_interpolation)
15782  local_error="Can not add element for component number "// &
15783  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15784  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15785  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
15786  CALL flagerror(local_error,err,error,*999)
15787  CASE(field_element_based_interpolation)
15788  IF(local_element_number>0.AND.local_element_number<=field_variable%COMPONENTS(component_number)% &
15789  & param_to_dof_map%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS) THEN
15790  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS( &
15791  & local_element_number)
15792  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
15793  ELSE
15794  local_error="Local element number "//trim(number_to_vstring(local_element_number,"*",err,error))// &
15795  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
15796  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
15797  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
15798  & " which has "//trim(number_to_vstring(field_variable%COMPONENTS(component_number)% &
15799  & param_to_dof_map%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" elements."
15800  CALL flagerror(local_error,err,error,*999)
15801  ENDIF
15802  CASE(field_node_based_interpolation)
15803  local_error="Can not add element for component number "// &
15804  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15805  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15806  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
15807  CALL flagerror(local_error,err,error,*999)
15808  CASE(field_grid_point_based_interpolation)
15809  local_error="Can not add element for component number "// &
15810  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15811  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15812  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
15813  CALL flagerror(local_error,err,error,*999)
15814  CASE(field_gauss_point_based_interpolation)
15815  local_error="Can not add element for component number "// &
15816  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15817  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15818  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
15819  CALL flagerror(local_error,err,error,*999)
15820  CASE(field_data_point_based_interpolation)
15821  local_error="Can not add element for component number "// &
15822  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15823  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15824  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
15825  CALL flagerror(local_error,err,error,*999)
15826  CASE DEFAULT
15827  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
15828  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
15829  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15830  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15831  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15832  CALL flagerror(local_error,err,error,*999)
15833  END SELECT
15834  ELSE
15835  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
15836  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
15837  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
15838  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
15839  & " components."
15840  CALL flagerror(local_error,err,error,*999)
15841  ENDIF
15842  ELSE
15843  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15844  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15845  CALL flagerror(local_error,err,error,*999)
15846  ENDIF
15847  ELSE
15848  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15849  & " is invalid. The field parameter set type must be between 1 and "// &
15850  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
15851  CALL flagerror(local_error,err,error,*999)
15852  ENDIF
15853  ELSE
15854  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
15855  & " does not correspond to the integer data type of the given value."
15856  CALL flagerror(local_error,err,error,*999)
15857  ENDIF
15858  ELSE
15859  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15860  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15861  CALL flagerror(local_error,err,error,*999)
15862  ENDIF
15863  ELSE
15864  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15865  & " is invalid. The variable type must be between 1 and "// &
15866  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
15867  CALL flagerror(local_error,err,error,*999)
15868  ENDIF
15869  ELSE
15870  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
15871  & " has not been finished."
15872  CALL flagerror(local_error,err,error,*999)
15873  ENDIF
15874  ELSE
15875  CALL flagerror("Field is not associated.",err,error,*999)
15876  ENDIF
15877 
15878  exits("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_INTG")
15879  RETURN
15880 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_INTG",err,error)
15881  RETURN 1
15882  END SUBROUTINE field_parameter_set_add_local_element_intg
15883 
15884  !
15885  !================================================================================================================================
15886  !
15887 
15889  SUBROUTINE field_parameter_set_add_local_element_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,LOCAL_ELEMENT_NUMBER,COMPONENT_NUMBER, &
15890  & VALUE,err,error,*)
15891 
15892  !Argument variables
15893  TYPE(field_type), POINTER :: field
15894  INTEGER(INTG), INTENT(IN) :: variable_type
15895  INTEGER(INTG), INTENT(IN) :: field_set_type
15896  INTEGER(INTG), INTENT(IN) :: local_element_number
15897  INTEGER(INTG), INTENT(IN) :: component_number
15898  REAL(SP), INTENT(IN) :: VALUE
15899  INTEGER(INTG), INTENT(OUT) :: err
15900  TYPE(varying_string), INTENT(OUT) :: error
15901  !Local Variables
15902  INTEGER(INTG) :: ny
15903  TYPE(field_parameter_set_type), POINTER :: parameter_set
15904  TYPE(field_variable_type), POINTER :: field_variable
15905  TYPE(varying_string) :: local_error
15906 
15907  enters("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_SP",err,error,*999)
15908 
15909  IF(ASSOCIATED(field)) THEN
15910  IF(field%FIELD_FINISHED) THEN
15911  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
15912  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
15913  IF(ASSOCIATED(field_variable)) THEN
15914  IF(field_variable%DATA_TYPE==field_sp_type) THEN
15915  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
15916  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
15917  IF(ASSOCIATED(parameter_set)) THEN
15918  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
15919  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
15920  CASE(field_constant_interpolation)
15921  local_error="Can not add element for component number "// &
15922  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15923  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15924  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
15925  CALL flagerror(local_error,err,error,*999)
15926  CASE(field_element_based_interpolation)
15927  IF(local_element_number>0.AND.local_element_number<=field_variable%COMPONENTS(component_number)% &
15928  & param_to_dof_map%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS) THEN
15929  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS( &
15930  & local_element_number)
15931  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
15932  ELSE
15933  local_error="Local element number "//trim(number_to_vstring(local_element_number,"*",err,error))// &
15934  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
15935  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
15936  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
15937  & " which has "//trim(number_to_vstring(field_variable%COMPONENTS(component_number)% &
15938  & param_to_dof_map%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" elements."
15939  CALL flagerror(local_error,err,error,*999)
15940  ENDIF
15941  CASE(field_node_based_interpolation)
15942  local_error="Can not add element for component number "// &
15943  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15944  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15945  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
15946  CALL flagerror(local_error,err,error,*999)
15947  CASE(field_grid_point_based_interpolation)
15948  local_error="Can not add element for component number "// &
15949  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15950  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15951  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
15952  CALL flagerror(local_error,err,error,*999)
15953  CASE(field_gauss_point_based_interpolation)
15954  local_error="Can not add element for component number "// &
15955  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15956  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15957  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
15958  CALL flagerror(local_error,err,error,*999)
15959  CASE(field_data_point_based_interpolation)
15960  local_error="Can not add element for component number "// &
15961  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15962  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15963  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
15964  CALL flagerror(local_error,err,error,*999)
15965  CASE DEFAULT
15966  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
15967  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
15968  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
15969  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
15970  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15971  CALL flagerror(local_error,err,error,*999)
15972  END SELECT
15973  ELSE
15974  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
15975  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
15976  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
15977  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
15978  & " components."
15979  CALL flagerror(local_error,err,error,*999)
15980  ENDIF
15981  ELSE
15982  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15983  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
15984  CALL flagerror(local_error,err,error,*999)
15985  ENDIF
15986  ELSE
15987  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
15988  & " is invalid. The field parameter set type must be between 1 and "// &
15989  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
15990  CALL flagerror(local_error,err,error,*999)
15991  ENDIF
15992  ELSE
15993  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
15994  & " does not correspond to the single precision data type of the given value."
15995  CALL flagerror(local_error,err,error,*999)
15996  ENDIF
15997  ELSE
15998  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
15999  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16000  CALL flagerror(local_error,err,error,*999)
16001  ENDIF
16002  ELSE
16003  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16004  & " is invalid. The variable type must be between 1 and "// &
16005  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
16006  CALL flagerror(local_error,err,error,*999)
16007  ENDIF
16008  ELSE
16009  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
16010  & " has not been finished."
16011  CALL flagerror(local_error,err,error,*999)
16012  ENDIF
16013  ELSE
16014  CALL flagerror("Field is not associated.",err,error,*999)
16015  ENDIF
16016 
16017  exits("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_SP")
16018  RETURN
16019 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_SP",err,error)
16020  RETURN 1
16021  END SUBROUTINE field_parameter_set_add_local_element_sp
16022 
16023  !
16024  !================================================================================================================================
16025  !
16026 
16028  SUBROUTINE field_parameter_set_add_local_element_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,LOCAL_ELEMENT_NUMBER,COMPONENT_NUMBER, &
16029  & VALUE,err,error,*)
16030 
16031  !Argument variables
16032  TYPE(field_type), POINTER :: field
16033  INTEGER(INTG), INTENT(IN) :: variable_type
16034  INTEGER(INTG), INTENT(IN) :: field_set_type
16035  INTEGER(INTG), INTENT(IN) :: local_element_number
16036  INTEGER(INTG), INTENT(IN) :: component_number
16037  REAL(DP), INTENT(IN) :: VALUE
16038  INTEGER(INTG), INTENT(OUT) :: err
16039  TYPE(varying_string), INTENT(OUT) :: error
16040  !Local Variables
16041  INTEGER(INTG) :: ny
16042  TYPE(field_parameter_set_type), POINTER :: parameter_set
16043  TYPE(field_variable_type), POINTER :: field_variable
16044  TYPE(varying_string) :: local_error
16045 
16046  enters("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_DP",err,error,*999)
16047 
16048  IF(ASSOCIATED(field)) THEN
16049  IF(field%FIELD_FINISHED) THEN
16050  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
16051  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
16052  IF(ASSOCIATED(field_variable)) THEN
16053  IF(field_variable%DATA_TYPE==field_dp_type) THEN
16054  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
16055  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
16056  IF(ASSOCIATED(parameter_set)) THEN
16057  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
16058  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
16059  CASE(field_constant_interpolation)
16060  local_error="Can not add element for component number "// &
16061  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16062  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16063  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
16064  CALL flagerror(local_error,err,error,*999)
16065  CASE(field_element_based_interpolation)
16066  IF(local_element_number>0.AND.local_element_number<=field_variable%COMPONENTS(component_number)% &
16067  & param_to_dof_map%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS) THEN
16068  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS( &
16069  & local_element_number)
16070  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
16071  ELSE
16072  local_error="Local element number "//trim(number_to_vstring(local_element_number,"*",err,error))// &
16073  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
16074  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
16075  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
16076  & " which has "//trim(number_to_vstring(field_variable%COMPONENTS(component_number)% &
16077  & param_to_dof_map%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" elements."
16078  CALL flagerror(local_error,err,error,*999)
16079  ENDIF
16080  CASE(field_node_based_interpolation)
16081  local_error="Can not add element for component number "// &
16082  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16083  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16084  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
16085  CALL flagerror(local_error,err,error,*999)
16086  CASE(field_grid_point_based_interpolation)
16087  local_error="Can not add element for component number "// &
16088  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16089  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16090  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
16091  CALL flagerror(local_error,err,error,*999)
16092  CASE(field_gauss_point_based_interpolation)
16093  local_error="Can not add element for component number "// &
16094  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16095  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16096  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
16097  CALL flagerror(local_error,err,error,*999)
16098  CASE(field_data_point_based_interpolation)
16099  local_error="Can not add element for component number "// &
16100  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16101  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16102  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
16103  CALL flagerror(local_error,err,error,*999)
16104  CASE DEFAULT
16105  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
16106  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
16107  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16108  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16109  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16110  CALL flagerror(local_error,err,error,*999)
16111  END SELECT
16112  ELSE
16113  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
16114  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
16115  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
16116  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
16117  & " components."
16118  CALL flagerror(local_error,err,error,*999)
16119  ENDIF
16120  ELSE
16121  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
16122  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16123  CALL flagerror(local_error,err,error,*999)
16124  ENDIF
16125  ELSE
16126  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
16127  & " is invalid. The field parameter set type must be between 1 and "// &
16128  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
16129  CALL flagerror(local_error,err,error,*999)
16130  ENDIF
16131  ELSE
16132  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
16133  & " does not correspond to the double precision data type of the given value."
16134  CALL flagerror(local_error,err,error,*999)
16135  ENDIF
16136  ELSE
16137  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16138  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16139  CALL flagerror(local_error,err,error,*999)
16140  ENDIF
16141  ELSE
16142  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16143  & " is invalid. The variable type must be between 1 and "// &
16144  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
16145  CALL flagerror(local_error,err,error,*999)
16146  ENDIF
16147  ELSE
16148  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
16149  & " has not been finished."
16150  CALL flagerror(local_error,err,error,*999)
16151  ENDIF
16152  ELSE
16153  CALL flagerror("Field is not associated.",err,error,*999)
16154  ENDIF
16155 
16156  exits("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_DP")
16157  RETURN
16158 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_DP",err,error)
16159  RETURN 1
16160  END SUBROUTINE field_parameter_set_add_local_element_dp
16161 
16162  !
16163  !================================================================================================================================
16164  !
16165 
16167  SUBROUTINE field_parameter_set_add_local_element_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,LOCAL_ELEMENT_NUMBER,COMPONENT_NUMBER, &
16168  & VALUE,err,error,*)
16169 
16170  !Argument variables
16171  TYPE(field_type), POINTER :: field
16172  INTEGER(INTG), INTENT(IN) :: variable_type
16173  INTEGER(INTG), INTENT(IN) :: field_set_type
16174  INTEGER(INTG), INTENT(IN) :: local_element_number
16175  INTEGER(INTG), INTENT(IN) :: component_number
16176  LOGICAL, INTENT(IN) :: VALUE
16177  INTEGER(INTG), INTENT(OUT) :: err
16178  TYPE(varying_string), INTENT(OUT) :: error
16179  !Local Variables
16180  INTEGER(INTG) :: ny
16181  TYPE(field_parameter_set_type), POINTER :: parameter_set
16182  TYPE(field_variable_type), POINTER :: field_variable
16183  TYPE(varying_string) :: local_error
16184 
16185  enters("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_L",err,error,*999)
16186 
16187  IF(ASSOCIATED(field)) THEN
16188  IF(field%FIELD_FINISHED) THEN
16189  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
16190  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
16191  IF(ASSOCIATED(field_variable)) THEN
16192  IF(field_variable%DATA_TYPE==field_l_type) THEN
16193  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
16194  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
16195  IF(ASSOCIATED(parameter_set)) THEN
16196  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
16197  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
16198  CASE(field_constant_interpolation)
16199  local_error="Can not add element for component number "// &
16200  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16201  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16202  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
16203  CALL flagerror(local_error,err,error,*999)
16204  CASE(field_element_based_interpolation)
16205  IF(local_element_number>0.AND.local_element_number<=field_variable%COMPONENTS(component_number)% &
16206  & param_to_dof_map%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS) THEN
16207  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS( &
16208  & local_element_number)
16209  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
16210  ELSE
16211  local_error="Local element number "//trim(number_to_vstring(local_element_number,"*",err,error))// &
16212  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
16213  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
16214  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
16215  & " which has "//trim(number_to_vstring(field_variable%COMPONENTS(component_number)% &
16216  & param_to_dof_map%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" elements."
16217  CALL flagerror(local_error,err,error,*999)
16218  ENDIF
16219  CASE(field_node_based_interpolation)
16220  local_error="Can not add element for component number "// &
16221  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16222  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16223  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
16224  CALL flagerror(local_error,err,error,*999)
16225  CASE(field_grid_point_based_interpolation)
16226  local_error="Can not add element for component number "// &
16227  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16228  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16229  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
16230  CALL flagerror(local_error,err,error,*999)
16231  CASE(field_gauss_point_based_interpolation)
16232  local_error="Can not add element for component number "// &
16233  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16234  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16235  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
16236  CALL flagerror(local_error,err,error,*999)
16237  CASE(field_data_point_based_interpolation)
16238  local_error="Can not add element for component number "// &
16239  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16240  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16241  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
16242  CALL flagerror(local_error,err,error,*999)
16243  CASE DEFAULT
16244  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
16245  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
16246  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16247  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16248  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16249  CALL flagerror(local_error,err,error,*999)
16250  END SELECT
16251  ELSE
16252  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
16253  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
16254  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
16255  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
16256  & " components."
16257  CALL flagerror(local_error,err,error,*999)
16258  ENDIF
16259  ELSE
16260  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
16261  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16262  CALL flagerror(local_error,err,error,*999)
16263  ENDIF
16264  ELSE
16265  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
16266  & " is invalid. The field parameter set type must be between 1 and "// &
16267  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
16268  CALL flagerror(local_error,err,error,*999)
16269  ENDIF
16270  ELSE
16271  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
16272  & " does not correspond to the logical data type of the given value."
16273  CALL flagerror(local_error,err,error,*999)
16274  ENDIF
16275  ELSE
16276  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16277  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16278  CALL flagerror(local_error,err,error,*999)
16279  ENDIF
16280  ELSE
16281  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16282  & " is invalid. The variable type must be between 1 and "// &
16283  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
16284  CALL flagerror(local_error,err,error,*999)
16285  ENDIF
16286  ELSE
16287  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
16288  & " has not been finished."
16289  CALL flagerror(local_error,err,error,*999)
16290  ENDIF
16291  ELSE
16292  CALL flagerror("Field is not associated.",err,error,*999)
16293  ENDIF
16294 
16295  exits("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_L")
16296  RETURN
16297 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_ELEMENT_L",err,error)
16298  RETURN 1
16299  END SUBROUTINE field_parameter_set_add_local_element_l
16300 
16301  !
16302  !================================================================================================================================
16303  !
16304 
16306  SUBROUTINE field_parameter_set_add_node_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
16307  & user_node_number,component_number,VALUE,err,error,*)
16308 
16309  !Argument variables
16310  TYPE(field_type), POINTER :: field
16311  INTEGER(INTG), INTENT(IN) :: variable_type
16312  INTEGER(INTG), INTENT(IN) :: field_set_type
16313  INTEGER(INTG), INTENT(IN) :: version_number
16314  INTEGER(INTG), INTENT(IN) :: derivative_number
16315  INTEGER(INTG), INTENT(IN) :: user_node_number
16316  INTEGER(INTG), INTENT(IN) :: component_number
16317  INTEGER(INTG), INTENT(IN) :: VALUE
16318  INTEGER(INTG), INTENT(OUT) :: err
16319  TYPE(varying_string), INTENT(OUT) :: error
16320  !Local Variables
16321  INTEGER(INTG) :: domain_local_node_number,dof_idx
16322  LOGICAL :: ghost_node,user_node_exists
16323  TYPE(domain_type), POINTER :: domain
16324  TYPE(domain_nodes_type), POINTER :: domain_nodes
16325  TYPE(domain_topology_type), POINTER :: domain_topology
16326  TYPE(field_parameter_set_type), POINTER :: parameter_set
16327  TYPE(field_variable_type), POINTER :: field_variable
16328  TYPE(varying_string) :: local_error
16329 
16330  enters("FIELD_PARAMETER_SET_ADD_NODE_INTG",err,error,*999)
16331 
16332  IF(ASSOCIATED(field)) THEN
16333  IF(field%FIELD_FINISHED) THEN
16334  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
16335  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
16336  IF(ASSOCIATED(field_variable)) THEN
16337  IF(field_variable%DATA_TYPE==field_intg_type) THEN
16338  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
16339  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
16340  IF(ASSOCIATED(parameter_set)) THEN
16341  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
16342  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
16343  CASE(field_constant_interpolation)
16344  local_error="Can not add node for component number "// &
16345  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16346  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16347  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
16348  CALL flagerror(local_error,err,error,*999)
16349  CASE(field_element_based_interpolation)
16350  local_error="Can not add node for component number "// &
16351  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16352  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16353  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
16354  CALL flagerror(local_error,err,error,*999)
16355  CASE(field_node_based_interpolation)
16356  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
16357  IF(ASSOCIATED(domain)) THEN
16358  domain_topology=>domain%TOPOLOGY
16359  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
16360  & domain_local_node_number,ghost_node,err,error,*999)
16361  IF(user_node_exists) THEN
16362  IF(ghost_node) THEN
16363  local_error="Cannot add node for user node "// &
16364  & trim(number_to_vstring(user_node_number,"*",err,error))//" as it is a ghost node."
16365  CALL flagerror(local_error,err,error,*999)
16366  ELSE
16367  domain_nodes=>domain_topology%NODES
16368  IF(ASSOCIATED(domain_nodes)) THEN
16369  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
16370  & number_of_derivatives) THEN
16371  IF(version_number>0.AND.version_number<= &
16372  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
16373  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
16374  & number_of_versions) THEN
16375  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
16376  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
16377  & versions(version_number)
16378  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
16379  ELSE
16380  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
16381  & " is invalid for derivative number "// &
16382  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
16383  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
16384  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16385  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16386  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
16387  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
16388  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
16389  & "(note version numbers are indexed directly from the value the user specifies during "// &
16390  & "element creation and no record is kept of the total number of versions the user sets."// &
16391  & "The maximum version number the user sets defines the total number of versions allocated)."
16392  CALL flagerror(local_error,err,error,*999)
16393  ENDIF
16394  ELSE
16395  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
16396  & " is invalid for user node number "// &
16397  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
16398  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16399  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16400  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
16401  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
16402  & number_of_derivatives,"*",err,error))//" derivatives."
16403  CALL flagerror(local_error,err,error,*999)
16404  ENDIF
16405  ENDIF
16406  ENDIF
16407  ELSE
16408  local_error="The specified user node number of "// &
16409  & trim(number_to_vstring(user_node_number,"*",err,error))// &
16410  & " does not exist in the domain for field component number "// &
16411  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
16412  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16413  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16414  CALL flagerror(local_error,err,error,*999)
16415  ENDIF
16416  ELSE
16417  CALL flagerror("Domain is not associated.",err,error,*999)
16418  ENDIF
16419  CASE(field_grid_point_based_interpolation)
16420  local_error="Can not add element for component number "// &
16421  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16422  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16423  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
16424  CALL flagerror(local_error,err,error,*999)
16425  CASE(field_gauss_point_based_interpolation)
16426  local_error="Can not add element for component number "// &
16427  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16428  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16429  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
16430  CALL flagerror(local_error,err,error,*999)
16431  CASE(field_data_point_based_interpolation)
16432  local_error="Can not add element for component number "// &
16433  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16434  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16435  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
16436  CALL flagerror(local_error,err,error,*999)
16437  CASE DEFAULT
16438  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
16439  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
16440  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16441  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16442  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16443  CALL flagerror(local_error,err,error,*999)
16444  END SELECT
16445  ELSE
16446  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
16447  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
16448  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
16449  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
16450  & " components."
16451  CALL flagerror(local_error,err,error,*999)
16452  ENDIF
16453  ELSE
16454  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
16455  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16456  CALL flagerror(local_error,err,error,*999)
16457  ENDIF
16458  ELSE
16459  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
16460  & " is invalid. The field parameter set type must be between 1 and "// &
16461  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
16462  CALL flagerror(local_error,err,error,*999)
16463  ENDIF
16464  ELSE
16465  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
16466  & " does not correspond to the double precision data type of the given value."
16467  CALL flagerror(local_error,err,error,*999)
16468  ENDIF
16469  ELSE
16470  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16471  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16472  CALL flagerror(local_error,err,error,*999)
16473  ENDIF
16474  ELSE
16475  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16476  & " is invalid. The variable type must be between 1 and "// &
16477  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
16478  CALL flagerror(local_error,err,error,*999)
16479  ENDIF
16480  ELSE
16481  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
16482  & " has not been finished."
16483  CALL flagerror(local_error,err,error,*999)
16484  ENDIF
16485  ELSE
16486  CALL flagerror("Field is not associated.",err,error,*999)
16487  ENDIF
16488 
16489  exits("FIELD_PARAMETER_SET_ADD_NODE_INTG")
16490  RETURN
16491 999 errorsexits("FIELD_PARAMETER_SET_ADD_NODE_INTG",err,error)
16492  RETURN 1
16493  END SUBROUTINE field_parameter_set_add_node_intg
16494 
16495  !
16496  !================================================================================================================================
16497  !
16498 
16500  SUBROUTINE field_parameter_set_add_node_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
16501  & user_node_number,component_number,VALUE,err,error,*)
16502 
16503  !Argument variables
16504  TYPE(field_type), POINTER :: field
16505  INTEGER(INTG), INTENT(IN) :: variable_type
16506  INTEGER(INTG), INTENT(IN) :: field_set_type
16507  INTEGER(INTG), INTENT(IN) :: version_number
16508  INTEGER(INTG), INTENT(IN) :: derivative_number
16509  INTEGER(INTG), INTENT(IN) :: user_node_number
16510  INTEGER(INTG), INTENT(IN) :: component_number
16511  REAL(SP), INTENT(IN) :: VALUE
16512  INTEGER(INTG), INTENT(OUT) :: err
16513  TYPE(varying_string), INTENT(OUT) :: error
16514  !Local Variables
16515  INTEGER(INTG) :: domain_local_node_number,dof_idx
16516  LOGICAL :: ghost_node,user_node_exists
16517  TYPE(domain_type), POINTER :: domain
16518  TYPE(domain_nodes_type), POINTER :: domain_nodes
16519  TYPE(domain_topology_type), POINTER :: domain_topology
16520  TYPE(field_parameter_set_type), POINTER :: parameter_set
16521  TYPE(field_variable_type), POINTER :: field_variable
16522  TYPE(varying_string) :: local_error
16523 
16524  enters("FIELD_PARAMETER_SET_ADD_NODE_SP",err,error,*999)
16525 
16526  IF(ASSOCIATED(field)) THEN
16527  IF(field%FIELD_FINISHED) THEN
16528  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
16529  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
16530  IF(ASSOCIATED(field_variable)) THEN
16531  IF(field_variable%DATA_TYPE==field_sp_type) THEN
16532  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
16533  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
16534  IF(ASSOCIATED(parameter_set)) THEN
16535  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
16536  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
16537  CASE(field_constant_interpolation)
16538  local_error="Can not add node for component number "// &
16539  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16540  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16541  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
16542  CALL flagerror(local_error,err,error,*999)
16543  CASE(field_element_based_interpolation)
16544  local_error="Can not add node for component number "// &
16545  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16546  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16547  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
16548  CALL flagerror(local_error,err,error,*999)
16549  CASE(field_node_based_interpolation)
16550  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
16551  IF(ASSOCIATED(domain)) THEN
16552  domain_topology=>domain%TOPOLOGY
16553  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
16554  & domain_local_node_number,ghost_node,err,error,*999)
16555  IF(user_node_exists) THEN
16556  IF(ghost_node) THEN
16557  local_error="Cannot add node for user node "// &
16558  & trim(number_to_vstring(user_node_number,"*",err,error))//" as it is a ghost node."
16559  CALL flagerror(local_error,err,error,*999)
16560  ELSE
16561  domain_nodes=>domain_topology%NODES
16562  IF(ASSOCIATED(domain_nodes)) THEN
16563  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
16564  & number_of_derivatives) THEN
16565  IF(version_number>0.AND.version_number<= &
16566  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
16567  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
16568  & number_of_versions) THEN
16569  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
16570  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
16571  & versions(version_number)
16572  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
16573  ELSE
16574  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
16575  & " is invalid for derivative number "// &
16576  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
16577  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
16578  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16579  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16580  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
16581  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
16582  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
16583  & "(note version numbers are indexed directly from the value the user specifies during "// &
16584  & "element creation and no record is kept of the total number of versions the user sets."// &
16585  & "The maximum version number the user sets defines the total number of versions allocated)."
16586  CALL flagerror(local_error,err,error,*999)
16587  ENDIF
16588  ELSE
16589  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
16590  & " is invalid for user node number "// &
16591  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
16592  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16593  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16594  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
16595  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
16596  & number_of_derivatives,"*",err,error))//" derivatives."
16597  CALL flagerror(local_error,err,error,*999)
16598  ENDIF
16599  ENDIF
16600  ENDIF
16601  ELSE
16602  local_error="The specified user node number of "// &
16603  & trim(number_to_vstring(user_node_number,"*",err,error))// &
16604  & " does not exist in the domain for field component number "// &
16605  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
16606  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16607  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16608  CALL flagerror(local_error,err,error,*999)
16609  ENDIF
16610  ELSE
16611  CALL flagerror("Domain is not associated.",err,error,*999)
16612  ENDIF
16613  CASE(field_grid_point_based_interpolation)
16614  local_error="Can not add element for component number "// &
16615  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16616  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16617  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
16618  CALL flagerror(local_error,err,error,*999)
16619  CASE(field_gauss_point_based_interpolation)
16620  local_error="Can not add element for component number "// &
16621  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16622  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16623  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
16624  CALL flagerror(local_error,err,error,*999)
16625  CASE(field_data_point_based_interpolation)
16626  local_error="Can not add element for component number "// &
16627  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16628  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16629  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
16630  CALL flagerror(local_error,err,error,*999)
16631  CASE DEFAULT
16632  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
16633  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
16634  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16635  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16636  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16637  CALL flagerror(local_error,err,error,*999)
16638  END SELECT
16639  ELSE
16640  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
16641  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
16642  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
16643  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
16644  & " components."
16645  CALL flagerror(local_error,err,error,*999)
16646  ENDIF
16647  ELSE
16648  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
16649  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16650  CALL flagerror(local_error,err,error,*999)
16651  ENDIF
16652  ELSE
16653  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
16654  & " is invalid. The field parameter set type must be between 1 and "// &
16655  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
16656  CALL flagerror(local_error,err,error,*999)
16657  ENDIF
16658  ELSE
16659  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
16660  & " does not correspond to the double precision data type of the given value."
16661  CALL flagerror(local_error,err,error,*999)
16662  ENDIF
16663  ELSE
16664  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16665  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16666  CALL flagerror(local_error,err,error,*999)
16667  ENDIF
16668  ELSE
16669  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16670  & " is invalid. The variable type must be between 1 and "// &
16671  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
16672  CALL flagerror(local_error,err,error,*999)
16673  ENDIF
16674  ELSE
16675  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
16676  & " has not been finished."
16677  CALL flagerror(local_error,err,error,*999)
16678  ENDIF
16679  ELSE
16680  CALL flagerror("Field is not associated.",err,error,*999)
16681  ENDIF
16682 
16683  exits("FIELD_PARAMETER_SET_ADD_NODE_SP")
16684  RETURN
16685 999 errorsexits("FIELD_PARAMETER_SET_ADD_NODE_SP",err,error)
16686  RETURN 1
16687  END SUBROUTINE field_parameter_set_add_node_sp
16688 
16689  !
16690  !================================================================================================================================
16691  !
16692 
16694  SUBROUTINE field_parameter_set_add_node_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
16695  & user_node_number,component_number,VALUE,err,error,*)
16696 
16697  !Argument variables
16698  TYPE(field_type), POINTER :: field
16699  INTEGER(INTG), INTENT(IN) :: variable_type
16700  INTEGER(INTG), INTENT(IN) :: field_set_type
16701  INTEGER(INTG), INTENT(IN) :: version_number
16702  INTEGER(INTG), INTENT(IN) :: derivative_number
16703  INTEGER(INTG), INTENT(IN) :: user_node_number
16704  INTEGER(INTG), INTENT(IN) :: component_number
16705  REAL(DP), INTENT(IN) :: VALUE
16706  INTEGER(INTG), INTENT(OUT) :: err
16707  TYPE(varying_string), INTENT(OUT) :: error
16708  !Local Variables
16709  INTEGER(INTG) :: domain_local_node_number,dof_idx
16710  LOGICAL :: ghost_node,user_node_exists
16711  TYPE(domain_type), POINTER :: domain
16712  TYPE(domain_nodes_type), POINTER :: domain_nodes
16713  TYPE(domain_topology_type), POINTER :: domain_topology
16714  TYPE(field_parameter_set_type), POINTER :: parameter_set
16715  TYPE(field_variable_type), POINTER :: field_variable
16716  TYPE(varying_string) :: local_error
16717 
16718  enters("FIELD_PARAMETER_SET_ADD_NODE_DP",err,error,*999)
16719 
16720  IF(ASSOCIATED(field)) THEN
16721  IF(field%FIELD_FINISHED) THEN
16722  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
16723  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
16724  IF(ASSOCIATED(field_variable)) THEN
16725  IF(field_variable%DATA_TYPE==field_dp_type) THEN
16726  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
16727  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
16728  IF(ASSOCIATED(parameter_set)) THEN
16729  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
16730  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
16731  CASE(field_constant_interpolation)
16732  local_error="Can not add node for component number "// &
16733  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16734  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16735  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
16736  CALL flagerror(local_error,err,error,*999)
16737  CASE(field_element_based_interpolation)
16738  local_error="Can not add node for component number "// &
16739  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16740  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16741  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
16742  CALL flagerror(local_error,err,error,*999)
16743  CASE(field_node_based_interpolation)
16744  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
16745  IF(ASSOCIATED(domain)) THEN
16746  domain_topology=>domain%TOPOLOGY
16747  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
16748  & domain_local_node_number,ghost_node,err,error,*999)
16749  IF(user_node_exists) THEN
16750  IF(ghost_node) THEN
16751  local_error="Cannot add node for user node "// &
16752  & trim(number_to_vstring(user_node_number,"*",err,error))//" as it is a ghost node."
16753  CALL flagerror(local_error,err,error,*999)
16754  ELSE
16755  domain_nodes=>domain_topology%NODES
16756  IF(ASSOCIATED(domain_nodes)) THEN
16757  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
16758  & number_of_derivatives) THEN
16759  IF(version_number>0.AND.version_number<= &
16760  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
16761  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
16762  & number_of_versions) THEN
16763  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
16764  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
16765  & versions(version_number)
16766  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
16767  ELSE
16768  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
16769  & " is invalid for derivative number "// &
16770  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
16771  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
16772  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16773  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16774  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
16775  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
16776  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
16777  & "(note version numbers are indexed directly from the value the user specifies during "// &
16778  & "element creation and no record is kept of the total number of versions the user sets."// &
16779  & "The maximum version number the user sets defines the total number of versions allocated)."
16780  CALL flagerror(local_error,err,error,*999)
16781  ENDIF
16782  ELSE
16783  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
16784  & " is invalid for user node number "// &
16785  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
16786  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16787  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16788  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
16789  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
16790  & number_of_derivatives,"*",err,error))//" derivatives."
16791  CALL flagerror(local_error,err,error,*999)
16792  ENDIF
16793  ENDIF
16794  ENDIF
16795  ELSE
16796  local_error="The specified user node number of "// &
16797  & trim(number_to_vstring(user_node_number,"*",err,error))// &
16798  & " does not exist in the domain for field component number "// &
16799  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
16800  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16801  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16802  CALL flagerror(local_error,err,error,*999)
16803  ENDIF
16804  ELSE
16805  CALL flagerror("Domain is not associated.",err,error,*999)
16806  ENDIF
16807  CASE(field_grid_point_based_interpolation)
16808  local_error="Can not add element for component number "// &
16809  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16810  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16811  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
16812  CALL flagerror(local_error,err,error,*999)
16813  CASE(field_gauss_point_based_interpolation)
16814  local_error="Can not add element for component number "// &
16815  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16816  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16817  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
16818  CALL flagerror(local_error,err,error,*999)
16819  CASE(field_data_point_based_interpolation)
16820  local_error="Can not add element for component number "// &
16821  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16822  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16823  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
16824  CALL flagerror(local_error,err,error,*999)
16825  CASE DEFAULT
16826  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
16827  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
16828  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16829  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16830  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16831  CALL flagerror(local_error,err,error,*999)
16832  END SELECT
16833  ELSE
16834  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
16835  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
16836  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
16837  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
16838  & " components."
16839  CALL flagerror(local_error,err,error,*999)
16840  ENDIF
16841  ELSE
16842  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
16843  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16844  CALL flagerror(local_error,err,error,*999)
16845  ENDIF
16846  ELSE
16847  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
16848  & " is invalid. The field parameter set type must be between 1 and "// &
16849  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
16850  CALL flagerror(local_error,err,error,*999)
16851  ENDIF
16852  ELSE
16853  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
16854  & " does not correspond to the double precision data type of the given value."
16855  CALL flagerror(local_error,err,error,*999)
16856  ENDIF
16857  ELSE
16858  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16859  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16860  CALL flagerror(local_error,err,error,*999)
16861  ENDIF
16862  ELSE
16863  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
16864  & " is invalid. The variable type must be between 1 and "// &
16865  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
16866  CALL flagerror(local_error,err,error,*999)
16867  ENDIF
16868  ELSE
16869  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
16870  & " has not been finished."
16871  CALL flagerror(local_error,err,error,*999)
16872  ENDIF
16873  ELSE
16874  CALL flagerror("Field is not associated.",err,error,*999)
16875  ENDIF
16876 
16877  exits("FIELD_PARAMETER_SET_ADD_NODE_DP")
16878  RETURN
16879 999 errorsexits("FIELD_PARAMETER_SET_ADD_NODE_DP",err,error)
16880  RETURN 1
16881  END SUBROUTINE field_parameter_set_add_node_dp
16882 
16883  !
16884  !================================================================================================================================
16885  !
16886 
16888  SUBROUTINE field_parameter_set_add_node_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
16889  & user_node_number,component_number,VALUE,err,error,*)
16890 
16891  !Argument variables
16892  TYPE(field_type), POINTER :: field
16893  INTEGER(INTG), INTENT(IN) :: variable_type
16894  INTEGER(INTG), INTENT(IN) :: field_set_type
16895  INTEGER(INTG), INTENT(IN) :: version_number
16896  INTEGER(INTG), INTENT(IN) :: derivative_number
16897  INTEGER(INTG), INTENT(IN) :: user_node_number
16898  INTEGER(INTG), INTENT(IN) :: component_number
16899  LOGICAL, INTENT(IN) :: VALUE
16900  INTEGER(INTG), INTENT(OUT) :: err
16901  TYPE(varying_string), INTENT(OUT) :: error
16902  !Local Variables
16903  INTEGER(INTG) :: domain_local_node_number,dof_idx
16904  LOGICAL :: ghost_node,user_node_exists
16905  TYPE(domain_type), POINTER :: domain
16906  TYPE(domain_nodes_type), POINTER :: domain_nodes
16907  TYPE(domain_topology_type), POINTER :: domain_topology
16908  TYPE(field_parameter_set_type), POINTER :: parameter_set
16909  TYPE(field_variable_type), POINTER :: field_variable
16910  TYPE(varying_string) :: local_error
16911 
16912  enters("FIELD_PARAMETER_SET_ADD_NODE_L",err,error,*999)
16913 
16914  IF(ASSOCIATED(field)) THEN
16915  IF(field%FIELD_FINISHED) THEN
16916  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
16917  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
16918  IF(ASSOCIATED(field_variable)) THEN
16919  IF(field_variable%DATA_TYPE==field_l_type) THEN
16920  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
16921  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
16922  IF(ASSOCIATED(parameter_set)) THEN
16923  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
16924  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
16925  CASE(field_constant_interpolation)
16926  local_error="Can not add node for component number "// &
16927  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16928  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16929  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
16930  CALL flagerror(local_error,err,error,*999)
16931  CASE(field_element_based_interpolation)
16932  local_error="Can not add node for component number "// &
16933  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16934  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16935  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
16936  CALL flagerror(local_error,err,error,*999)
16937  CASE(field_node_based_interpolation)
16938  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
16939  IF(ASSOCIATED(domain)) THEN
16940  domain_topology=>domain%TOPOLOGY
16941  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
16942  & domain_local_node_number,ghost_node,err,error,*999)
16943  IF(user_node_exists) THEN
16944  IF(ghost_node) THEN
16945  local_error="Cannot add node for user node "// &
16946  & trim(number_to_vstring(user_node_number,"*",err,error))//" as it is a ghost node."
16947  CALL flagerror(local_error,err,error,*999)
16948  ELSE
16949  domain_nodes=>domain_topology%NODES
16950  IF(ASSOCIATED(domain_nodes)) THEN
16951  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
16952  & number_of_derivatives) THEN
16953  IF(version_number>0.AND.version_number<= &
16954  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
16955  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
16956  & number_of_versions) THEN
16957  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
16958  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
16959  & versions(version_number)
16960  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
16961  ELSE
16962  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
16963  & " is invalid for derivative number "// &
16964  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
16965  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
16966  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16967  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16968  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
16969  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
16970  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
16971  & "(note version numbers are indexed directly from the value the user specifies during "// &
16972  & "element creation and no record is kept of the total number of versions the user sets."// &
16973  & "The maximum version number the user sets defines the total number of versions allocated)."
16974  CALL flagerror(local_error,err,error,*999)
16975  ENDIF
16976  ELSE
16977  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*", &
16978  & err,error))//" is invalid for user node number "// &
16979  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
16980  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
16981  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16982  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
16983  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
16984  & number_of_derivatives,"*",err,error))//" derivatives."
16985  CALL flagerror(local_error,err,error,*999)
16986  ENDIF
16987  ENDIF
16988  ENDIF
16989  ELSE
16990  local_error="The specified user node number of "// &
16991  & trim(number_to_vstring(user_node_number,"*",err,error))// &
16992  & " does not exist in the domain for field component number "// &
16993  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
16994  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
16995  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
16996  CALL flagerror(local_error,err,error,*999)
16997  ENDIF
16998  ELSE
16999  CALL flagerror("Domain is not associated.",err,error,*999)
17000  ENDIF
17001  CASE(field_grid_point_based_interpolation)
17002  local_error="Can not add element for component number "// &
17003  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17004  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17005  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
17006  CALL flagerror(local_error,err,error,*999)
17007  CASE(field_gauss_point_based_interpolation)
17008  local_error="Can not add element for component number "// &
17009  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17010  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17011  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
17012  CALL flagerror(local_error,err,error,*999)
17013  CASE(field_data_point_based_interpolation)
17014  local_error="Can not add element for component number "// &
17015  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17016  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17017  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
17018  CALL flagerror(local_error,err,error,*999)
17019  CASE DEFAULT
17020  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
17021  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
17022  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17023  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17024  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17025  CALL flagerror(local_error,err,error,*999)
17026  END SELECT
17027  ELSE
17028  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
17029  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
17030  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
17031  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
17032  & " components."
17033  CALL flagerror(local_error,err,error,*999)
17034  ENDIF
17035  ELSE
17036  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17037  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17038  CALL flagerror(local_error,err,error,*999)
17039  ENDIF
17040  ELSE
17041  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17042  & " is invalid. The field parameter set type must be between 1 and "// &
17043  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
17044  CALL flagerror(local_error,err,error,*999)
17045  ENDIF
17046  ELSE
17047  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
17048  & " does not correspond to the double precision data type of the given value."
17049  CALL flagerror(local_error,err,error,*999)
17050  ENDIF
17051  ELSE
17052  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17053  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17054  CALL flagerror(local_error,err,error,*999)
17055  ENDIF
17056  ELSE
17057  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17058  & " is invalid. The variable type must be between 1 and "// &
17059  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
17060  CALL flagerror(local_error,err,error,*999)
17061  ENDIF
17062  ELSE
17063  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
17064  & " has not been finished."
17065  CALL flagerror(local_error,err,error,*999)
17066  ENDIF
17067  ELSE
17068  CALL flagerror("Field is not associated.",err,error,*999)
17069  ENDIF
17070 
17071  exits("FIELD_PARAMETER_SET_ADD_NODE_L")
17072  RETURN
17073 999 errorsexits("FIELD_PARAMETER_SET_ADD_NODE_L",err,error)
17074  RETURN 1
17075  END SUBROUTINE field_parameter_set_add_node_l
17076 
17077  !
17078  !================================================================================================================================
17079  !
17080 
17082  SUBROUTINE field_parameter_set_add_local_node_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
17083  & local_node_number,component_number,VALUE,err,error,*)
17084 
17085  !Argument variables
17086  TYPE(field_type), POINTER :: field
17087  INTEGER(INTG), INTENT(IN) :: variable_type
17088  INTEGER(INTG), INTENT(IN) :: field_set_type
17089  INTEGER(INTG), INTENT(IN) :: version_number
17090  INTEGER(INTG), INTENT(IN) :: derivative_number
17091  INTEGER(INTG), INTENT(IN) :: local_node_number
17092  INTEGER(INTG), INTENT(IN) :: component_number
17093  INTEGER(INTG), INTENT(IN) :: VALUE
17094  INTEGER(INTG), INTENT(OUT) :: err
17095  TYPE(varying_string), INTENT(OUT) :: error
17096  !Local Variables
17097  INTEGER(INTG) :: dof_idx
17098  TYPE(field_parameter_set_type), POINTER :: parameter_set
17099  TYPE(field_variable_type), POINTER :: field_variable
17100  TYPE(field_node_param_to_dof_map_type), POINTER :: field_nodes
17101  TYPE(varying_string) :: local_error
17102 
17103  enters("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_INTG",err,error,*999)
17104 
17105  IF(ASSOCIATED(field)) THEN
17106  IF(field%FIELD_FINISHED) THEN
17107  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
17108  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
17109  IF(ASSOCIATED(field_variable)) THEN
17110  IF(field_variable%DATA_TYPE==field_intg_type) THEN
17111  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
17112  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
17113  IF(ASSOCIATED(parameter_set)) THEN
17114  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
17115  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
17116  CASE(field_constant_interpolation)
17117  local_error="Can not add node for component number "// &
17118  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17119  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17120  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
17121  CALL flagerror(local_error,err,error,*999)
17122  CASE(field_element_based_interpolation)
17123  local_error="Can not add node for component number "// &
17124  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17125  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17126  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
17127  CALL flagerror(local_error,err,error,*999)
17128  CASE(field_node_based_interpolation)
17129  field_nodes=>field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP
17130  IF(local_node_number>0.AND.local_node_number<=field_nodes%NUMBER_OF_NODE_PARAMETERS) THEN
17131  IF(derivative_number>0.AND.derivative_number<=field_nodes%NODES(local_node_number)% &
17132  & number_of_derivatives) THEN
17133  IF(version_number>0.AND.version_number<= &
17134  & field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)%NUMBER_OF_VERSIONS) THEN
17135  dof_idx=field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)% &
17136  & versions(version_number)
17137  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
17138  ELSE
17139  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
17140  & " is invalid for derivative number "// &
17141  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
17142  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
17143  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17144  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17145  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
17146  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
17147  & derivatives(derivative_number)%NUMBER_OF_VERSIONS,"*",err,error))//" versions "// &
17148  & "(note version numbers are indexed directly from the value the user specifies during "// &
17149  & "element creation and no record is kept of the total number of versions the user sets."// &
17150  & "The maximum version number the user sets defines the total number of versions allocated)."
17151  CALL flagerror(local_error,err,error,*999)
17152  ENDIF
17153  ELSE
17154  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
17155  & " is invalid for user node number "// &
17156  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
17157  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17158  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17159  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
17160  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
17161  & number_of_derivatives,"*",err,error))//" derivatives."
17162  CALL flagerror(local_error,err,error,*999)
17163  ENDIF
17164  ELSE
17165  local_error="Local node number "//trim(number_to_vstring(local_node_number,"*",err,error))// &
17166  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
17167  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
17168  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
17169  & " which has "//trim(number_to_vstring(field_nodes%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" nodes."
17170  CALL flagerror(local_error,err,error,*999)
17171  ENDIF
17172  CASE(field_grid_point_based_interpolation)
17173  local_error="Can not add element for component number "// &
17174  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17175  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17176  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
17177  CALL flagerror(local_error,err,error,*999)
17178  CASE(field_gauss_point_based_interpolation)
17179  local_error="Can not add element for component number "// &
17180  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17181  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17182  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
17183  CALL flagerror(local_error,err,error,*999)
17184  CASE(field_data_point_based_interpolation)
17185  local_error="Can not add element for component number "// &
17186  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17187  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17188  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
17189  CALL flagerror(local_error,err,error,*999)
17190  CASE DEFAULT
17191  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
17192  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
17193  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17194  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17195  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17196  CALL flagerror(local_error,err,error,*999)
17197  END SELECT
17198  ELSE
17199  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
17200  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
17201  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
17202  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
17203  & " components."
17204  CALL flagerror(local_error,err,error,*999)
17205  ENDIF
17206  ELSE
17207  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17208  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17209  CALL flagerror(local_error,err,error,*999)
17210  ENDIF
17211  ELSE
17212  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17213  & " is invalid. The field parameter set type must be between 1 and "// &
17214  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
17215  CALL flagerror(local_error,err,error,*999)
17216  ENDIF
17217  ELSE
17218  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
17219  & " does not correspond to the double precision data type of the given value."
17220  CALL flagerror(local_error,err,error,*999)
17221  ENDIF
17222  ELSE
17223  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17224  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17225  CALL flagerror(local_error,err,error,*999)
17226  ENDIF
17227  ELSE
17228  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17229  & " is invalid. The variable type must be between 1 and "// &
17230  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
17231  CALL flagerror(local_error,err,error,*999)
17232  ENDIF
17233  ELSE
17234  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
17235  & " has not been finished."
17236  CALL flagerror(local_error,err,error,*999)
17237  ENDIF
17238  ELSE
17239  CALL flagerror("Field is not associated.",err,error,*999)
17240  ENDIF
17241 
17242  exits("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_INTG")
17243  RETURN
17244 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_INTG",err,error)
17245  RETURN 1
17246  END SUBROUTINE field_parameter_set_add_local_node_intg
17247 
17248  !
17249  !================================================================================================================================
17250  !
17251 
17253  SUBROUTINE field_parameter_set_add_local_node_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
17254  & local_node_number,component_number,VALUE,err,error,*)
17255 
17256  !Argument variables
17257  TYPE(field_type), POINTER :: field
17258  INTEGER(INTG), INTENT(IN) :: variable_type
17259  INTEGER(INTG), INTENT(IN) :: field_set_type
17260  INTEGER(INTG), INTENT(IN) :: version_number
17261  INTEGER(INTG), INTENT(IN) :: derivative_number
17262  INTEGER(INTG), INTENT(IN) :: local_node_number
17263  INTEGER(INTG), INTENT(IN) :: component_number
17264  REAL(SP), INTENT(IN) :: VALUE
17265  INTEGER(INTG), INTENT(OUT) :: err
17266  TYPE(varying_string), INTENT(OUT) :: error
17267  !Local Variables
17268  INTEGER(INTG) :: dof_idx
17269  TYPE(field_parameter_set_type), POINTER :: parameter_set
17270  TYPE(field_variable_type), POINTER :: field_variable
17271  TYPE(field_node_param_to_dof_map_type), POINTER :: field_nodes
17272  TYPE(varying_string) :: local_error
17273 
17274  enters("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_SP",err,error,*999)
17275 
17276  IF(ASSOCIATED(field)) THEN
17277  IF(field%FIELD_FINISHED) THEN
17278  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
17279  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
17280  IF(ASSOCIATED(field_variable)) THEN
17281  IF(field_variable%DATA_TYPE==field_sp_type) THEN
17282  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
17283  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
17284  IF(ASSOCIATED(parameter_set)) THEN
17285  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
17286  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
17287  CASE(field_constant_interpolation)
17288  local_error="Can not add node for component number "// &
17289  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17290  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17291  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
17292  CALL flagerror(local_error,err,error,*999)
17293  CASE(field_element_based_interpolation)
17294  local_error="Can not add node for component number "// &
17295  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17296  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17297  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
17298  CALL flagerror(local_error,err,error,*999)
17299  CASE(field_node_based_interpolation)
17300  field_nodes=>field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP
17301  IF(local_node_number>0.AND.local_node_number<=field_nodes%NUMBER_OF_NODE_PARAMETERS) THEN
17302  IF(derivative_number>0.AND.derivative_number<=field_nodes%NODES(local_node_number)% &
17303  & number_of_derivatives) THEN
17304  IF(version_number>0.AND.version_number<= &
17305  & field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)%NUMBER_OF_VERSIONS) THEN
17306  dof_idx=field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)% &
17307  & versions(version_number)
17308  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
17309  ELSE
17310  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
17311  & " is invalid for derivative number "// &
17312  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
17313  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
17314  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17315  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17316  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
17317  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
17318  & derivatives(derivative_number)%NUMBER_OF_VERSIONS,"*",err,error))//" versions "// &
17319  & "(note version numbers are indexed directly from the value the user specifies during "// &
17320  & "element creation and no record is kept of the total number of versions the user sets."// &
17321  & "The maximum version number the user sets defines the total number of versions allocated)."
17322  CALL flagerror(local_error,err,error,*999)
17323  ENDIF
17324  ELSE
17325  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
17326  & " is invalid for user node number "// &
17327  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
17328  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17329  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17330  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
17331  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
17332  & number_of_derivatives,"*",err,error))//" derivatives."
17333  CALL flagerror(local_error,err,error,*999)
17334  ENDIF
17335  ELSE
17336  local_error="Local node number "//trim(number_to_vstring(local_node_number,"*",err,error))// &
17337  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
17338  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
17339  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
17340  & " which has "//trim(number_to_vstring(field_nodes%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" nodes."
17341  CALL flagerror(local_error,err,error,*999)
17342  ENDIF
17343  CASE(field_grid_point_based_interpolation)
17344  local_error="Can not add element for component number "// &
17345  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17346  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17347  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
17348  CALL flagerror(local_error,err,error,*999)
17349  CASE(field_gauss_point_based_interpolation)
17350  local_error="Can not add element for component number "// &
17351  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17352  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17353  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
17354  CALL flagerror(local_error,err,error,*999)
17355  CASE(field_data_point_based_interpolation)
17356  local_error="Can not add element for component number "// &
17357  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17358  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17359  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
17360  CALL flagerror(local_error,err,error,*999)
17361  CASE DEFAULT
17362  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
17363  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
17364  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17365  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17366  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17367  CALL flagerror(local_error,err,error,*999)
17368  END SELECT
17369  ELSE
17370  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
17371  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
17372  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
17373  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
17374  & " components."
17375  CALL flagerror(local_error,err,error,*999)
17376  ENDIF
17377  ELSE
17378  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17379  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17380  CALL flagerror(local_error,err,error,*999)
17381  ENDIF
17382  ELSE
17383  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17384  & " is invalid. The field parameter set type must be between 1 and "// &
17385  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
17386  CALL flagerror(local_error,err,error,*999)
17387  ENDIF
17388  ELSE
17389  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
17390  & " does not correspond to the double precision data type of the given value."
17391  CALL flagerror(local_error,err,error,*999)
17392  ENDIF
17393  ELSE
17394  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17395  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17396  CALL flagerror(local_error,err,error,*999)
17397  ENDIF
17398  ELSE
17399  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17400  & " is invalid. The variable type must be between 1 and "// &
17401  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
17402  CALL flagerror(local_error,err,error,*999)
17403  ENDIF
17404  ELSE
17405  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
17406  & " has not been finished."
17407  CALL flagerror(local_error,err,error,*999)
17408  ENDIF
17409  ELSE
17410  CALL flagerror("Field is not associated.",err,error,*999)
17411  ENDIF
17412 
17413  exits("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_SP")
17414  RETURN
17415 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_SP",err,error)
17416  RETURN 1
17417  END SUBROUTINE field_parameter_set_add_local_node_sp
17418 
17419  !
17420  !================================================================================================================================
17421  !
17422 
17424  SUBROUTINE field_parameter_set_add_local_node_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
17425  & local_node_number,component_number,VALUE,err,error,*)
17426 
17427  !Argument variables
17428  TYPE(field_type), POINTER :: field
17429  INTEGER(INTG), INTENT(IN) :: variable_type
17430  INTEGER(INTG), INTENT(IN) :: field_set_type
17431  INTEGER(INTG), INTENT(IN) :: version_number
17432  INTEGER(INTG), INTENT(IN) :: derivative_number
17433  INTEGER(INTG), INTENT(IN) :: local_node_number
17434  INTEGER(INTG), INTENT(IN) :: component_number
17435  REAL(DP), INTENT(IN) :: VALUE
17436  INTEGER(INTG), INTENT(OUT) :: err
17437  TYPE(varying_string), INTENT(OUT) :: error
17438  !Local Variables
17439  INTEGER(INTG) :: dof_idx
17440  TYPE(field_parameter_set_type), POINTER :: parameter_set
17441  TYPE(field_variable_type), POINTER :: field_variable
17442  TYPE(field_node_param_to_dof_map_type), POINTER :: field_nodes
17443  TYPE(varying_string) :: local_error
17444 
17445  enters("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_DP",err,error,*999)
17446 
17447  IF(ASSOCIATED(field)) THEN
17448  IF(field%FIELD_FINISHED) THEN
17449  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
17450  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
17451  IF(ASSOCIATED(field_variable)) THEN
17452  IF(field_variable%DATA_TYPE==field_dp_type) THEN
17453  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
17454  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
17455  IF(ASSOCIATED(parameter_set)) THEN
17456  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
17457  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
17458  CASE(field_constant_interpolation)
17459  local_error="Can not add node for component number "// &
17460  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17461  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17462  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
17463  CALL flagerror(local_error,err,error,*999)
17464  CASE(field_element_based_interpolation)
17465  local_error="Can not add node for component number "// &
17466  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17467  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17468  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
17469  CALL flagerror(local_error,err,error,*999)
17470  CASE(field_node_based_interpolation)
17471  field_nodes=>field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP
17472  IF(local_node_number>0.AND.local_node_number<=field_nodes%NUMBER_OF_NODE_PARAMETERS) THEN
17473  IF(derivative_number>0.AND.derivative_number<=field_nodes%NODES(local_node_number)% &
17474  & number_of_derivatives) THEN
17475  IF(version_number>0.AND.version_number<= &
17476  & field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)%NUMBER_OF_VERSIONS) THEN
17477  dof_idx=field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)% &
17478  & versions(version_number)
17479  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
17480  ELSE
17481  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
17482  & " is invalid for derivative number "// &
17483  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
17484  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
17485  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17486  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17487  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
17488  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
17489  & derivatives(derivative_number)%NUMBER_OF_VERSIONS,"*",err,error))//" versions "// &
17490  & "(note version numbers are indexed directly from the value the user specifies during "// &
17491  & "element creation and no record is kept of the total number of versions the user sets."// &
17492  & "The maximum version number the user sets defines the total number of versions allocated)."
17493  CALL flagerror(local_error,err,error,*999)
17494  ENDIF
17495  ELSE
17496  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
17497  & " is invalid for user node number "// &
17498  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
17499  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17500  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17501  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
17502  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
17503  & number_of_derivatives,"*",err,error))//" derivatives."
17504  CALL flagerror(local_error,err,error,*999)
17505  ENDIF
17506  ELSE
17507  local_error="Local node number "//trim(number_to_vstring(local_node_number,"*",err,error))// &
17508  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
17509  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
17510  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
17511  & " which has "//trim(number_to_vstring(field_nodes%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" nodes."
17512  CALL flagerror(local_error,err,error,*999)
17513  ENDIF
17514  CASE(field_grid_point_based_interpolation)
17515  local_error="Can not add element for component number "// &
17516  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17517  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17518  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
17519  CALL flagerror(local_error,err,error,*999)
17520  CASE(field_gauss_point_based_interpolation)
17521  local_error="Can not add element for component number "// &
17522  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17523  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17524  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
17525  CALL flagerror(local_error,err,error,*999)
17526  CASE(field_data_point_based_interpolation)
17527  local_error="Can not add element for component number "// &
17528  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17529  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17530  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
17531  CALL flagerror(local_error,err,error,*999)
17532  CASE DEFAULT
17533  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
17534  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
17535  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17536  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17537  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17538  CALL flagerror(local_error,err,error,*999)
17539  END SELECT
17540  ELSE
17541  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
17542  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
17543  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
17544  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
17545  & " components."
17546  CALL flagerror(local_error,err,error,*999)
17547  ENDIF
17548  ELSE
17549  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17550  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17551  CALL flagerror(local_error,err,error,*999)
17552  ENDIF
17553  ELSE
17554  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17555  & " is invalid. The field parameter set type must be between 1 and "// &
17556  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
17557  CALL flagerror(local_error,err,error,*999)
17558  ENDIF
17559  ELSE
17560  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
17561  & " does not correspond to the double precision data type of the given value."
17562  CALL flagerror(local_error,err,error,*999)
17563  ENDIF
17564  ELSE
17565  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17566  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17567  CALL flagerror(local_error,err,error,*999)
17568  ENDIF
17569  ELSE
17570  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17571  & " is invalid. The variable type must be between 1 and "// &
17572  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
17573  CALL flagerror(local_error,err,error,*999)
17574  ENDIF
17575  ELSE
17576  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
17577  & " has not been finished."
17578  CALL flagerror(local_error,err,error,*999)
17579  ENDIF
17580  ELSE
17581  CALL flagerror("Field is not associated.",err,error,*999)
17582  ENDIF
17583 
17584  exits("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_DP")
17585  RETURN
17586 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_DP",err,error)
17587  RETURN 1
17588  END SUBROUTINE field_parameter_set_add_local_node_dp
17589 
17590  !
17591  !================================================================================================================================
17592  !
17593 
17595  SUBROUTINE field_parameter_set_add_local_node_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
17596  & local_node_number,component_number,VALUE,err,error,*)
17597 
17598  !Argument variables
17599  TYPE(field_type), POINTER :: field
17600  INTEGER(INTG), INTENT(IN) :: variable_type
17601  INTEGER(INTG), INTENT(IN) :: field_set_type
17602  INTEGER(INTG), INTENT(IN) :: version_number
17603  INTEGER(INTG), INTENT(IN) :: derivative_number
17604  INTEGER(INTG), INTENT(IN) :: local_node_number
17605  INTEGER(INTG), INTENT(IN) :: component_number
17606  LOGICAL, INTENT(IN) :: VALUE
17607  INTEGER(INTG), INTENT(OUT) :: err
17608  TYPE(varying_string), INTENT(OUT) :: error
17609  !Local Variables
17610  INTEGER(INTG) :: dof_idx
17611  TYPE(field_parameter_set_type), POINTER :: parameter_set
17612  TYPE(field_variable_type), POINTER :: field_variable
17613  TYPE(field_node_param_to_dof_map_type), POINTER :: field_nodes
17614  TYPE(varying_string) :: local_error
17615 
17616  enters("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_L",err,error,*999)
17617 
17618  IF(ASSOCIATED(field)) THEN
17619  IF(field%FIELD_FINISHED) THEN
17620  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
17621  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
17622  IF(ASSOCIATED(field_variable)) THEN
17623  IF(field_variable%DATA_TYPE==field_l_type) THEN
17624  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
17625  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
17626  IF(ASSOCIATED(parameter_set)) THEN
17627  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
17628  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
17629  CASE(field_constant_interpolation)
17630  local_error="Can not add node for component number "// &
17631  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17632  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17633  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
17634  CALL flagerror(local_error,err,error,*999)
17635  CASE(field_element_based_interpolation)
17636  local_error="Can not add node for component number "// &
17637  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17638  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17639  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
17640  CALL flagerror(local_error,err,error,*999)
17641  CASE(field_node_based_interpolation)
17642  field_nodes=>field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP
17643  IF(local_node_number>0.AND.local_node_number<=field_nodes%NUMBER_OF_NODE_PARAMETERS) THEN
17644  IF(derivative_number>0.AND.derivative_number<=field_nodes%NODES(local_node_number)% &
17645  & number_of_derivatives) THEN
17646  IF(version_number>0.AND.version_number<= &
17647  & field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)%NUMBER_OF_VERSIONS) THEN
17648  dof_idx=field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)% &
17649  & versions(version_number)
17650  CALL distributed_vector_values_add(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
17651  ELSE
17652  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
17653  & " is invalid for derivative number "// &
17654  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
17655  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
17656  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17657  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17658  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
17659  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
17660  & derivatives(derivative_number)%NUMBER_OF_VERSIONS,"*",err,error))//" versions "// &
17661  & "(note version numbers are indexed directly from the value the user specifies during "// &
17662  & "element creation and no record is kept of the total number of versions the user sets."// &
17663  & "The maximum version number the user sets defines the total number of versions allocated)."
17664  CALL flagerror(local_error,err,error,*999)
17665  ENDIF
17666  ELSE
17667  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
17668  & " is invalid for user node number "// &
17669  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
17670  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17671  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17672  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
17673  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
17674  & number_of_derivatives,"*",err,error))//" derivatives."
17675  CALL flagerror(local_error,err,error,*999)
17676  ENDIF
17677  ELSE
17678  local_error="Local node number "//trim(number_to_vstring(local_node_number,"*",err,error))// &
17679  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
17680  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
17681  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
17682  & " which has "//trim(number_to_vstring(field_nodes%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" nodes."
17683  CALL flagerror(local_error,err,error,*999)
17684  ENDIF
17685  CASE(field_grid_point_based_interpolation)
17686  local_error="Can not add element for component number "// &
17687  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17688  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17689  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
17690  CALL flagerror(local_error,err,error,*999)
17691  CASE(field_gauss_point_based_interpolation)
17692  local_error="Can not add element for component number "// &
17693  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17694  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17695  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
17696  CALL flagerror(local_error,err,error,*999)
17697  CASE(field_data_point_based_interpolation)
17698  local_error="Can not add element for component number "// &
17699  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17700  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17701  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
17702  CALL flagerror(local_error,err,error,*999)
17703  CASE DEFAULT
17704  local_error="The interpolation type of "//trim(number_to_vstring(field_variable%COMPONENTS( &
17705  & component_number)%INTERPOLATION_TYPE,"*",err,error))//" is invalid for component number "// &
17706  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
17707  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17708  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17709  CALL flagerror(local_error,err,error,*999)
17710  END SELECT
17711  ELSE
17712  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
17713  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
17714  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
17715  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
17716  & " components."
17717  CALL flagerror(local_error,err,error,*999)
17718  ENDIF
17719  ELSE
17720  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17721  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17722  CALL flagerror(local_error,err,error,*999)
17723  ENDIF
17724  ELSE
17725  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17726  & " is invalid. The field parameter set type must be between 1 and "// &
17727  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
17728  CALL flagerror(local_error,err,error,*999)
17729  ENDIF
17730  ELSE
17731  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
17732  & " does not correspond to the double precision data type of the given value."
17733  CALL flagerror(local_error,err,error,*999)
17734  ENDIF
17735  ELSE
17736  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17737  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17738  CALL flagerror(local_error,err,error,*999)
17739  ENDIF
17740  ELSE
17741  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17742  & " is invalid. The variable type must be between 1 and "// &
17743  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
17744  CALL flagerror(local_error,err,error,*999)
17745  ENDIF
17746  ELSE
17747  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
17748  & " has not been finished."
17749  CALL flagerror(local_error,err,error,*999)
17750  ENDIF
17751  ELSE
17752  CALL flagerror("Field is not associated.",err,error,*999)
17753  ENDIF
17754 
17755  exits("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_L")
17756  RETURN
17757 999 errorsexits("FIELD_PARAMETER_SET_ADD_LOCAL_NODE_L",err,error)
17758  RETURN 1
17759  END SUBROUTINE field_parameter_set_add_local_node_l
17760 
17761  !
17762  !================================================================================================================================
17763  !
17764 
17767  SUBROUTINE field_parameter_set_create(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,ERR,ERROR,*)
17768 
17769  !Argument variables
17770  TYPE(field_type), POINTER :: field
17771  INTEGER(INTG), INTENT(IN) :: variable_type
17772  INTEGER(INTG), INTENT(IN) :: field_set_type
17773  INTEGER(INTG), INTENT(OUT) :: err
17774  TYPE(varying_string), INTENT(OUT) :: error
17775  !Local Variables
17776  INTEGER(INTG) :: dummy_err,parameter_set_idx
17777  TYPE(field_parameter_set_type), POINTER :: new_parameter_set
17778  TYPE(field_parameter_set_ptr_type), POINTER :: new_parameter_sets(:)
17779  TYPE(field_variable_type), POINTER :: field_variable
17780  TYPE(varying_string) :: local_error,dummy_error
17781 
17782  NULLIFY(new_parameter_set)
17783  NULLIFY(new_parameter_sets)
17784 
17785  enters("FIELD_PARAMETER_SET_CREATE",err,error,*999)
17786 
17787  IF(ASSOCIATED(field)) THEN
17788  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
17789  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
17790  IF(ASSOCIATED(field_variable)) THEN
17791  !Check the set type input
17792  IF(field_set_type>0.AND.field_set_type<field_number_of_set_types) THEN
17793  !Check if this set type has already been created
17794  IF(ASSOCIATED(field_variable%PARAMETER_SETS%SET_TYPE)) THEN
17795  IF(ASSOCIATED(field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR)) THEN
17796  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17797  & " has already been created for variable type of "// &
17798  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
17799  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17800  CALL flagerror(local_error,err,error,*999)
17801  ENDIF
17802  ENDIF
17803  ALLOCATE(new_parameter_set,stat=err)
17804  IF(err/=0) CALL flagerror("Could not allocate new parameter set.",err,error,*999)
17805  CALL field_parameter_set_initialise(new_parameter_set,err,error,*999)
17806  new_parameter_set%SET_INDEX=field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS+1
17807  new_parameter_set%SET_TYPE=field_set_type
17808  NULLIFY(new_parameter_set%PARAMETERS)
17809  CALL distributed_vector_create_start(field_variable%DOMAIN_MAPPING,new_parameter_set%PARAMETERS,err,error,*999)
17810  SELECT CASE(field_variable%DATA_TYPE)
17811  CASE(field_intg_type)
17812  CALL distributed_vector_data_type_set(new_parameter_set%PARAMETERS,distributed_matrix_vector_intg_type, &
17813  & err,error,*999)
17814  CASE(field_sp_type)
17815  CALL distributed_vector_data_type_set(new_parameter_set%PARAMETERS,distributed_matrix_vector_sp_type, &
17816  & err,error,*999)
17817  CASE(field_dp_type)
17818  CALL distributed_vector_data_type_set(new_parameter_set%PARAMETERS,distributed_matrix_vector_dp_type, &
17819  & err,error,*999)
17820  CASE(field_l_type)
17821  CALL distributed_vector_data_type_set(new_parameter_set%PARAMETERS,distributed_matrix_vector_l_type, &
17822  & err,error,*999)
17823  CASE DEFAULT
17824  local_error="The field data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
17825  & " is invalid for variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17826  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17827  CALL flagerror(local_error,err,error,*999)
17828  END SELECT
17829  CALL distributed_vector_create_finish(new_parameter_set%PARAMETERS,err,error,*999)
17830  SELECT CASE(field_variable%DATA_TYPE)
17831  CASE(field_intg_type)
17832  CALL distributed_vector_all_values_set(new_parameter_set%PARAMETERS,0_intg,err,error,*999)
17833  CASE(field_sp_type)
17834  CALL distributed_vector_all_values_set(new_parameter_set%PARAMETERS,0.0_sp,err,error,*999)
17835  CASE(field_dp_type)
17836  CALL distributed_vector_all_values_set(new_parameter_set%PARAMETERS,0.0_dp,err,error,*999)
17837  CASE(field_l_type)
17838  CALL distributed_vector_all_values_set(new_parameter_set%PARAMETERS,.false.,err,error,*999)
17839  END SELECT
17840  !Add the new parameter set to the list of parameter sets
17841  ALLOCATE(new_parameter_sets(field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS+1),stat=err)
17842  IF(err/=0) CALL flagerror("Could not allocate new parameter sets.",err,error,*999)
17843  IF(ASSOCIATED(field_variable%PARAMETER_SETS%PARAMETER_SETS)) THEN
17844  DO parameter_set_idx=1,field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS
17845  new_parameter_sets(parameter_set_idx)%PTR=>field_variable%PARAMETER_SETS%PARAMETER_SETS(parameter_set_idx)%PTR
17846  ENDDO !parameter_set_idx
17847  DEALLOCATE(field_variable%PARAMETER_SETS%PARAMETER_SETS)
17848  ENDIF
17849  new_parameter_sets(field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS+1)%PTR=>new_parameter_set
17850  ALLOCATE(field_variable%PARAMETER_SETS%PARAMETER_SETS(field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS+1), &
17851  & stat=err)
17852  IF(err/=0) CALL flagerror("Could not allocate field parameter sets parameter sets.",err,error,*999)
17853  DO parameter_set_idx=1,field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS+1
17854  field_variable%PARAMETER_SETS%PARAMETER_SETS(parameter_set_idx)%PTR=>new_parameter_sets(parameter_set_idx)%PTR
17855  ENDDO !parameter_set_idx
17856  DEALLOCATE(new_parameter_sets)
17857  field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS=field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS+1
17858  field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR=>new_parameter_set
17859  ELSE
17860  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17861  & " is invalid. The field parameter set type must be between 1 and "// &
17862  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
17863  CALL flagerror(local_error,err,error,*999)
17864  ENDIF
17865  ELSE
17866  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17867  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17868  CALL flagerror(local_error,err,error,*999)
17869  ENDIF
17870  ELSE
17871  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17872  & " is invalid. The variable type must be between 1 and "// &
17873  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
17874  CALL flagerror(local_error,err,error,*999)
17875  ENDIF
17876  ELSE
17877  CALL flagerror("Field is not associated.",err,error,*999)
17878  ENDIF
17879 
17880  exits("FIELD_PARAMETER_SET_CREATE")
17881  RETURN
17882 999 CALL field_parameter_set_finalise(new_parameter_set,dummy_err,dummy_error,*998)
17883 998 IF(ASSOCIATED(new_parameter_sets)) DEALLOCATE(new_parameter_sets)
17884  errorsexits("FIELD_PARAMETER_SET_CREATE",err,error)
17885  RETURN 1
17886  END SUBROUTINE field_parameter_set_create
17887 
17888  !
17889  !================================================================================================================================
17890  !
17891 
17893  SUBROUTINE field_parameter_set_created(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,PARAMETER_SET_CREATED,ERR,ERROR,*)
17894 
17895  !Argument variables
17896  TYPE(field_type), POINTER :: field
17897  INTEGER(INTG), INTENT(IN) :: variable_type
17898  INTEGER(INTG), INTENT(IN) :: field_set_type
17899  LOGICAL, INTENT(OUT) :: parameter_set_created
17900  INTEGER(INTG), INTENT(OUT) :: err
17901  TYPE(varying_string), INTENT(OUT) :: error
17902  !Local Variables
17903  TYPE(field_variable_type), POINTER :: field_variable
17904  TYPE(varying_string) :: local_error
17905 
17906  enters("FIELD_PARAMETER_SET_CREATED",err,error,*999)
17907 
17908  IF(ASSOCIATED(field)) THEN
17909  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
17910  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
17911  IF(ASSOCIATED(field_variable)) THEN
17912  !Check the set type input
17913  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
17914  !Check if this set type has been created
17915  IF(ASSOCIATED(field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR)) THEN
17916  parameter_set_created=.true.
17917  ELSE
17918  parameter_set_created=.false.
17919  END IF
17920  ELSE
17921  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
17922  & " is invalid. The field parameter set type must be between 1 and "// &
17923  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
17924  CALL flagerror(local_error,err,error,*999)
17925  ENDIF
17926  ELSE
17927  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17928  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
17929  CALL flagerror(local_error,err,error,*999)
17930  ENDIF
17931  ELSE
17932  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
17933  & " is invalid. The variable type must be between 1 and "// &
17934  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
17935  CALL flagerror(local_error,err,error,*999)
17936  ENDIF
17937  ELSE
17938  CALL flagerror("Field is not associated.",err,error,*999)
17939  ENDIF
17940 
17941  exits("FIELD_PARAMETER_SET_CREATED")
17942  RETURN
17943 999 errorsexits("FIELD_PARAMETER_SET_CREATED",err,error)
17944  RETURN 1
17945  END SUBROUTINE field_parameter_set_created
17946 
17947  !
17948  !================================================================================================================================
17949  !
17950 
17953  SUBROUTINE field_parametersetensurecreated(field,variableType,fieldSetType,err,error,*)
17954 
17955  !Argument variables
17956  TYPE(field_type), POINTER :: field
17957  INTEGER(INTG), INTENT(IN) :: variabletype
17958  INTEGER(INTG), INTENT(IN) :: fieldsettype
17959  INTEGER(INTG), INTENT(OUT) :: err
17960  TYPE(varying_string), INTENT(OUT) :: error
17961  !Local variables
17962  LOGICAL :: parametersetcreated
17963 
17964  enters("Field_ParameterSetEnsureCreated",err,error,*999)
17965 
17966  CALL field_parameter_set_created(field,variabletype,fieldsettype,parametersetcreated,err,error,*999)
17967  IF(.NOT.parametersetcreated) THEN
17968  CALL field_parameter_set_create(field,variabletype,fieldsettype,err,error,*999)
17969  END IF
17970 
17971  exits("Field_ParameterSetEnsureCreated")
17972  RETURN
17973 999 errorsexits("Field_ParameterSetEnsureCreated",err,error)
17974  RETURN 1
17975  END SUBROUTINE field_parametersetensurecreated
17976 
17977  !
17978  !================================================================================================================================
17979  !
17980 
17982  SUBROUTINE field_parameter_set_destroy(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,ERR,ERROR,*)
17983 
17984  !Argument variables
17985  TYPE(field_type), POINTER :: field
17986  INTEGER(INTG), INTENT(IN) :: variable_type
17987  INTEGER(INTG), INTENT(IN) :: field_set_type
17988  INTEGER(INTG), INTENT(OUT) :: err
17989  TYPE(varying_string), INTENT(OUT) :: error
17990  !Local Variables
17991  INTEGER(INTG) :: parameter_set_idx,set_index
17992  TYPE(field_parameter_set_type), POINTER :: parameter_set
17993  TYPE(field_parameter_set_ptr_type), POINTER :: new_parameter_sets(:)
17994  TYPE(field_variable_type), POINTER :: field_variable
17995  TYPE(varying_string) :: local_error
17996 
17997  NULLIFY(new_parameter_sets)
17998 
17999  enters("FIELD_PARAMETER_SET_DESTROY",err,error,*999)
18000 
18001  IF(ASSOCIATED(field)) THEN
18002  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
18003  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18004  IF(ASSOCIATED(field_variable)) THEN
18005  !Check the set type input
18006  IF(field_set_type>0.AND.field_set_type<field_number_of_set_types) THEN
18007  !Check if the set type has been created
18008  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18009  IF(ASSOCIATED(parameter_set)) THEN
18010  set_index=parameter_set%SET_INDEX
18011  ALLOCATE(new_parameter_sets(field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS-1),stat=err)
18012  IF(err/=0) CALL flagerror("Could not allocate new parameter sets",err,error,*999)
18013  DO parameter_set_idx=1,field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS
18014  IF(parameter_set_idx<set_index) THEN
18015  new_parameter_sets(parameter_set_idx)%PTR=>field_variable%PARAMETER_SETS%PARAMETER_SETS(parameter_set_idx)%PTR
18016  ELSE IF(parameter_set_idx>set_index) THEN
18017  new_parameter_sets(parameter_set_idx-1)%PTR=>field_variable%PARAMETER_SETS%PARAMETER_SETS(parameter_set_idx)%PTR
18018  new_parameter_sets(parameter_set_idx-1)%PTR%SET_INDEX=new_parameter_sets(parameter_set_idx-1)%PTR%SET_INDEX-1
18019  ENDIF
18020  ENDDO !parameter_set_idx
18021  DEALLOCATE(field_variable%PARAMETER_SETS%PARAMETER_SETS)
18022  field_variable%PARAMETER_SETS%PARAMETER_SETS=>new_parameter_sets
18023  field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS=field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS-1
18024  NULLIFY(field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR)
18025  CALL field_parameter_set_finalise(parameter_set,err,error,*999)
18026  ELSE
18027  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18028  & " has not been created for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18029  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18030  CALL flagerror(local_error,err,error,*999)
18031  ENDIF
18032  ELSE
18033  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18034  & " is invalid. The field parameter set type must be between 1 and "// &
18035  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
18036  CALL flagerror(local_error,err,error,*999)
18037  ENDIF
18038  ELSE
18039  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18040  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18041  CALL flagerror(local_error,err,error,*999)
18042  ENDIF
18043  ELSE
18044  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18045  & " is invalid. The variable type must be between 1 and "// &
18046  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18047  CALL flagerror(local_error,err,error,*999)
18048  ENDIF
18049  ELSE
18050  CALL flagerror("Field is not associated.",err,error,*999)
18051  ENDIF
18052 
18053  exits("FIELD_PARAMETER_SET_DESTROY")
18054  RETURN
18055 999 IF(ASSOCIATED(new_parameter_sets)) DEALLOCATE(new_parameter_sets)
18056  errorsexits("FIELD_PARAMETER_SET_DESTROY",err,error)
18057  RETURN 1
18058  END SUBROUTINE field_parameter_set_destroy
18059 
18060  !
18061  !================================================================================================================================
18062  !
18063 
18065  SUBROUTINE field_parameter_set_finalise(FIELD_PARAMETER_SET,ERR,ERROR,*)
18066 
18067  !Argument variables
18068  TYPE(field_parameter_set_type), POINTER :: field_parameter_set
18069  INTEGER(INTG), INTENT(OUT) :: err
18070  TYPE(varying_string), INTENT(OUT) :: error
18071  !Local Variables
18072 
18073  enters("FIELD_PARAMETER_SET_FINALISE",err,error,*999)
18074 
18075  IF(ASSOCIATED(field_parameter_set)) THEN
18076  IF(ASSOCIATED(field_parameter_set%PARAMETERS)) CALL distributed_vector_destroy(field_parameter_set%PARAMETERS,err,error,*999)
18077  DEALLOCATE(field_parameter_set)
18078  ENDIF
18079 
18080  exits("FIELD_PARAMETER_SET_FINALISE")
18081  RETURN
18082 999 errorsexits("FIELD_PARAMETER_SET_FINALISE",err,error)
18083  RETURN 1
18084  END SUBROUTINE field_parameter_set_finalise
18085 
18086  !
18087  !================================================================================================================================
18088  !
18089 
18091  SUBROUTINE field_parameter_set_data_get_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,PARAMETERS,ERR,ERROR,*)
18092 
18093  !Argument variables
18094  TYPE(field_type), POINTER :: field
18095  INTEGER(INTG), INTENT(IN) :: variable_type
18096  INTEGER(INTG), INTENT(IN) :: field_set_type
18097  INTEGER(INTG), POINTER :: parameters(:)
18098  INTEGER(INTG), INTENT(OUT) :: err
18099  TYPE(varying_string), INTENT(OUT) :: error
18100  !Local Variables
18101  TYPE(field_parameter_set_type), POINTER :: parameter_set
18102  TYPE(field_variable_type), POINTER :: field_variable
18103  TYPE(varying_string) :: local_error
18104 
18105  enters("FIELD_PARAMETER_SET_DATA_GET_INTG",err,error,*999)
18106 
18107  IF(ASSOCIATED(field)) THEN
18108  IF(ASSOCIATED(parameters)) THEN
18109  CALL flagerror("Parameters is already associated.",err,error,*999)
18110  ELSE
18111  NULLIFY(parameters)
18112  IF(field%FIELD_FINISHED) THEN
18113  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
18114  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18115  IF(ASSOCIATED(field_variable)) THEN
18116  IF(field_variable%DATA_TYPE==field_intg_type) THEN
18117  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18118  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18119  IF(ASSOCIATED(parameter_set)) THEN
18120  CALL distributed_vector_data_get(parameter_set%PARAMETERS,parameters,err,error,*999)
18121  ELSE
18122  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18123  & " has not been created for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18124  & " on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18125  CALL flagerror(local_error,err,error,*999)
18126  ENDIF
18127  ELSE
18128  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18129  & " is invalid. The field parameter set type must be between 1 and "// &
18130  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
18131  CALL flagerror(local_error,err,error,*999)
18132  ENDIF
18133  ELSE
18134  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
18135  & " does not correspond to the integer data type of the given parameters array."
18136  CALL flagerror(local_error,err,error,*999)
18137  ENDIF
18138  ELSE
18139  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18140  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18141  CALL flagerror(local_error,err,error,*999)
18142  ENDIF
18143  ELSE
18144  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18145  & " is invalid. The variable type must be between 1 and "// &
18146  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18147  CALL flagerror(local_error,err,error,*999)
18148  ENDIF
18149  ELSE
18150  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18151  & " has not been finished."
18152  CALL flagerror(local_error,err,error,*999)
18153  ENDIF
18154  ENDIF
18155  ELSE
18156  CALL flagerror("Field is not associated.",err,error,*999)
18157  ENDIF
18158 
18159  exits("FIELD_PARAMETER_SET_DATA_GET_INTG")
18160  RETURN
18161 999 errorsexits("FIELD_PARAMETER_SET_DATA_GET_INTG",err,error)
18162  RETURN 1
18163  END SUBROUTINE field_parameter_set_data_get_intg
18164 
18165  !
18166  !================================================================================================================================
18167  !
18168 
18170  SUBROUTINE field_parameter_set_data_get_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,PARAMETERS,ERR,ERROR,*)
18171 
18172  !Argument variables
18173  TYPE(field_type), POINTER :: field
18174  INTEGER(INTG), INTENT(IN) :: variable_type
18175  INTEGER(INTG), INTENT(IN) :: field_set_type
18176  REAL(SP), POINTER :: parameters(:)
18177  INTEGER(INTG), INTENT(OUT) :: err
18178  TYPE(varying_string), INTENT(OUT) :: error
18179  !Local Variables
18180  TYPE(field_parameter_set_type), POINTER :: parameter_set
18181  TYPE(field_variable_type), POINTER :: field_variable
18182  TYPE(varying_string) :: local_error
18183 
18184  enters("FIELD_PARAMETER_SET_DATA_GET_SP",err,error,*999)
18185 
18186  IF(ASSOCIATED(field)) THEN
18187  IF(ASSOCIATED(parameters)) THEN
18188  CALL flagerror("Parameters is already associated.",err,error,*999)
18189  ELSE
18190  NULLIFY(parameters)
18191  IF(field%FIELD_FINISHED) THEN
18192  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
18193  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18194  IF(ASSOCIATED(field_variable)) THEN
18195  IF(field_variable%DATA_TYPE==field_sp_type) THEN
18196  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18197  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18198  IF(ASSOCIATED(parameter_set)) THEN
18199  CALL distributed_vector_data_get(parameter_set%PARAMETERS,parameters,err,error,*999)
18200  ELSE
18201  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18202  & " has not been created for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18203  & " on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18204  CALL flagerror(local_error,err,error,*999)
18205  ENDIF
18206  ELSE
18207  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18208  & " is invalid. The field parameter set type must be between 1 and "// &
18209  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
18210  CALL flagerror(local_error,err,error,*999)
18211  ENDIF
18212  ELSE
18213  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
18214  & " does not correspond to the single precision data type of the given parameters array."
18215  CALL flagerror(local_error,err,error,*999)
18216  ENDIF
18217  ELSE
18218  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18219  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18220  CALL flagerror(local_error,err,error,*999)
18221  ENDIF
18222  ELSE
18223  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18224  & " is invalid. The variable type must be between 1 and "// &
18225  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18226  CALL flagerror(local_error,err,error,*999)
18227  ENDIF
18228  ELSE
18229  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18230  & " has not been finished."
18231  CALL flagerror(local_error,err,error,*999)
18232  ENDIF
18233  ENDIF
18234  ELSE
18235  CALL flagerror("Field is not associated.",err,error,*999)
18236  ENDIF
18237 
18238  exits("FIELD_PARAMETER_SET_DATA_GET_SP")
18239  RETURN
18240 999 errorsexits("FIELD_PARAMETER_SET_DATA_GET_SP",err,error)
18241  RETURN 1
18242  END SUBROUTINE field_parameter_set_data_get_sp
18243 
18244  !
18245  !================================================================================================================================
18246  !
18247 
18249  SUBROUTINE field_parameter_set_data_get_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,PARAMETERS,ERR,ERROR,*)
18250 
18251  !Argument variables
18252  TYPE(field_type), POINTER :: field
18253  INTEGER(INTG), INTENT(IN) :: variable_type
18254  INTEGER(INTG), INTENT(IN) :: field_set_type
18255  REAL(DP), POINTER :: parameters(:)
18256  INTEGER(INTG), INTENT(OUT) :: err
18257  TYPE(varying_string), INTENT(OUT) :: error
18258  !Local Variables
18259  TYPE(field_parameter_set_type), POINTER :: parameter_set
18260  TYPE(field_variable_type), POINTER :: field_variable
18261  TYPE(varying_string) :: local_error
18262 
18263  enters("FIELD_PARAMETER_SET_DATA_GET_DP",err,error,*999)
18264 
18265  IF(ASSOCIATED(field)) THEN
18266  IF(ASSOCIATED(parameters)) THEN
18267  CALL flagerror("Parameters is already associated.",err,error,*999)
18268  ELSE
18269  NULLIFY(parameters)
18270  IF(field%FIELD_FINISHED) THEN
18271  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
18272  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18273  IF(ASSOCIATED(field_variable)) THEN
18274  IF(field_variable%DATA_TYPE==field_dp_type) THEN
18275  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18276  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18277  IF(ASSOCIATED(parameter_set)) THEN
18278  CALL distributed_vector_data_get(parameter_set%PARAMETERS,parameters,err,error,*999)
18279  ELSE
18280  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18281  & " has not been created for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18282  & " on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18283  CALL flagerror(local_error,err,error,*999)
18284  ENDIF
18285  ELSE
18286  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18287  & " is invalid. The field parameter set type must be between 1 and "// &
18288  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
18289  CALL flagerror(local_error,err,error,*999)
18290  ENDIF
18291  ELSE
18292  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
18293  & " does not correspond to the double precision data type of the given parameters array."
18294  CALL flagerror(local_error,err,error,*999)
18295  ENDIF
18296  ELSE
18297  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18298  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18299  CALL flagerror(local_error,err,error,*999)
18300  ENDIF
18301  ELSE
18302  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18303  & " is invalid. The variable type must be between 1 and "// &
18304  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18305  CALL flagerror(local_error,err,error,*999)
18306  ENDIF
18307  ELSE
18308  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18309  & " has not been finished."
18310  CALL flagerror(local_error,err,error,*999)
18311  ENDIF
18312  ENDIF
18313  ELSE
18314  CALL flagerror("Field is not associated.",err,error,*999)
18315  ENDIF
18316 
18317  exits("FIELD_PARAMETER_SET_DATA_GET_DP")
18318  RETURN
18319 999 errorsexits("FIELD_PARAMETER_SET_DATA_GET_DP",err,error)
18320  RETURN 1
18321  END SUBROUTINE field_parameter_set_data_get_dp
18322 
18323  !
18324  !================================================================================================================================
18325  !
18326 
18328  SUBROUTINE field_parameter_set_data_get_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,PARAMETERS,ERR,ERROR,*)
18329 
18330  !Argument variables
18331  TYPE(field_type), POINTER :: field
18332  INTEGER(INTG), INTENT(IN) :: variable_type
18333  INTEGER(INTG), INTENT(IN) :: field_set_type
18334  LOGICAL, POINTER :: parameters(:)
18335  INTEGER(INTG), INTENT(OUT) :: err
18336  TYPE(varying_string), INTENT(OUT) :: error
18337  !Local Variables
18338  TYPE(field_parameter_set_type), POINTER :: parameter_set
18339  TYPE(field_variable_type), POINTER :: field_variable
18340  TYPE(varying_string) :: local_error
18341 
18342  enters("FIELD_PARAMETER_SET_DATA_GET_L",err,error,*999)
18343 
18344  IF(ASSOCIATED(field)) THEN
18345  IF(ASSOCIATED(parameters)) THEN
18346  CALL flagerror("Parameters is already associated.",err,error,*999)
18347  ELSE
18348  NULLIFY(parameters)
18349  IF(field%FIELD_FINISHED) THEN
18350  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
18351  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18352  IF(ASSOCIATED(field_variable)) THEN
18353  IF(field_variable%DATA_TYPE==field_l_type) THEN
18354  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18355  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18356  IF(ASSOCIATED(parameter_set)) THEN
18357  CALL distributed_vector_data_get(parameter_set%PARAMETERS,parameters,err,error,*999)
18358  ELSE
18359  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18360  & " has not been created for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18361  & " on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18362  CALL flagerror(local_error,err,error,*999)
18363  ENDIF
18364  ELSE
18365  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18366  & " is invalid. The field parameter set type must be between 1 and "// &
18367  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
18368  CALL flagerror(local_error,err,error,*999)
18369  ENDIF
18370  ELSE
18371  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
18372  & " does not correspond to the logical data type of the given parameters array."
18373  CALL flagerror(local_error,err,error,*999)
18374  ENDIF
18375  ELSE
18376  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18377  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18378  CALL flagerror(local_error,err,error,*999)
18379  ENDIF
18380  ELSE
18381  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18382  & " is invalid. The variable type must be between 1 and "// &
18383  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18384  CALL flagerror(local_error,err,error,*999)
18385  ENDIF
18386  ELSE
18387  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18388  & " has not been finished."
18389  CALL flagerror(local_error,err,error,*999)
18390  ENDIF
18391  ENDIF
18392  ELSE
18393  CALL flagerror("Field is not associated.",err,error,*999)
18394  ENDIF
18395 
18396  exits("FIELD_PARAMETER_SET_DATA_GET_L")
18397  RETURN
18398 999 errorsexits("FIELD_PARAMETER_SET_DATA_GET_L",err,error)
18399  RETURN 1
18400  END SUBROUTINE field_parameter_set_data_get_l
18401 
18402  !
18403  !================================================================================================================================
18404  !
18405 
18407  SUBROUTINE field_parameter_set_data_restore_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,PARAMETERS,ERR,ERROR,*)
18408 
18409  !Argument variables
18410  TYPE(field_type), POINTER :: field
18411  INTEGER(INTG), INTENT(IN) :: variable_type
18412  INTEGER(INTG), INTENT(IN) :: field_set_type
18413  INTEGER(INTG), POINTER :: parameters(:)
18414  INTEGER(INTG), INTENT(OUT) :: err
18415  TYPE(varying_string), INTENT(OUT) :: error
18416  !Local Variables
18417  TYPE(field_parameter_set_type), POINTER :: parameter_set
18418  TYPE(field_variable_type), POINTER :: field_variable
18419  TYPE(varying_string) :: local_error
18420 
18421  enters("FIELD_PARAMETER_SET_DATA_RESTORE_INTG",err,error,*999)
18422 
18423  IF(ASSOCIATED(field)) THEN
18424  IF(field%FIELD_FINISHED) THEN
18425  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
18426  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18427  IF(ASSOCIATED(field_variable)) THEN
18428  IF(field_variable%DATA_TYPE==field_intg_type) THEN
18429  IF(ASSOCIATED(parameters)) THEN
18430  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18431  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18432  IF(ASSOCIATED(parameter_set)) THEN
18433  CALL distributed_vector_data_restore(parameter_set%PARAMETERS,parameters,err,error,*999)
18434  ELSE
18435  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18436  & " has not been created on variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18437  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18438  CALL flagerror(local_error,err,error,*999)
18439  ENDIF
18440  ELSE
18441  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18442  & " is invalid. The field parameter set type must be between 1 and "// &
18443  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
18444  CALL flagerror(local_error,err,error,*999)
18445  ENDIF
18446  ELSE
18447  CALL flagerror("Parameters is not associated.",err,error,*999)
18448  ENDIF
18449  ELSE
18450  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
18451  & " does not correspond to the integer data type of the given parameters array."
18452  CALL flagerror(local_error,err,error,*999)
18453  ENDIF
18454  ELSE
18455  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18456  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18457  CALL flagerror(local_error,err,error,*999)
18458  ENDIF
18459  ELSE
18460  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18461  & " is invalid. The variable type must be between 1 and "// &
18462  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18463  CALL flagerror(local_error,err,error,*999)
18464  ENDIF
18465  ELSE
18466  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18467  & " has not been finished."
18468  CALL flagerror(local_error,err,error,*999)
18469  ENDIF
18470  ELSE
18471  CALL flagerror("Field is not associated.",err,error,*999)
18472  ENDIF
18473 
18474  exits("FIELD_PARAMETER_SET_DATA_RESTORE_INTG")
18475  RETURN
18476 999 errorsexits("FIELD_PARAMETER_SET_DATA_RESTORE_INTG",err,error)
18477  RETURN 1
18478  END SUBROUTINE field_parameter_set_data_restore_intg
18479 
18480  !
18481  !================================================================================================================================
18482  !
18483 
18485  SUBROUTINE field_parameter_set_data_restore_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,PARAMETERS,ERR,ERROR,*)
18486 
18487  !Argument variables
18488  TYPE(field_type), POINTER :: field
18489  INTEGER(INTG), INTENT(IN) :: variable_type
18490  INTEGER(INTG), INTENT(IN) :: field_set_type
18491  REAL(SP), POINTER :: parameters(:)
18492  INTEGER(INTG), INTENT(OUT) :: err
18493  TYPE(varying_string), INTENT(OUT) :: error
18494  !Local Variables
18495  TYPE(field_parameter_set_type), POINTER :: parameter_set
18496  TYPE(field_variable_type), POINTER :: field_variable
18497  TYPE(varying_string) :: local_error
18498 
18499  enters("FIELD_PARAMETER_SET_DATA_RESTORE_SP",err,error,*999)
18500 
18501  IF(ASSOCIATED(field)) THEN
18502  IF(field%FIELD_FINISHED) THEN
18503  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
18504  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18505  IF(ASSOCIATED(field_variable)) THEN
18506  IF(field_variable%DATA_TYPE==field_sp_type) THEN
18507  IF(ASSOCIATED(parameters)) THEN
18508  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18509  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18510  IF(ASSOCIATED(parameter_set)) THEN
18511  CALL distributed_vector_data_restore(parameter_set%PARAMETERS,parameters,err,error,*999)
18512  ELSE
18513  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18514  & " has not been created on variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18515  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18516  CALL flagerror(local_error,err,error,*999)
18517  ENDIF
18518  ELSE
18519  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18520  & " is invalid. The field parameter set type must be between 1 and "// &
18521  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
18522  CALL flagerror(local_error,err,error,*999)
18523  ENDIF
18524  ELSE
18525  CALL flagerror("Parameters is not associated.",err,error,*999)
18526  ENDIF
18527  ELSE
18528  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
18529  & " does not correspond to the single precision data type of the given parameters array."
18530  CALL flagerror(local_error,err,error,*999)
18531  ENDIF
18532  ELSE
18533  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18534  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18535  CALL flagerror(local_error,err,error,*999)
18536  ENDIF
18537  ELSE
18538  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18539  & " is invalid. The variable type must be between 1 and "// &
18540  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18541  CALL flagerror(local_error,err,error,*999)
18542  ENDIF
18543  ELSE
18544  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18545  & " has not been finished."
18546  CALL flagerror(local_error,err,error,*999)
18547  ENDIF
18548  ELSE
18549  CALL flagerror("Field is not associated.",err,error,*999)
18550  ENDIF
18551 
18552  exits("FIELD_PARAMETER_SET_DATA_RESTORE_SP")
18553  RETURN
18554 999 errorsexits("FIELD_PARAMETER_SET_DATA_RESTORE_SP",err,error)
18555  RETURN 1
18556  END SUBROUTINE field_parameter_set_data_restore_sp
18557 
18558  !
18559  !================================================================================================================================
18560  !
18561 
18563  SUBROUTINE field_parameter_set_data_restore_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,PARAMETERS,ERR,ERROR,*)
18564 
18565  !Argument variables
18566  TYPE(field_type), POINTER :: field
18567  INTEGER(INTG), INTENT(IN) :: variable_type
18568  INTEGER(INTG), INTENT(IN) :: field_set_type
18569  REAL(DP), POINTER :: parameters(:)
18570  INTEGER(INTG), INTENT(OUT) :: err
18571  TYPE(varying_string), INTENT(OUT) :: error
18572  !Local Variables
18573  TYPE(field_parameter_set_type), POINTER :: parameter_set
18574  TYPE(field_variable_type), POINTER :: field_variable
18575  TYPE(varying_string) :: local_error
18576 
18577  enters("FIELD_PARAMETER_SET_DATA_RESTORE_DP",err,error,*999)
18578 
18579  IF(ASSOCIATED(field)) THEN
18580  IF(field%FIELD_FINISHED) THEN
18581  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
18582  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18583  IF(ASSOCIATED(field_variable)) THEN
18584  IF(field_variable%DATA_TYPE==field_dp_type) THEN
18585  IF(ASSOCIATED(parameters)) THEN
18586  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18587  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18588  IF(ASSOCIATED(parameter_set)) THEN
18589  CALL distributed_vector_data_restore(parameter_set%PARAMETERS,parameters,err,error,*999)
18590  ELSE
18591  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18592  & " has not been created on variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18593  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18594  CALL flagerror(local_error,err,error,*999)
18595  ENDIF
18596  ELSE
18597  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18598  & " is invalid. The field parameter set type must be between 1 and "// &
18599  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
18600  CALL flagerror(local_error,err,error,*999)
18601  ENDIF
18602  ELSE
18603  CALL flagerror("Parameters is not associated.",err,error,*999)
18604  ENDIF
18605  ELSE
18606  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
18607  & " does not correspond to the double precision data type of the given parameters array."
18608  CALL flagerror(local_error,err,error,*999)
18609  ENDIF
18610  ELSE
18611  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18612  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18613  CALL flagerror(local_error,err,error,*999)
18614  ENDIF
18615  ELSE
18616  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18617  & " is invalid. The variable type must be between 1 and "// &
18618  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18619  CALL flagerror(local_error,err,error,*999)
18620  ENDIF
18621  ELSE
18622  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18623  & " has not been finished."
18624  CALL flagerror(local_error,err,error,*999)
18625  ENDIF
18626  ELSE
18627  CALL flagerror("Field is not associated.",err,error,*999)
18628  ENDIF
18629 
18630  exits("FIELD_PARAMETER_SET_DATA_RESTORE_DP")
18631  RETURN
18632 999 errorsexits("FIELD_PARAMETER_SET_DATA_RESTORE_DP",err,error)
18633  RETURN 1
18634  END SUBROUTINE field_parameter_set_data_restore_dp
18635 
18636  !
18637  !================================================================================================================================
18638  !
18639 
18641  SUBROUTINE field_parameter_set_data_restore_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,PARAMETERS,ERR,ERROR,*)
18642 
18643  !Argument variables
18644  TYPE(field_type), POINTER :: field
18645  INTEGER(INTG), INTENT(IN) :: variable_type
18646  INTEGER(INTG), INTENT(IN) :: field_set_type
18647  LOGICAL, POINTER :: parameters(:)
18648  INTEGER(INTG), INTENT(OUT) :: err
18649  TYPE(varying_string), INTENT(OUT) :: error
18650  !Local Variables
18651  TYPE(field_parameter_set_type), POINTER :: parameter_set
18652  TYPE(field_variable_type), POINTER :: field_variable
18653  TYPE(varying_string) :: local_error
18654 
18655  enters("FIELD_PARAMETER_SET_DATA_RESTORE_L",err,error,*999)
18656 
18657  IF(ASSOCIATED(field)) THEN
18658  IF(field%FIELD_FINISHED) THEN
18659  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
18660  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18661  IF(ASSOCIATED(field_variable)) THEN
18662  IF(field_variable%DATA_TYPE==field_dp_type) THEN
18663  IF(ASSOCIATED(parameters)) THEN
18664  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18665  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18666  IF(ASSOCIATED(parameter_set)) THEN
18667  CALL distributed_vector_data_restore(parameter_set%PARAMETERS,parameters,err,error,*999)
18668  ELSE
18669  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18670  & " has not been created on variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18671  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18672  CALL flagerror(local_error,err,error,*999)
18673  ENDIF
18674  ELSE
18675  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18676  & " is invalid. The field parameter set type must be between 1 and "// &
18677  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
18678  CALL flagerror(local_error,err,error,*999)
18679  ENDIF
18680  ELSE
18681  CALL flagerror("Parameters is not associated.",err,error,*999)
18682  ENDIF
18683  ELSE
18684  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
18685  & " does not correspond to the logical data type of the given parameters array."
18686  CALL flagerror(local_error,err,error,*999)
18687  ENDIF
18688  ELSE
18689  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18690  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18691  CALL flagerror(local_error,err,error,*999)
18692  ENDIF
18693  ELSE
18694  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18695  & " is invalid. The variable type must be between 1 and "// &
18696  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18697  CALL flagerror(local_error,err,error,*999)
18698  ENDIF
18699  ELSE
18700  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18701  & " has not been finished."
18702  CALL flagerror(local_error,err,error,*999)
18703  ENDIF
18704  ELSE
18705  CALL flagerror("Field is not associated.",err,error,*999)
18706  ENDIF
18707 
18708  exits("FIELD_PARAMETER_SET_DATA_RESTORE_L")
18709  RETURN
18710 999 errorsexits("FIELD_PARAMETER_SET_DATA_RESTORE_L",err,error)
18711  RETURN 1
18712  END SUBROUTINE field_parameter_set_data_restore_l
18713 
18714  !
18715  !================================================================================================================================
18716  !
18717 
18719  SUBROUTINE field_parameter_set_get(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,PARAMETER_SET,ERR,ERROR,*)
18720 
18721  !Argument variables
18722  TYPE(field_type), POINTER :: field
18723  INTEGER(INTG), INTENT(IN) :: variable_type
18724  INTEGER(INTG), INTENT(IN) :: field_set_type
18725  TYPE(field_parameter_set_type), POINTER :: parameter_set
18726  INTEGER(INTG), INTENT(OUT) :: err
18727  TYPE(varying_string), INTENT(OUT) :: error
18728 
18729  !Local Variables
18730  TYPE(field_variable_type), POINTER :: field_variable
18731  TYPE(varying_string) :: local_error
18732 
18733  enters("FIELD_PARAMETER_SET_GET",err,error,*999)
18734 
18735  IF(ASSOCIATED(field)) THEN
18736  IF(field%FIELD_FINISHED) THEN
18737  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
18738  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18739  IF(ASSOCIATED(field_variable)) THEN
18740  IF(ASSOCIATED(parameter_set)) THEN
18741  CALL flagerror("Parameter set is already associated.",err,error,*999)
18742  ELSE
18743  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18744  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18745  IF(.NOT.ASSOCIATED(parameter_set)) THEN
18746  local_error="The field parameter set type of "// &
18747  & trim(number_to_vstring(field_set_type,"*",err,error))// &
18748  & " has not been created on variable type "// &
18749  & trim(number_to_vstring(variable_type,"*",err,error))// &
18750  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18751  CALL flagerror(local_error,err,error,*999)
18752  ENDIF
18753  ELSE
18754  local_error="The field parameter set type of "// &
18755  & trim(number_to_vstring(field_set_type,"*",err,error))// &
18756  & " is invalid. The field parameter set type must be between 1 and "// &
18757  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
18758  CALL flagerror(local_error,err,error,*999)
18759  ENDIF
18760  ENDIF
18761  ELSE
18762  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18763  & " has not been created on field number "// &
18764  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18765  CALL flagerror(local_error,err,error,*999)
18766  ENDIF
18767  ELSE
18768  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18769  & " is invalid. The variable type must be between 1 and "// &
18770  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18771  CALL flagerror(local_error,err,error,*999)
18772  ENDIF
18773  ELSE
18774  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18775  & " has not been finished."
18776  CALL flagerror(local_error,err,error,*999)
18777  ENDIF
18778  ELSE
18779  CALL flagerror("Field is not associated.",err,error,*999)
18780  ENDIF
18781 
18782  exits("FIELD_PARAMETER_SET_GET")
18783  RETURN
18784 999 errorsexits("FIELD_PARAMETER_SET_GET",err,error)
18785  RETURN 1
18786  END SUBROUTINE field_parameter_set_get
18787 
18788  !
18789  !================================================================================================================================
18790  !
18791 
18793  SUBROUTINE field_parameter_set_get_constant_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
18794 
18795  !Argument variables
18796  TYPE(field_type), POINTER :: field
18797  INTEGER(INTG), INTENT(IN) :: variable_type
18798  INTEGER(INTG), INTENT(IN) :: field_set_type
18799  INTEGER(INTG), INTENT(IN) :: component_number
18800  INTEGER(INTG), INTENT(OUT) :: VALUE
18801  INTEGER(INTG), INTENT(OUT) :: err
18802  TYPE(varying_string), INTENT(OUT) :: error
18803  !Local Variables
18804  INTEGER(INTG) :: ny
18805  TYPE(field_parameter_set_type), POINTER :: parameter_set
18806  TYPE(field_variable_type), POINTER :: field_variable
18807  TYPE(varying_string) :: local_error
18808 
18809  enters("FIELD_PARAMETER_SET_GET_CONSTANT_INTG",err,error,*999)
18810 
18811  IF(ASSOCIATED(field)) THEN
18812  IF(field%FIELD_FINISHED) THEN
18813  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
18814  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18815  IF(ASSOCIATED(field_variable)) THEN
18816  IF(field_variable%DATA_TYPE==field_intg_type) THEN
18817  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18818  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18819  IF(ASSOCIATED(parameter_set)) THEN
18820  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
18821  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
18822  CASE(field_constant_interpolation)
18823  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
18824  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
18825  CALL distributed_vector_values_get(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
18826  ELSE
18827  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
18828  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18829  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18830  & " does not have any constant parameters."
18831  CALL flagerror(local_error,err,error,*999)
18832 
18833  ENDIF
18834  CASE(field_element_based_interpolation)
18835  local_error="Can not get by constant for component number "// &
18836  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
18837  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
18838  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
18839  CALL flagerror(local_error,err,error,*999)
18840  CASE(field_node_based_interpolation)
18841  local_error="Can not get by constant for component number "// &
18842  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
18843  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
18844  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
18845  CALL flagerror(local_error,err,error,*999)
18846  CASE(field_grid_point_based_interpolation)
18847  local_error="Can not get by constant for component number "// &
18848  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
18849  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
18850  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
18851  CALL flagerror(local_error,err,error,*999)
18852  CASE(field_gauss_point_based_interpolation)
18853  local_error="Can not get by constant for component number "// &
18854  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
18855  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
18856  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
18857  CALL flagerror(local_error,err,error,*999)
18858  CASE(field_data_point_based_interpolation)
18859  local_error="Can not add element for component number "// &
18860  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
18861  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
18862  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
18863  CALL flagerror(local_error,err,error,*999)
18864  CASE DEFAULT
18865  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
18866  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
18867  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
18868  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18869  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18870  CALL flagerror(local_error,err,error,*999)
18871  END SELECT
18872  ELSE
18873  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
18874  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18875  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
18876  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
18877  & " components."
18878  CALL flagerror(local_error,err,error,*999)
18879  ENDIF
18880  ELSE
18881  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18882  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18883  CALL flagerror(local_error,err,error,*999)
18884  ENDIF
18885  ELSE
18886  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
18887  & " is invalid. The field parameter set type must be between 1 and "// &
18888  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
18889  CALL flagerror(local_error,err,error,*999)
18890  ENDIF
18891  ELSE
18892  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
18893  & " does not correspond to the integer data type of the given value."
18894  CALL flagerror(local_error,err,error,*999)
18895  ENDIF
18896  ELSE
18897  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18898  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
18899  CALL flagerror(local_error,err,error,*999)
18900  ENDIF
18901  ELSE
18902  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
18903  & " is invalid. The variable type must be between 1 and "// &
18904  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
18905  CALL flagerror(local_error,err,error,*999)
18906  ENDIF
18907  ELSE
18908  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18909  & " has not been finished."
18910  CALL flagerror(local_error,err,error,*999)
18911  ENDIF
18912  ELSE
18913  CALL flagerror("Field is not associated.",err,error,*999)
18914  ENDIF
18915 
18916  exits("FIELD_PARAMETER_SET_GET_CONSTANT_INTG")
18917  RETURN
18918 999 errorsexits("FIELD_PARAMETER_SET_GET_CONSTANT_INTG",err,error)
18919  RETURN 1
18920  END SUBROUTINE field_parameter_set_get_constant_intg
18921 
18922  !
18923  !================================================================================================================================
18924  !
18925 
18927  SUBROUTINE field_parameter_set_get_constant_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
18928 
18929  !Argument variables
18930  TYPE(field_type), POINTER :: field
18931  INTEGER(INTG), INTENT(IN) :: variable_type
18932  INTEGER(INTG), INTENT(IN) :: field_set_type
18933  INTEGER(INTG), INTENT(IN) :: component_number
18934  REAL(SP), INTENT(OUT) :: VALUE
18935  INTEGER(INTG), INTENT(OUT) :: err
18936  TYPE(varying_string), INTENT(OUT) :: error
18937  !Local Variables
18938  INTEGER(INTG) :: ny
18939  TYPE(field_parameter_set_type), POINTER :: parameter_set
18940  TYPE(field_variable_type), POINTER :: field_variable
18941  TYPE(varying_string) :: local_error
18942 
18943  enters("FIELD_PARAMETER_SET_GET_CONSTANT_SP",err,error,*999)
18944 
18945  IF(ASSOCIATED(field)) THEN
18946  IF(field%FIELD_FINISHED) THEN
18947  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
18948  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
18949  IF(ASSOCIATED(field_variable)) THEN
18950  IF(field_variable%DATA_TYPE==field_sp_type) THEN
18951  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
18952  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
18953  IF(ASSOCIATED(parameter_set)) THEN
18954  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
18955  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
18956  CASE(field_constant_interpolation)
18957  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
18958  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
18959  CALL distributed_vector_values_get(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
18960  ELSE
18961  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
18962  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
18963  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
18964  & " does not have any constant parameters."
18965  CALL flagerror(local_error,err,error,*999)
18966  ENDIF
18967  CASE(field_element_based_interpolation)
18968  local_error="Can not get by constant for component number "// &
18969  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
18970  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
18971  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
18972  CALL flagerror(local_error,err,error,*999)
18973  CASE(field_node_based_interpolation)
18974  local_error="Can not get by constant for component number "// &
18975  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
18976  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
18977  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
18978  CALL flagerror(local_error,err,error,*999)
18979  CASE(field_grid_point_based_interpolation)
18980  local_error="Can not get by constant for component number "// &
18981  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
18982  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
18983  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
18984  CALL flagerror(local_error,err,error,*999)
18985  CASE(field_gauss_point_based_interpolation)
18986  local_error="Can not get by constant for component number "// &
18987  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
18988  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
18989  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
18990  CALL flagerror(local_error,err,error,*999)
18991  CASE(field_data_point_based_interpolation)
18992  local_error="Can not add element for component number "// &
18993  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
18994  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
18995  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
18996  CALL flagerror(local_error,err,error,*999)
18997  CASE DEFAULT
18998  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
18999  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
19000  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
19001  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
19002  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19003  CALL flagerror(local_error,err,error,*999)
19004  END SELECT
19005  ELSE
19006  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
19007  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
19008  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
19009  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
19010  & " components."
19011  CALL flagerror(local_error,err,error,*999)
19012  ENDIF
19013  ELSE
19014  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
19015  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19016  CALL flagerror(local_error,err,error,*999)
19017  ENDIF
19018  ELSE
19019  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
19020  & " is invalid. The field parameter set type must be between 1 and "// &
19021  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
19022  CALL flagerror(local_error,err,error,*999)
19023  ENDIF
19024  ELSE
19025  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
19026  & " does not correspond to the single precision data type of the given value."
19027  CALL flagerror(local_error,err,error,*999)
19028  ENDIF
19029  ELSE
19030  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
19031  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19032  CALL flagerror(local_error,err,error,*999)
19033  ENDIF
19034  ELSE
19035  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
19036  & " is invalid. The variable type must be between 1 and "// &
19037  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
19038  CALL flagerror(local_error,err,error,*999)
19039  ENDIF
19040  ELSE
19041  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
19042  & " has not been finished."
19043  CALL flagerror(local_error,err,error,*999)
19044  ENDIF
19045  ELSE
19046  CALL flagerror("Field is not associated.",err,error,*999)
19047  ENDIF
19048 
19049  exits("FIELD_PARAMETER_SET_GET_CONSTANT_SP")
19050  RETURN
19051 999 errorsexits("FIELD_PARAMETER_SET_GET_CONSTANT_SP",err,error)
19052  RETURN 1
19053  END SUBROUTINE field_parameter_set_get_constant_sp
19054 
19055  !
19056  !================================================================================================================================
19057  !
19058 
19060  SUBROUTINE field_parameter_set_get_constant_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
19061 
19062  !Argument variables
19063  TYPE(field_type), POINTER :: field
19064  INTEGER(INTG), INTENT(IN) :: variable_type
19065  INTEGER(INTG), INTENT(IN) :: field_set_type
19066  INTEGER(INTG), INTENT(IN) :: component_number
19067  REAL(DP), INTENT(OUT) :: VALUE
19068  INTEGER(INTG), INTENT(OUT) :: err
19069  TYPE(varying_string), INTENT(OUT) :: error
19070  !Local Variables
19071  INTEGER(INTG) :: ny
19072  TYPE(field_parameter_set_type), POINTER :: parameter_set
19073  TYPE(field_variable_type), POINTER :: field_variable
19074  TYPE(varying_string) :: local_error
19075 
19076  enters("FIELD_PARAMETER_SET_GET_CONSTANT_DP",err,error,*999)
19077 
19078 
19079  IF(ASSOCIATED(field)) THEN
19080  IF(field%FIELD_FINISHED) THEN
19081  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
19082  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
19083  IF(ASSOCIATED(field_variable)) THEN
19084  IF(field_variable%DATA_TYPE==field_dp_type) THEN
19085  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
19086  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
19087  IF(ASSOCIATED(parameter_set)) THEN
19088  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
19089  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
19090  CASE(field_constant_interpolation)
19091  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
19092  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
19093  CALL distributed_vector_values_get(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
19094  ELSE
19095  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
19096  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
19097  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
19098  & " does not have any constant parameters."
19099  CALL flagerror(local_error,err,error,*999)
19100  ENDIF
19101  CASE(field_element_based_interpolation)
19102  local_error="Can not get by constant for component number "// &
19103  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19104  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19105  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
19106  CALL flagerror(local_error,err,error,*999)
19107  CASE(field_node_based_interpolation)
19108  local_error="Can not get by constant for component number "// &
19109  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19110  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19111  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
19112  CALL flagerror(local_error,err,error,*999)
19113  CASE(field_grid_point_based_interpolation)
19114  local_error="Can not get by constant for component number "// &
19115  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19116  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19117  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
19118  CALL flagerror(local_error,err,error,*999)
19119  CASE(field_gauss_point_based_interpolation)
19120  local_error="Can not get by constant for component number "// &
19121  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19122  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19123  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
19124  CALL flagerror(local_error,err,error,*999)
19125  CASE(field_data_point_based_interpolation)
19126  local_error="Can not add element for component number "// &
19127  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19128  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19129  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
19130  CALL flagerror(local_error,err,error,*999)
19131  CASE DEFAULT
19132  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
19133  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
19134  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
19135  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
19136  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19137  CALL flagerror(local_error,err,error,*999)
19138  END SELECT
19139  ELSE
19140  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
19141  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
19142  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
19143  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
19144  & " components."
19145  CALL flagerror(local_error,err,error,*999)
19146  ENDIF
19147  ELSE
19148  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
19149  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19150  CALL flagerror(local_error,err,error,*999)
19151  ENDIF
19152  ELSE
19153  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
19154  & " is invalid. The field parameter set type must be between 1 and "// &
19155  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
19156  CALL flagerror(local_error,err,error,*999)
19157  ENDIF
19158  ELSE
19159  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
19160  & " does not correspond to the double precision data type of the given value."
19161  CALL flagerror(local_error,err,error,*999)
19162  ENDIF
19163  ELSE
19164  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
19165  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19166  CALL flagerror(local_error,err,error,*999)
19167  ENDIF
19168  ELSE
19169  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
19170  & " is invalid. The variable type must be between 1 and "// &
19171  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
19172  CALL flagerror(local_error,err,error,*999)
19173  ENDIF
19174  ELSE
19175  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
19176  & " has not been finished."
19177  CALL flagerror(local_error,err,error,*999)
19178  ENDIF
19179  ELSE
19180  CALL flagerror("Field is not associated.",err,error,*999)
19181  ENDIF
19182 
19183  exits("FIELD_PARAMETER_SET_GET_CONSTANT_DP")
19184  RETURN
19185 999 errorsexits("FIELD_PARAMETER_SET_GET_CONSTANT_DP",err,error)
19186  RETURN 1
19187  END SUBROUTINE field_parameter_set_get_constant_dp
19188 
19189  !
19190  !================================================================================================================================
19191  !
19192 
19194  SUBROUTINE field_parameter_set_get_constant_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
19195 
19196  !Argument variables
19197  TYPE(field_type), POINTER :: field
19198  INTEGER(INTG), INTENT(IN) :: variable_type
19199  INTEGER(INTG), INTENT(IN) :: field_set_type
19200  INTEGER(INTG), INTENT(IN) :: component_number
19201  LOGICAL, INTENT(OUT) :: VALUE
19202  INTEGER(INTG), INTENT(OUT) :: err
19203  TYPE(varying_string), INTENT(OUT) :: error
19204  !Local Variables
19205  INTEGER(INTG) :: ny
19206  TYPE(field_parameter_set_type), POINTER :: parameter_set
19207  TYPE(field_variable_type), POINTER :: field_variable
19208  TYPE(varying_string) :: local_error
19209 
19210  enters("FIELD_PARAMETER_SET_GET_CONSTANT_L",err,error,*999)
19211 
19212  IF(ASSOCIATED(field)) THEN
19213  IF(field%FIELD_FINISHED) THEN
19214  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
19215  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
19216  IF(ASSOCIATED(field_variable)) THEN
19217  IF(field_variable%DATA_TYPE==field_l_type) THEN
19218  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
19219  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
19220  IF(ASSOCIATED(parameter_set)) THEN
19221  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
19222  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
19223  CASE(field_constant_interpolation)
19224  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
19225  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
19226  CALL distributed_vector_values_get(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
19227  ELSE
19228  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
19229  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
19230  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
19231  & " does not have any constant parameters."
19232  CALL flagerror(local_error,err,error,*999)
19233  ENDIF
19234  CASE(field_element_based_interpolation)
19235  local_error="Can not get by constant for component number "// &
19236  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19237  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19238  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
19239  CALL flagerror(local_error,err,error,*999)
19240  CASE(field_node_based_interpolation)
19241  local_error="Can not get by constant for component number "// &
19242  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19243  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19244  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
19245  CALL flagerror(local_error,err,error,*999)
19246  CASE(field_grid_point_based_interpolation)
19247  local_error="Can not get by constant for component number "// &
19248  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19249  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19250  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
19251  CALL flagerror(local_error,err,error,*999)
19252  CASE(field_gauss_point_based_interpolation)
19253  local_error="Can not get by constant for component number "// &
19254  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19255  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19256  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
19257  CALL flagerror(local_error,err,error,*999)
19258  CASE(field_data_point_based_interpolation)
19259  local_error="Can not add element for component number "// &
19260  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19261  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19262  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
19263  CALL flagerror(local_error,err,error,*999)
19264  CASE DEFAULT
19265  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
19266  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
19267  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
19268  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
19269  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19270  CALL flagerror(local_error,err,error,*999)
19271  END SELECT
19272  ELSE
19273  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
19274  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
19275  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
19276  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
19277  & " components."
19278  CALL flagerror(local_error,err,error,*999)
19279  ENDIF
19280  ELSE
19281  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
19282  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19283  CALL flagerror(local_error,err,error,*999)
19284  ENDIF
19285  ELSE
19286  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
19287  & " is invalid. The field parameter set type must be between 1 and "// &
19288  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
19289  CALL flagerror(local_error,err,error,*999)
19290  ENDIF
19291  ELSE
19292  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
19293  & " does not correspond to the logical data type of the given value."
19294  CALL flagerror(local_error,err,error,*999)
19295  ENDIF
19296  ELSE
19297  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
19298  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19299  CALL flagerror(local_error,err,error,*999)
19300  ENDIF
19301  ELSE
19302  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
19303  & " is invalid. The variable type must be between 1 and "// &
19304  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
19305  CALL flagerror(local_error,err,error,*999)
19306  ENDIF
19307  ELSE
19308  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
19309  & " has not been finished."
19310  CALL flagerror(local_error,err,error,*999)
19311  ENDIF
19312  ELSE
19313  CALL flagerror("Field is not associated.",err,error,*999)
19314  ENDIF
19315 
19316  exits("FIELD_PARAMETER_SET_GET_CONSTANT_L")
19317  RETURN
19318 999 errorsexits("FIELD_PARAMETER_SET_GET_CONSTANT_L",err,error)
19319 
19320  RETURN 1
19321  END SUBROUTINE field_parameter_set_get_constant_l
19322 
19323  !
19324  !================================================================================================================================
19325  !
19326 
19328  SUBROUTINE field_parametersetgetdatapointintg(field,variableType,fieldSetType,userDataPointNumber,componentNumber,value, &
19329  & err,error,*)
19330 
19331  !Argument variables
19332  TYPE(field_type), POINTER :: field
19333  INTEGER(INTG), INTENT(IN) :: variabletype
19334  INTEGER(INTG), INTENT(IN) :: fieldsettype
19335  INTEGER(INTG), INTENT(IN) :: userdatapointnumber
19336  INTEGER(INTG), INTENT(IN) :: componentnumber
19337  INTEGER(INTG), INTENT(OUT) :: value
19338  INTEGER(INTG), INTENT(OUT) :: err
19339  TYPE(varying_string), INTENT(OUT) :: error
19340  !Local Variables
19341  INTEGER(INTG) :: decompositionlocaldatapointnumber,dofidx
19342  LOGICAL :: userdatapointexists,ghostdatapoint
19343  TYPE(decomposition_type), POINTER :: decomposition
19344  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
19345  TYPE(field_parameter_set_type), POINTER :: parameterset
19346  TYPE(field_variable_type), POINTER :: fieldvariable
19347  TYPE(varying_string) :: localerror
19348 
19349  enters("Field_ParameterSetGetDataPointIntg",err,error,*999)
19350 
19351  IF(ASSOCIATED(field)) THEN
19352  IF(field%FIELD_FINISHED) THEN
19353  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
19354  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
19355  IF(ASSOCIATED(fieldvariable)) THEN
19356  IF(fieldvariable%DATA_TYPE==field_intg_type) THEN
19357  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
19358  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
19359  IF(ASSOCIATED(parameterset)) THEN
19360  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
19361  SELECT CASE(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE)
19362  CASE(field_constant_interpolation)
19363  localerror="Can not get by data point for component number "// &
19364  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19365  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19366  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
19367  CALL flagerror(localerror,err,error,*999)
19368  CASE(field_element_based_interpolation)
19369  localerror="Can not get by data point for component number "// &
19370  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19371  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19372  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
19373  CALL flagerror(localerror,err,error,*999)
19374  CASE(field_node_based_interpolation)
19375  localerror="Can not get by data point for component number "// &
19376  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19377  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19378  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
19379  CALL flagerror(localerror,err,error,*999)
19380  CASE(field_grid_point_based_interpolation)
19381  localerror="Can not get by data point for component number "// &
19382  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19383  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19384  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
19385  CALL flagerror(localerror,err,error,*999)
19386  CASE(field_gauss_point_based_interpolation)
19387  localerror="Can not get by data point for component number "// &
19388  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19389  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19390  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
19391  CALL flagerror(localerror,err,error,*999)
19392  CASE(field_data_point_based_interpolation)
19393  decomposition=>field%DECOMPOSITION
19394  IF(ASSOCIATED(decomposition)) THEN
19395  decompositiontopology=>decomposition%TOPOLOGY
19396  IF(ASSOCIATED(decompositiontopology)) THEN
19397  CALL decompositiontopology_datapointcheckexists(decompositiontopology,userdatapointnumber, &
19398  & userdatapointexists,decompositionlocaldatapointnumber,ghostdatapoint,err,error,*999)
19399  IF(userdatapointexists) THEN
19400  dofidx=fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
19401  & data_point_param2dof_map%DATA_POINTS(decompositionlocaldatapointnumber)
19402  CALL distributed_vector_values_get(parameterset%PARAMETERS,dofidx,value,err,error,*999)
19403  ELSE
19404  localerror="The specified user data point number of "// &
19405  & trim(number_to_vstring(userdatapointnumber,"*",err,error))// &
19406  & " does not exist in the decomposition for field component number "// &
19407  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
19408  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19409  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19410  CALL flagerror(localerror,err,error,*999)
19411  ENDIF
19412  ELSE
19413  CALL flagerror("Field decomposition topology is not associated.",err,error,*999)
19414  ENDIF
19415  ELSE
19416  CALL flagerror("Field decomposition is not associated.",err,error,*999)
19417  ENDIF
19418  CASE DEFAULT
19419  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
19420  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
19421  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
19422  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
19423  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19424  CALL flagerror(localerror,err,error,*999)
19425  END SELECT
19426  ELSE
19427  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
19428  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
19429  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
19430  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
19431  CALL flagerror(localerror,err,error,*999)
19432  ENDIF
19433  ELSE
19434  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
19435  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
19436  CALL flagerror(localerror,err,error,*999)
19437  ENDIF
19438  ELSE
19439  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
19440  & " is invalid. The field parameter set type must be between 1 and "// &
19441  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
19442  CALL flagerror(localerror,err,error,*999)
19443  ENDIF
19444  ELSE
19445  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
19446  & " does not correspond to the integer data type of the given value."
19447  CALL flagerror(localerror,err,error,*999)
19448  ENDIF
19449  ELSE
19450  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
19451  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19452  CALL flagerror(localerror,err,error,*999)
19453  ENDIF
19454  ELSE
19455  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
19456  & " is invalid. The variable type must be between 1 and "// &
19457  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
19458  CALL flagerror(localerror,err,error,*999)
19459  ENDIF
19460  ELSE
19461  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
19462  & " has not been finished."
19463  CALL flagerror(localerror,err,error,*999)
19464  ENDIF
19465  ELSE
19466  CALL flagerror("Field is not associated.",err,error,*999)
19467  ENDIF
19468 
19469  exits("Field_ParameterSetGetDataPointIntg")
19470  RETURN
19471 999 errorsexits("Field_ParameterSetGetDataPointIntg",err,error)
19472  RETURN 1
19473  END SUBROUTINE field_parametersetgetdatapointintg
19474 
19475  !
19476  !================================================================================================================================
19477  !
19478 
19480  SUBROUTINE field_parametersetgetdatapointsp(field,variableType,fieldSetType,userDataPointNumber,componentNumber,value,err,error,*)
19481 
19482  !Argument variables
19483  TYPE(field_type), POINTER :: field
19484  INTEGER(INTG), INTENT(IN) :: variabletype
19485  INTEGER(INTG), INTENT(IN) :: fieldsettype
19486  INTEGER(INTG), INTENT(IN) :: userdatapointnumber
19487  INTEGER(INTG), INTENT(IN) :: componentnumber
19488  REAL(SP), INTENT(OUT) :: value
19489  INTEGER(INTG), INTENT(OUT) :: err
19490  TYPE(varying_string), INTENT(OUT) :: error
19491  !Local Variables
19492  INTEGER(INTG) :: decompositionlocaldatapointnumber,dofidx
19493  LOGICAL :: userdatapointexists,ghostdatapoint
19494  TYPE(decomposition_type), POINTER :: decomposition
19495  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
19496  TYPE(field_parameter_set_type), POINTER :: parameterset
19497  TYPE(field_variable_type), POINTER :: fieldvariable
19498  TYPE(varying_string) :: localerror
19499 
19500  enters("Field_ParameterSetGetDataPointSP",err,error,*999)
19501 
19502  IF(ASSOCIATED(field)) THEN
19503  IF(field%FIELD_FINISHED) THEN
19504  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
19505  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
19506  IF(ASSOCIATED(fieldvariable)) THEN
19507  IF(fieldvariable%DATA_TYPE==field_sp_type) THEN
19508  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
19509  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
19510  IF(ASSOCIATED(parameterset)) THEN
19511  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
19512  SELECT CASE(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE)
19513  CASE(field_constant_interpolation)
19514  localerror="Can not get by data point for component number "// &
19515  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19516  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19517  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
19518  CALL flagerror(localerror,err,error,*999)
19519  CASE(field_element_based_interpolation)
19520  localerror="Can not get by data point for component number "// &
19521  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19522  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19523  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
19524  CALL flagerror(localerror,err,error,*999)
19525  CASE(field_node_based_interpolation)
19526  localerror="Can not get by data point for component number "// &
19527  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19528  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19529  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
19530  CALL flagerror(localerror,err,error,*999)
19531  CASE(field_grid_point_based_interpolation)
19532  localerror="Can not get by data point for component number "// &
19533  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19534  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19535  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
19536  CALL flagerror(localerror,err,error,*999)
19537  CASE(field_gauss_point_based_interpolation)
19538  localerror="Can not get by data point for component number "// &
19539  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19540  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19541  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
19542  CALL flagerror(localerror,err,error,*999)
19543  CASE(field_data_point_based_interpolation)
19544  decomposition=>field%DECOMPOSITION
19545  IF(ASSOCIATED(decomposition)) THEN
19546  decompositiontopology=>decomposition%TOPOLOGY
19547  IF(ASSOCIATED(decompositiontopology)) THEN
19548  CALL decompositiontopology_datapointcheckexists(decompositiontopology,userdatapointnumber, &
19549  & userdatapointexists,decompositionlocaldatapointnumber,ghostdatapoint,err,error,*999)
19550  IF(userdatapointexists) THEN
19551  dofidx=fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
19552  & data_point_param2dof_map%DATA_POINTS(decompositionlocaldatapointnumber)
19553  CALL distributed_vector_values_get(parameterset%PARAMETERS,dofidx,value,err,error,*999)
19554  ELSE
19555  localerror="The specified user data point number of "// &
19556  & trim(number_to_vstring(userdatapointnumber,"*",err,error))// &
19557  & " does not exist in the decomposition for field component number "// &
19558  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
19559  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19560  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19561  CALL flagerror(localerror,err,error,*999)
19562  ENDIF
19563  ELSE
19564  CALL flagerror("Field decomposition topology is not associated.",err,error,*999)
19565  ENDIF
19566  ELSE
19567  CALL flagerror("Field decomposition is not associated.",err,error,*999)
19568  ENDIF
19569  CASE DEFAULT
19570  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
19571  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
19572  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
19573  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
19574  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19575  CALL flagerror(localerror,err,error,*999)
19576  END SELECT
19577  ELSE
19578  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
19579  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
19580  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
19581  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
19582  CALL flagerror(localerror,err,error,*999)
19583  ENDIF
19584  ELSE
19585  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
19586  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
19587  CALL flagerror(localerror,err,error,*999)
19588  ENDIF
19589  ELSE
19590  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
19591  & " is invalid. The field parameter set type must be between 1 and "// &
19592  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
19593  CALL flagerror(localerror,err,error,*999)
19594  ENDIF
19595  ELSE
19596  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
19597  & " does not correspond to the single precision data type of the given value."
19598  CALL flagerror(localerror,err,error,*999)
19599  ENDIF
19600  ELSE
19601  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
19602  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19603  CALL flagerror(localerror,err,error,*999)
19604  ENDIF
19605  ELSE
19606  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
19607  & " is invalid. The variable type must be between 1 and "// &
19608  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
19609  CALL flagerror(localerror,err,error,*999)
19610  ENDIF
19611  ELSE
19612  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
19613  & " has not been finished."
19614  CALL flagerror(localerror,err,error,*999)
19615  ENDIF
19616  ELSE
19617  CALL flagerror("Field is not associated.",err,error,*999)
19618  ENDIF
19619 
19620  exits("Field_ParameterSetGetDataPointSP")
19621  RETURN
19622 999 errorsexits("Field_ParameterSetGetDataPointSP",err,error)
19623  RETURN 1
19624  END SUBROUTINE field_parametersetgetdatapointsp
19625 
19626  !
19627  !================================================================================================================================
19628  !
19629 
19631  SUBROUTINE field_parametersetgetdatapointdp(field,variableType,fieldSetType,userDataPointNumber,componentNumber,value,err,error,*)
19632 
19633  !Argument variables
19634  TYPE(field_type), POINTER :: field
19635  INTEGER(INTG), INTENT(IN) :: variabletype
19636  INTEGER(INTG), INTENT(IN) :: fieldsettype
19637  INTEGER(INTG), INTENT(IN) :: userdatapointnumber
19638  INTEGER(INTG), INTENT(IN) :: componentnumber
19639  REAL(DP), INTENT(OUT) :: value
19640  INTEGER(INTG), INTENT(OUT) :: err
19641  TYPE(varying_string), INTENT(OUT) :: error
19642  !Local Variables
19643  INTEGER(INTG) :: decompositionlocaldatapointnumber,dofidx
19644  LOGICAL :: userdatapointexists,ghostdatapoint
19645  TYPE(decomposition_type), POINTER :: decomposition
19646  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
19647  TYPE(field_parameter_set_type), POINTER :: parameterset
19648  TYPE(field_variable_type), POINTER :: fieldvariable
19649  TYPE(varying_string) :: localerror
19650 
19651  enters("Field_ParameterSetGetDataPointDP",err,error,*999)
19652 
19653  IF(ASSOCIATED(field)) THEN
19654  IF(field%FIELD_FINISHED) THEN
19655  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
19656  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
19657  IF(ASSOCIATED(fieldvariable)) THEN
19658  IF(fieldvariable%DATA_TYPE==field_dp_type) THEN
19659  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
19660  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
19661  IF(ASSOCIATED(parameterset)) THEN
19662  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
19663  SELECT CASE(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE)
19664  CASE(field_constant_interpolation)
19665  localerror="Can not get by data point for component number "// &
19666  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19667  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19668  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
19669  CALL flagerror(localerror,err,error,*999)
19670  CASE(field_element_based_interpolation)
19671  localerror="Can not get by data point for component number "// &
19672  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19673  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19674  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
19675  CALL flagerror(localerror,err,error,*999)
19676  CASE(field_node_based_interpolation)
19677  localerror="Can not get by data point for component number "// &
19678  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19679  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19680  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
19681  CALL flagerror(localerror,err,error,*999)
19682  CASE(field_grid_point_based_interpolation)
19683  localerror="Can not get by data point for component number "// &
19684  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19685  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19686  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
19687  CALL flagerror(localerror,err,error,*999)
19688  CASE(field_gauss_point_based_interpolation)
19689  localerror="Can not get by data point for component number "// &
19690  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19691  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19692  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
19693  CALL flagerror(localerror,err,error,*999)
19694  CASE(field_data_point_based_interpolation)
19695  decomposition=>field%DECOMPOSITION
19696  IF(ASSOCIATED(decomposition)) THEN
19697  decompositiontopology=>decomposition%TOPOLOGY
19698  IF(ASSOCIATED(decompositiontopology)) THEN
19699  CALL decompositiontopology_datapointcheckexists(decompositiontopology,userdatapointnumber, &
19700  & userdatapointexists,decompositionlocaldatapointnumber,ghostdatapoint,err,error,*999)
19701  IF(userdatapointexists) THEN
19702  dofidx=fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
19703  & data_point_param2dof_map%DATA_POINTS(decompositionlocaldatapointnumber)
19704  CALL distributed_vector_values_get(parameterset%PARAMETERS,dofidx,value,err,error,*999)
19705  ELSE
19706  localerror="The specified user data point number of "// &
19707  & trim(number_to_vstring(userdatapointnumber,"*",err,error))// &
19708  & " does not exist in the decomposition for field component number "// &
19709  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
19710  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19711  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19712  CALL flagerror(localerror,err,error,*999)
19713  ENDIF
19714  ELSE
19715  CALL flagerror("Field decomposition topology is not associated.",err,error,*999)
19716  ENDIF
19717  ELSE
19718  CALL flagerror("Field decomposition is not associated.",err,error,*999)
19719  ENDIF
19720  CASE DEFAULT
19721  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
19722  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
19723  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
19724  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
19725  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19726  CALL flagerror(localerror,err,error,*999)
19727  END SELECT
19728  ELSE
19729  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
19730  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
19731  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
19732  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
19733  CALL flagerror(localerror,err,error,*999)
19734  ENDIF
19735  ELSE
19736  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
19737  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
19738  CALL flagerror(localerror,err,error,*999)
19739  ENDIF
19740  ELSE
19741  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
19742  & " is invalid. The field parameter set type must be between 1 and "// &
19743  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
19744  CALL flagerror(localerror,err,error,*999)
19745  ENDIF
19746  ELSE
19747  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
19748  & " does not correspond to the double precision data type of the given value."
19749  CALL flagerror(localerror,err,error,*999)
19750  ENDIF
19751  ELSE
19752  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
19753  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19754  CALL flagerror(localerror,err,error,*999)
19755  ENDIF
19756  ELSE
19757  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
19758  & " is invalid. The variable type must be between 1 and "// &
19759  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
19760  CALL flagerror(localerror,err,error,*999)
19761  ENDIF
19762  ELSE
19763  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
19764  & " has not been finished."
19765  CALL flagerror(localerror,err,error,*999)
19766  ENDIF
19767  ELSE
19768  CALL flagerror("Field is not associated.",err,error,*999)
19769  ENDIF
19770 
19771  exits("Field_ParameterSetGetDataPointDP")
19772  RETURN
19773 999 errorsexits("Field_ParameterSetGetDataPointDP",err,error)
19774  RETURN 1
19775  END SUBROUTINE field_parametersetgetdatapointdp
19776 
19777  !
19778  !================================================================================================================================
19779  !
19780 
19782  SUBROUTINE field_parametersetgetdatapointl(field,variableType,fieldSetType,userDataPointNumber,componentNumber,value,err,error,*)
19783 
19784  !Argument variables
19785  TYPE(field_type), POINTER :: field
19786  INTEGER(INTG), INTENT(IN) :: variabletype
19787  INTEGER(INTG), INTENT(IN) :: fieldsettype
19788  INTEGER(INTG), INTENT(IN) :: userdatapointnumber
19789  INTEGER(INTG), INTENT(IN) :: componentnumber
19790  LOGICAL, INTENT(OUT) :: value
19791  INTEGER(INTG), INTENT(OUT) :: err
19792  TYPE(varying_string), INTENT(OUT) :: error
19793  !Local Variables
19794  INTEGER(INTG) :: decompositionlocaldatapointnumber,dofidx
19795  LOGICAL :: userdatapointexists,ghostdatapoint
19796  TYPE(decomposition_type), POINTER :: decomposition
19797  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
19798  TYPE(field_parameter_set_type), POINTER :: parameterset
19799  TYPE(field_variable_type), POINTER :: fieldvariable
19800  TYPE(varying_string) :: localerror
19801 
19802  enters("Field_ParameterSetGetDataPointL",err,error,*999)
19803 
19804  IF(ASSOCIATED(field)) THEN
19805  IF(field%FIELD_FINISHED) THEN
19806  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
19807  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
19808  IF(ASSOCIATED(fieldvariable)) THEN
19809  IF(fieldvariable%DATA_TYPE==field_l_type) THEN
19810  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
19811  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
19812  IF(ASSOCIATED(parameterset)) THEN
19813  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
19814  SELECT CASE(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE)
19815  CASE(field_constant_interpolation)
19816  localerror="Can not get by data point for component number "// &
19817  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19818  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19819  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
19820  CALL flagerror(localerror,err,error,*999)
19821  CASE(field_element_based_interpolation)
19822  localerror="Can not get by data point for component number "// &
19823  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19824  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19825  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
19826  CALL flagerror(localerror,err,error,*999)
19827  CASE(field_node_based_interpolation)
19828  localerror="Can not get by data point for component number "// &
19829  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19830  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19831  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
19832  CALL flagerror(localerror,err,error,*999)
19833  CASE(field_grid_point_based_interpolation)
19834  localerror="Can not get by data point for component number "// &
19835  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19836  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19837  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
19838  CALL flagerror(localerror,err,error,*999)
19839  CASE(field_gauss_point_based_interpolation)
19840  localerror="Can not get by data point for component number "// &
19841  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
19842  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19843  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
19844  CALL flagerror(localerror,err,error,*999)
19845  CASE(field_data_point_based_interpolation)
19846  decomposition=>field%DECOMPOSITION
19847  IF(ASSOCIATED(decomposition)) THEN
19848  decompositiontopology=>decomposition%TOPOLOGY
19849  IF(ASSOCIATED(decompositiontopology)) THEN
19850  CALL decompositiontopology_datapointcheckexists(decompositiontopology,userdatapointnumber, &
19851  & userdatapointexists,decompositionlocaldatapointnumber,ghostdatapoint,err,error,*999)
19852  IF(userdatapointexists) THEN
19853  dofidx=fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
19854  & data_point_param2dof_map%DATA_POINTS(decompositionlocaldatapointnumber)
19855  CALL distributed_vector_values_get(parameterset%PARAMETERS,dofidx,value,err,error,*999)
19856  ELSE
19857  localerror="The specified user data point number of "// &
19858  & trim(number_to_vstring(userdatapointnumber,"*",err,error))// &
19859  & " does not exist in the decomposition for field component number "// &
19860  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
19861  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
19862  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19863  CALL flagerror(localerror,err,error,*999)
19864  ENDIF
19865  ELSE
19866  CALL flagerror("Field decomposition topology is not associated.",err,error,*999)
19867  ENDIF
19868  ELSE
19869  CALL flagerror("Field decomposition is not associated.",err,error,*999)
19870  ENDIF
19871  CASE DEFAULT
19872  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
19873  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
19874  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
19875  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
19876  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19877  CALL flagerror(localerror,err,error,*999)
19878  END SELECT
19879  ELSE
19880  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
19881  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
19882  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
19883  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
19884  CALL flagerror(localerror,err,error,*999)
19885  ENDIF
19886  ELSE
19887  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
19888  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
19889  CALL flagerror(localerror,err,error,*999)
19890  ENDIF
19891  ELSE
19892  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
19893  & " is invalid. The field parameter set type must be between 1 and "// &
19894  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
19895  CALL flagerror(localerror,err,error,*999)
19896  ENDIF
19897  ELSE
19898  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
19899  & " does not correspond to the logical data type of the given value."
19900  CALL flagerror(localerror,err,error,*999)
19901  ENDIF
19902  ELSE
19903  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
19904  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19905  CALL flagerror(localerror,err,error,*999)
19906  ENDIF
19907  ELSE
19908  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
19909  & " is invalid. The variable type must be between 1 and "// &
19910  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
19911  CALL flagerror(localerror,err,error,*999)
19912  ENDIF
19913  ELSE
19914  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
19915  & " has not been finished."
19916  CALL flagerror(localerror,err,error,*999)
19917  ENDIF
19918  ELSE
19919  CALL flagerror("Field is not associated.",err,error,*999)
19920  ENDIF
19921 
19922  exits("Field_ParameterSetGetDataPointL")
19923  RETURN
19924 999 errorsexits("Field_ParameterSetGetDataPointL",err,error)
19925  RETURN 1
19926  END SUBROUTINE field_parametersetgetdatapointl
19927 
19928  !
19929  !================================================================================================================================
19930  !
19931 
19933  SUBROUTINE field_parameter_set_get_element_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
19934  & VALUE,err,error,*)
19935 
19936  !Argument variables
19937  TYPE(field_type), POINTER :: field
19938  INTEGER(INTG), INTENT(IN) :: variable_type
19939  INTEGER(INTG), INTENT(IN) :: field_set_type
19940  INTEGER(INTG), INTENT(IN) :: user_element_number
19941  INTEGER(INTG), INTENT(IN) :: component_number
19942  INTEGER(INTG), INTENT(OUT) :: VALUE
19943  INTEGER(INTG), INTENT(OUT) :: err
19944  TYPE(varying_string), INTENT(OUT) :: error
19945  !Local Variables
19946  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
19947  LOGICAL :: ghost_element,user_element_exists
19948  TYPE(decomposition_type), POINTER :: decomposition
19949  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
19950  TYPE(field_parameter_set_type), POINTER :: parameter_set
19951  TYPE(field_variable_type), POINTER :: field_variable
19952  TYPE(varying_string) :: local_error
19953 
19954  enters("FIELD_PARAMETER_SET_GET_ELEMENT_INTG",err,error,*999)
19955 
19956  IF(ASSOCIATED(field)) THEN
19957  IF(field%FIELD_FINISHED) THEN
19958  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
19959  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
19960  IF(ASSOCIATED(field_variable)) THEN
19961  IF(field_variable%DATA_TYPE==field_intg_type) THEN
19962  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
19963  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
19964  IF(ASSOCIATED(parameter_set)) THEN
19965  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
19966  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
19967  CASE(field_constant_interpolation)
19968  local_error="Can not get by element for component number "// &
19969  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19970  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19971  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
19972  CALL flagerror(local_error,err,error,*999)
19973  CASE(field_element_based_interpolation)
19974  decomposition=>field%DECOMPOSITION
19975  IF(ASSOCIATED(decomposition)) THEN
19976  decomposition_topology=>decomposition%TOPOLOGY
19977  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
19978  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
19979  IF(user_element_exists) THEN
19980  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
19981  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
19982  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
19983  ELSE
19984  local_error="The specified user element number of "// &
19985  & trim(number_to_vstring(user_element_number,"*",err,error))// &
19986  & " does not exist in the decomposition for field component number "// &
19987  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
19988  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19989  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
19990  CALL flagerror(local_error,err,error,*999)
19991  ENDIF
19992  ELSE
19993  CALL flagerror("Field decomposition is not associated.",err,error,*999)
19994  ENDIF
19995  CASE(field_node_based_interpolation)
19996  local_error="Can not get by element for component number "// &
19997  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
19998  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
19999  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
20000  CALL flagerror(local_error,err,error,*999)
20001  CASE(field_grid_point_based_interpolation)
20002  local_error="Can not get by element for component number "// &
20003  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20004  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20005  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
20006  CALL flagerror(local_error,err,error,*999)
20007  CASE(field_gauss_point_based_interpolation)
20008  local_error="Can not get by element for component number "// &
20009  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20010  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20011  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
20012  CALL flagerror(local_error,err,error,*999)
20013  CASE(field_data_point_based_interpolation)
20014  local_error="Can not add element for component number "// &
20015  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20016  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20017  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
20018  CALL flagerror(local_error,err,error,*999)
20019  CASE DEFAULT
20020  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
20021  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
20022  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
20023  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
20024  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20025  CALL flagerror(local_error,err,error,*999)
20026  END SELECT
20027  ELSE
20028  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
20029  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
20030  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
20031  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
20032  CALL flagerror(local_error,err,error,*999)
20033  ENDIF
20034  ELSE
20035  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20036  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
20037  CALL flagerror(local_error,err,error,*999)
20038  ENDIF
20039  ELSE
20040  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20041  & " is invalid. The field parameter set type must be between 1 and "// &
20042  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
20043  CALL flagerror(local_error,err,error,*999)
20044  ENDIF
20045  ELSE
20046  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
20047  & " does not correspond to the integer data type of the given value."
20048  CALL flagerror(local_error,err,error,*999)
20049  ENDIF
20050  ELSE
20051  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20052  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20053  CALL flagerror(local_error,err,error,*999)
20054  ENDIF
20055  ELSE
20056  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20057  & " is invalid. The variable type must be between 1 and "// &
20058  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
20059  CALL flagerror(local_error,err,error,*999)
20060  ENDIF
20061  ELSE
20062  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
20063  & " has not been finished."
20064  CALL flagerror(local_error,err,error,*999)
20065  ENDIF
20066  ELSE
20067  CALL flagerror("Field is not associated.",err,error,*999)
20068  ENDIF
20069 
20070  exits("FIELD_PARAMETER_SET_GET_ELEMENT_INTG")
20071  RETURN
20072 999 errorsexits("FIELD_PARAMETER_SET_GET_ELEMENT_INTG",err,error)
20073  RETURN 1
20074  END SUBROUTINE field_parameter_set_get_element_intg
20075 
20076  !
20077  !================================================================================================================================
20078  !
20079 
20080 
20082  SUBROUTINE field_parameter_set_get_element_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
20083  & VALUE,err,error,*)
20084 
20085 
20086  !Argument variables
20087  TYPE(field_type), POINTER :: field
20088  INTEGER(INTG), INTENT(IN) :: variable_type
20089  INTEGER(INTG), INTENT(IN) :: field_set_type
20090  INTEGER(INTG), INTENT(IN) :: user_element_number
20091  INTEGER(INTG), INTENT(IN) :: component_number
20092  REAL(SP), INTENT(OUT) :: VALUE
20093  INTEGER(INTG), INTENT(OUT) :: err
20094  TYPE(varying_string), INTENT(OUT) :: error
20095  !Local Variables
20096  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
20097  LOGICAL :: ghost_element,user_element_exists
20098  TYPE(decomposition_type), POINTER :: decomposition
20099  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
20100  TYPE(field_parameter_set_type), POINTER :: parameter_set
20101  TYPE(field_variable_type), POINTER :: field_variable
20102  TYPE(varying_string) :: local_error
20103 
20104  enters("FIELD_PARAMETER_SET_GET_ELEMENT_SP",err,error,*999)
20105 
20106  IF(ASSOCIATED(field)) THEN
20107  IF(field%FIELD_FINISHED) THEN
20108  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
20109  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
20110  IF(ASSOCIATED(field_variable)) THEN
20111  IF(field_variable%DATA_TYPE==field_sp_type) THEN
20112  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
20113  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
20114  IF(ASSOCIATED(parameter_set)) THEN
20115  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
20116  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
20117  CASE(field_constant_interpolation)
20118  local_error="Can not get by element for component number "// &
20119  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20120  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20121  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
20122  CALL flagerror(local_error,err,error,*999)
20123  CASE(field_element_based_interpolation)
20124  decomposition=>field%DECOMPOSITION
20125  IF(ASSOCIATED(decomposition)) THEN
20126  decomposition_topology=>decomposition%TOPOLOGY
20127  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
20128  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
20129  IF(user_element_exists) THEN
20130  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
20131  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
20132  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
20133  ELSE
20134  local_error="The specified user element number of "// &
20135  & trim(number_to_vstring(user_element_number,"*",err,error))// &
20136  & " does not exist in the decomposition for field component number "// &
20137  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
20138  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20139  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20140  CALL flagerror(local_error,err,error,*999)
20141  ENDIF
20142  ELSE
20143  CALL flagerror("Field decomposition is not associated.",err,error,*999)
20144  ENDIF
20145  CASE(field_node_based_interpolation)
20146  local_error="Can not get by element for component number "// &
20147  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20148  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20149  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
20150  CALL flagerror(local_error,err,error,*999)
20151  CASE(field_grid_point_based_interpolation)
20152  local_error="Can not get by element for component number "// &
20153  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20154  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20155  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
20156  CALL flagerror(local_error,err,error,*999)
20157  CASE(field_gauss_point_based_interpolation)
20158  local_error="Can not get by element for component number "// &
20159  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20160  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20161  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
20162  CALL flagerror(local_error,err,error,*999)
20163  CASE(field_data_point_based_interpolation)
20164  local_error="Can not add element for component number "// &
20165  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20166  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20167  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
20168  CALL flagerror(local_error,err,error,*999)
20169  CASE DEFAULT
20170  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
20171  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
20172  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
20173  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
20174  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20175  CALL flagerror(local_error,err,error,*999)
20176  END SELECT
20177  ELSE
20178  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
20179  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
20180  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
20181  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
20182  CALL flagerror(local_error,err,error,*999)
20183  ENDIF
20184  ELSE
20185  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20186  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
20187  CALL flagerror(local_error,err,error,*999)
20188  ENDIF
20189  ELSE
20190  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20191  & " is invalid. The field parameter set type must be between 1 and "// &
20192  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
20193  CALL flagerror(local_error,err,error,*999)
20194  ENDIF
20195  ELSE
20196  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
20197  & " does not correspond to the single precision data type of the given value."
20198  CALL flagerror(local_error,err,error,*999)
20199  ENDIF
20200  ELSE
20201  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20202  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20203  CALL flagerror(local_error,err,error,*999)
20204  ENDIF
20205  ELSE
20206  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20207  & " is invalid. The variable type must be between 1 and "// &
20208  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
20209  CALL flagerror(local_error,err,error,*999)
20210  ENDIF
20211  ELSE
20212  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
20213  & " has not been finished."
20214  CALL flagerror(local_error,err,error,*999)
20215  ENDIF
20216  ELSE
20217  CALL flagerror("Field is not associated.",err,error,*999)
20218  ENDIF
20219 
20220  exits("FIELD_PARAMETER_SET_GET_ELEMENT_SP")
20221  RETURN
20222 999 errorsexits("FIELD_PARAMETER_SET_GET_ELEMENT_SP",err,error)
20223  RETURN 1
20224  END SUBROUTINE field_parameter_set_get_element_sp
20225 
20226  !
20227  !================================================================================================================================
20228  !
20229 
20231  SUBROUTINE field_parameter_set_get_element_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
20232  & VALUE,err,error,*)
20233 
20234  !Argument variables
20235  TYPE(field_type), POINTER :: field
20236  INTEGER(INTG), INTENT(IN) :: variable_type
20237  INTEGER(INTG), INTENT(IN) :: field_set_type
20238  INTEGER(INTG), INTENT(IN) :: user_element_number
20239  INTEGER(INTG), INTENT(IN) :: component_number
20240  REAL(DP), INTENT(OUT) :: VALUE
20241  INTEGER(INTG), INTENT(OUT) :: err
20242  TYPE(varying_string), INTENT(OUT) :: error
20243  !Local Variables
20244  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
20245  LOGICAL :: ghost_element,user_element_exists
20246  TYPE(decomposition_type), POINTER :: decomposition
20247  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
20248  TYPE(field_parameter_set_type), POINTER :: parameter_set
20249  TYPE(field_variable_type), POINTER :: field_variable
20250  TYPE(varying_string) :: local_error
20251 
20252  enters("FIELD_PARAMETER_SET_GET_ELEMENT_DP",err,error,*999)
20253 
20254  IF(ASSOCIATED(field)) THEN
20255  IF(field%FIELD_FINISHED) THEN
20256  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
20257  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
20258  IF(ASSOCIATED(field_variable)) THEN
20259  IF(field_variable%DATA_TYPE==field_dp_type) THEN
20260  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
20261  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
20262  IF(ASSOCIATED(parameter_set)) THEN
20263  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
20264  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
20265  CASE(field_constant_interpolation)
20266  local_error="Can not get by element for component number "// &
20267  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20268  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20269  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
20270  CALL flagerror(local_error,err,error,*999)
20271  CASE(field_element_based_interpolation)
20272  decomposition=>field%DECOMPOSITION
20273  IF(ASSOCIATED(decomposition)) THEN
20274  decomposition_topology=>decomposition%TOPOLOGY
20275  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
20276  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
20277  IF(user_element_exists) THEN
20278  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
20279  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
20280  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
20281  ELSE
20282  local_error="The specified user element number of "// &
20283  & trim(number_to_vstring(user_element_number,"*",err,error))// &
20284  & " does not exist in the decomposition for field component number "// &
20285  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
20286  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20287  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20288  CALL flagerror(local_error,err,error,*999)
20289  ENDIF
20290  ELSE
20291  CALL flagerror("Field decomposition is not associated.",err,error,*999)
20292  ENDIF
20293  CASE(field_node_based_interpolation)
20294  local_error="Can not get by element for component number "// &
20295  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20296  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20297  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
20298  CALL flagerror(local_error,err,error,*999)
20299  CASE(field_grid_point_based_interpolation)
20300  local_error="Can not get by element for component number "// &
20301  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20302  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20303  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
20304  CALL flagerror(local_error,err,error,*999)
20305  CASE(field_gauss_point_based_interpolation)
20306  local_error="Can not get by element for component number "// &
20307  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20308  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20309  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
20310  CALL flagerror(local_error,err,error,*999)
20311  CASE(field_data_point_based_interpolation)
20312  local_error="Can not add element for component number "// &
20313  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20314  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20315  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
20316  CALL flagerror(local_error,err,error,*999)
20317  CASE DEFAULT
20318  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
20319  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
20320  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
20321  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
20322  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20323  CALL flagerror(local_error,err,error,*999)
20324  END SELECT
20325  ELSE
20326  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
20327  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
20328  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
20329  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
20330  CALL flagerror(local_error,err,error,*999)
20331  ENDIF
20332  ELSE
20333  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20334  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
20335  CALL flagerror(local_error,err,error,*999)
20336  ENDIF
20337  ELSE
20338  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20339  & " is invalid. The field parameter set type must be between 1 and "// &
20340  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
20341  CALL flagerror(local_error,err,error,*999)
20342  ENDIF
20343  ELSE
20344  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
20345  & " does not correspond to the double precision data type of the given value."
20346  CALL flagerror(local_error,err,error,*999)
20347  ENDIF
20348  ELSE
20349  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20350  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20351  CALL flagerror(local_error,err,error,*999)
20352  ENDIF
20353  ELSE
20354  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20355  & " is invalid. The variable type must be between 1 and "// &
20356  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
20357  CALL flagerror(local_error,err,error,*999)
20358  ENDIF
20359  ELSE
20360  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
20361  & " has not been finished."
20362  CALL flagerror(local_error,err,error,*999)
20363  ENDIF
20364  ELSE
20365  CALL flagerror("Field is not associated.",err,error,*999)
20366  ENDIF
20367 
20368  exits("FIELD_PARAMETER_SET_GET_ELEMENT_DP")
20369  RETURN
20370 999 errorsexits("FIELD_PARAMETER_SET_GET_ELEMENT_DP",err,error)
20371  RETURN 1
20372  END SUBROUTINE field_parameter_set_get_element_dp
20373 
20374  !
20375  !================================================================================================================================
20376  !
20377 
20379  SUBROUTINE field_parameter_set_get_element_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
20380  & VALUE,err,error,*)
20381 
20382  !Argument variables
20383  TYPE(field_type), POINTER :: field
20384  INTEGER(INTG), INTENT(IN) :: variable_type
20385  INTEGER(INTG), INTENT(IN) :: field_set_type
20386  INTEGER(INTG), INTENT(IN) :: user_element_number
20387  INTEGER(INTG), INTENT(IN) :: component_number
20388  LOGICAL, INTENT(OUT) :: VALUE
20389  INTEGER(INTG), INTENT(OUT) :: err
20390  TYPE(varying_string), INTENT(OUT) :: error
20391  !Local Variables
20392  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
20393  LOGICAL :: ghost_element,user_element_exists
20394  TYPE(decomposition_type), POINTER :: decomposition
20395  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
20396  TYPE(field_parameter_set_type), POINTER :: parameter_set
20397  TYPE(field_variable_type), POINTER :: field_variable
20398  TYPE(varying_string) :: local_error
20399 
20400  enters("FIELD_PARAMETER_SET_GET_ELEMENT_L",err,error,*999)
20401 
20402  IF(ASSOCIATED(field)) THEN
20403  IF(field%FIELD_FINISHED) THEN
20404  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
20405  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
20406  IF(ASSOCIATED(field_variable)) THEN
20407  IF(field_variable%DATA_TYPE==field_l_type) THEN
20408  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
20409  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
20410  IF(ASSOCIATED(parameter_set)) THEN
20411  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
20412  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
20413  CASE(field_constant_interpolation)
20414  local_error="Can not get by element for component number "// &
20415  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20416  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20417  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
20418  CALL flagerror(local_error,err,error,*999)
20419  CASE(field_element_based_interpolation)
20420  decomposition=>field%DECOMPOSITION
20421  IF(ASSOCIATED(decomposition)) THEN
20422  decomposition_topology=>decomposition%TOPOLOGY
20423  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
20424  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
20425  IF(user_element_exists) THEN
20426  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
20427  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
20428  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
20429  ELSE
20430  local_error="The specified user element number of "// &
20431  & trim(number_to_vstring(user_element_number,"*",err,error))// &
20432  & " does not exist in the decomposition for field component number "// &
20433  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
20434  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20435  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20436  CALL flagerror(local_error,err,error,*999)
20437  ENDIF
20438  ELSE
20439  CALL flagerror("Field decomposition is not associated.",err,error,*999)
20440  ENDIF
20441  CASE(field_node_based_interpolation)
20442  local_error="Can not get by element for component number "// &
20443  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20444  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20445  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
20446  CALL flagerror(local_error,err,error,*999)
20447  CASE(field_grid_point_based_interpolation)
20448  local_error="Can not get by element for component number "// &
20449  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20450  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20451  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
20452  CALL flagerror(local_error,err,error,*999)
20453  CASE(field_gauss_point_based_interpolation)
20454  local_error="Can not get by element for component number "// &
20455  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20456  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20457  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
20458  CALL flagerror(local_error,err,error,*999)
20459  CASE(field_data_point_based_interpolation)
20460  local_error="Can not add element for component number "// &
20461  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20462  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20463  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
20464  CALL flagerror(local_error,err,error,*999)
20465  CASE DEFAULT
20466  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
20467  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
20468  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
20469  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
20470  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20471  CALL flagerror(local_error,err,error,*999)
20472  END SELECT
20473  ELSE
20474  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
20475  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
20476  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
20477  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
20478  CALL flagerror(local_error,err,error,*999)
20479  ENDIF
20480  ELSE
20481  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20482  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
20483  CALL flagerror(local_error,err,error,*999)
20484  ENDIF
20485  ELSE
20486  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20487  & " is invalid. The field parameter set type must be between 1 and "// &
20488  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
20489  CALL flagerror(local_error,err,error,*999)
20490  ENDIF
20491  ELSE
20492  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
20493  & " does not correspond to the logical data type of the given value."
20494  CALL flagerror(local_error,err,error,*999)
20495  ENDIF
20496  ELSE
20497  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20498  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20499  CALL flagerror(local_error,err,error,*999)
20500  ENDIF
20501  ELSE
20502  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20503  & " is invalid. The variable type must be between 1 and "// &
20504  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
20505  CALL flagerror(local_error,err,error,*999)
20506  ENDIF
20507  ELSE
20508  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
20509  & " has not been finished."
20510  CALL flagerror(local_error,err,error,*999)
20511  ENDIF
20512  ELSE
20513  CALL flagerror("Field is not associated.",err,error,*999)
20514  ENDIF
20515 
20516  exits("FIELD_PARAMETER_SET_GET_ELEMENT_L")
20517  RETURN
20518 999 errorsexits("FIELD_PARAMETER_SET_GET_ELEMENT_L",err,error)
20519  RETURN 1
20520  END SUBROUTINE field_parameter_set_get_element_l
20521 
20522  !
20523  !================================================================================================================================
20524  !
20525 
20527  SUBROUTINE field_parameter_set_get_local_dof_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
20528 
20529  !Argument variables
20530  TYPE(field_type), POINTER :: field
20531  INTEGER(INTG), INTENT(IN) :: variable_type
20532  INTEGER(INTG), INTENT(IN) :: field_set_type
20533  INTEGER(INTG), INTENT(IN) :: dof_number
20534  INTEGER(INTG), INTENT(OUT) :: VALUE
20535  INTEGER(INTG), INTENT(OUT) :: err
20536  TYPE(varying_string), INTENT(OUT) :: error
20537  !Local Variables
20538  TYPE(field_parameter_set_type), POINTER :: parameter_set
20539  TYPE(field_variable_type), POINTER :: field_variable
20540  TYPE(varying_string) :: local_error
20541 
20542  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_INTG",err,error,*999)
20543 
20544 !!TODO: Allow multiple dof number and values updates.
20545  IF(ASSOCIATED(field)) THEN
20546  IF(field%FIELD_FINISHED) THEN
20547  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
20548  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
20549  IF(ASSOCIATED(field_variable)) THEN
20550  IF(field_variable%DATA_TYPE==field_intg_type) THEN
20551  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
20552  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
20553  IF(ASSOCIATED(parameter_set)) THEN
20554  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL) THEN
20555  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
20556  ELSE
20557  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
20558  & " is invalid. It must be >0 and <="// &
20559  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL,"*",err,error))// &
20560  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20561  CALL flagerror(local_error,err,error,*999)
20562  ENDIF
20563  ELSE
20564  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20565  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20566  CALL flagerror(local_error,err,error,*999)
20567  ENDIF
20568  ELSE
20569  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20570  & " is invalid. The field parameter set type must be between 1 and "// &
20571  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
20572  CALL flagerror(local_error,err,error,*999)
20573  ENDIF
20574  ELSE
20575  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
20576  & " does not correspond to the integer data type of the given value."
20577  CALL flagerror(local_error,err,error,*999)
20578  ENDIF
20579  ELSE
20580  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20581  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20582  CALL flagerror(local_error,err,error,*999)
20583  ENDIF
20584  ELSE
20585  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20586  & " is invalid. The variable type must be between 1 and "// &
20587  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
20588  CALL flagerror(local_error,err,error,*999)
20589  ENDIF
20590  ELSE
20591  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
20592  & " has not been finished."
20593  CALL flagerror(local_error,err,error,*999)
20594  ENDIF
20595  ELSE
20596  CALL flagerror("Field is not associated.",err,error,*999)
20597  ENDIF
20598 
20599  exits("FIELD_PARAMETER_SET_GET_LOCAL_DOF_INTG")
20600  RETURN
20601 999 errorsexits("FIELD_PARAMETER_SET_GET_LOCAL_DOF_INTG",err,error)
20602  RETURN 1
20603  END SUBROUTINE field_parameter_set_get_local_dof_intg
20604 
20605  !
20606  !================================================================================================================================
20607  !
20608 
20610  SUBROUTINE field_parameter_set_get_local_dof_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
20611 
20612  !Argument variables
20613  TYPE(field_type), POINTER :: field
20614  INTEGER(INTG), INTENT(IN) :: variable_type
20615  INTEGER(INTG), INTENT(IN) :: field_set_type
20616  INTEGER(INTG), INTENT(IN) :: dof_number
20617  REAL(SP), INTENT(OUT) :: VALUE
20618  INTEGER(INTG), INTENT(OUT) :: err
20619  TYPE(varying_string), INTENT(OUT) :: error
20620  !Local Variables
20621  TYPE(field_parameter_set_type), POINTER :: parameter_set
20622  TYPE(field_variable_type), POINTER :: field_variable
20623  TYPE(varying_string) :: local_error
20624 
20625  enters("FIELD_PARAMETER_SET_GET_LOCAL_DOF_SP",err,error,*999)
20626 
20627 !!TODO: Allow multiple dof number and values updates.
20628  IF(ASSOCIATED(field)) THEN
20629  IF(field%FIELD_FINISHED) THEN
20630  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
20631  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
20632  IF(ASSOCIATED(field_variable)) THEN
20633  IF(field_variable%DATA_TYPE==field_sp_type) THEN
20634  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
20635  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
20636  IF(ASSOCIATED(parameter_set)) THEN
20637  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL) THEN
20638  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
20639  ELSE
20640  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
20641  & " is invalid. It must be >0 and <="// &
20642  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL,"*",err,error))// &
20643  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20644  CALL flagerror(local_error,err,error,*999)
20645  ENDIF
20646  ELSE
20647  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20648  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20649  CALL flagerror(local_error,err,error,*999)
20650  ENDIF
20651  ELSE
20652  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20653  & " is invalid. The field parameter set type must be between 1 and "// &
20654  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
20655  CALL flagerror(local_error,err,error,*999)
20656  ENDIF
20657  ELSE
20658  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
20659  & " does not correspond to the single precision data type of the given value."
20660  CALL flagerror(local_error,err,error,*999)
20661  ENDIF
20662  ELSE
20663  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20664  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20665  CALL flagerror(local_error,err,error,*999)
20666  ENDIF
20667  ELSE
20668  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20669  & " is invalid. The variable type must be between 1 and "// &
20670  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
20671  CALL flagerror(local_error,err,error,*999)
20672  ENDIF
20673  ELSE
20674  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
20675  & " has not been finished."
20676  CALL flagerror(local_error,err,error,*999)
20677  ENDIF
20678  ELSE
20679  CALL flagerror("Field is not associated.",err,error,*999)
20680  ENDIF
20681 
20682  exits("FIELD_PARAMETER_SET_GET_LOCAL_DOF_SP")
20683  RETURN
20684 999 errorsexits("FIELD_PARAMETER_SET_GET_LOCAL_DOF_SP",err,error)
20685  RETURN 1
20686  END SUBROUTINE field_parameter_set_get_local_dof_sp
20687 
20688  !
20689  !================================================================================================================================
20690  !
20691 
20693  SUBROUTINE field_parameter_set_get_local_dof_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
20694 
20695  !Argument variables
20696  TYPE(field_type), POINTER :: field
20697  INTEGER(INTG), INTENT(IN) :: variable_type
20698  INTEGER(INTG), INTENT(IN) :: field_set_type
20699  INTEGER(INTG), INTENT(IN) :: dof_number
20700  REAL(DP), INTENT(OUT) :: VALUE
20701  INTEGER(INTG), INTENT(OUT) :: err
20702  TYPE(varying_string), INTENT(OUT) :: error
20703  !Local Variables
20704  TYPE(field_parameter_set_type), POINTER :: parameter_set
20705  TYPE(field_variable_type), POINTER :: field_variable
20706  TYPE(varying_string) :: local_error
20707 
20708  enters("FIELD_PARAMETER_SET_GET_LOCAL_DOF_DP",err,error,*999)
20709 
20710 !!TODO: Allow multiple dof number and values updates.
20711  IF(ASSOCIATED(field)) THEN
20712  IF(field%FIELD_FINISHED) THEN
20713  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
20714  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
20715  IF(ASSOCIATED(field_variable)) THEN
20716  IF(field_variable%DATA_TYPE==field_dp_type) THEN
20717  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
20718  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
20719  IF(ASSOCIATED(parameter_set)) THEN
20720  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL) THEN
20721  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
20722  ELSE
20723  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
20724  & " is invalid. It must be >0 and <="// &
20725  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL,"*",err,error))// &
20726  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20727  CALL flagerror(local_error,err,error,*999)
20728  ENDIF
20729  ELSE
20730  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20731  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20732  CALL flagerror(local_error,err,error,*999)
20733  ENDIF
20734  ELSE
20735  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20736  & " is invalid. The field parameter set type must be between 1 and "// &
20737  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
20738  CALL flagerror(local_error,err,error,*999)
20739  ENDIF
20740  ELSE
20741  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
20742  & " does not correspond to the double precision data type of the given value."
20743  CALL flagerror(local_error,err,error,*999)
20744  ENDIF
20745  ELSE
20746  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20747  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20748  CALL flagerror(local_error,err,error,*999)
20749  ENDIF
20750  ELSE
20751  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20752  & " is invalid. The variable type must be between 1 and "// &
20753  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
20754  CALL flagerror(local_error,err,error,*999)
20755  ENDIF
20756  ELSE
20757  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
20758  & " has not been finished."
20759  CALL flagerror(local_error,err,error,*999)
20760  ENDIF
20761  ELSE
20762  CALL flagerror("Field is not associated.",err,error,*999)
20763  ENDIF
20764 
20765  exits("FIELD_PARAMETER_SET_GET_LOCAL_DOF_DP")
20766  RETURN
20767 999 errorsexits("FIELD_PARAMETER_SET_GET_LOCAL_DOF_DP",err,error)
20768  RETURN 1
20769  END SUBROUTINE field_parameter_set_get_local_dof_dp
20770 
20771  !
20772  !================================================================================================================================
20773  !
20774 
20776  SUBROUTINE field_parameter_set_get_local_dof_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
20777 
20778  !Argument variables
20779  TYPE(field_type), POINTER :: field
20780  INTEGER(INTG), INTENT(IN) :: variable_type
20781  INTEGER(INTG), INTENT(IN) :: field_set_type
20782  INTEGER(INTG), INTENT(IN) :: dof_number
20783  LOGICAL, INTENT(OUT) :: VALUE
20784  INTEGER(INTG), INTENT(OUT) :: err
20785  TYPE(varying_string), INTENT(OUT) :: error
20786  !Local Variables
20787  TYPE(field_parameter_set_type), POINTER :: parameter_set
20788  TYPE(field_variable_type), POINTER :: field_variable
20789  TYPE(varying_string) :: local_error
20790 
20791  enters("FIELD_PARAMETER_SET_GET_LOCAL_DOF_L",err,error,*999)
20792 
20793 !!TODO: Allow multiple dof number and values updates.
20794  IF(ASSOCIATED(field)) THEN
20795  IF(field%FIELD_FINISHED) THEN
20796  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
20797  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
20798  IF(ASSOCIATED(field_variable)) THEN
20799  IF(field_variable%DATA_TYPE==field_l_type) THEN
20800  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
20801  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
20802  IF(ASSOCIATED(parameter_set)) THEN
20803  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL) THEN
20804  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
20805  ELSE
20806  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
20807  & " is invalid. It must be >0 and <="// &
20808  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%TOTAL_NUMBER_OF_LOCAL,"*",err,error))// &
20809  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20810  CALL flagerror(local_error,err,error,*999)
20811  ENDIF
20812  ELSE
20813  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20814  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20815  CALL flagerror(local_error,err,error,*999)
20816  ENDIF
20817  ELSE
20818  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
20819  & " is invalid. The field parameter set type must be between 1 and "// &
20820  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
20821  CALL flagerror(local_error,err,error,*999)
20822  ENDIF
20823  ELSE
20824  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
20825  & " does not correspond to the logical data type of the given value."
20826  CALL flagerror(local_error,err,error,*999)
20827  ENDIF
20828  ELSE
20829  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20830  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20831  CALL flagerror(local_error,err,error,*999)
20832  ENDIF
20833  ELSE
20834  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
20835  & " is invalid. The variable type must be between 1 and "// &
20836  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
20837  CALL flagerror(local_error,err,error,*999)
20838  ENDIF
20839  ELSE
20840  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
20841  & " has not been finished."
20842  CALL flagerror(local_error,err,error,*999)
20843  ENDIF
20844  ELSE
20845  CALL flagerror("Field is not associated.",err,error,*999)
20846  ENDIF
20847 
20848  exits("FIELD_PARAMETER_SET_GET_LOCAL_DOF_L")
20849  RETURN
20850 999 errorsexits("FIELD_PARAMETER_SET_GET_LOCAL_DOF_L",err,error)
20851  RETURN 1
20852  END SUBROUTINE field_parameter_set_get_local_dof_l
20853 
20854  !
20855  !================================================================================================================================
20856  !
20857 
20859  SUBROUTINE field_parameter_set_get_node_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
20860  & user_node_number,component_number,VALUE,err,error,*)
20861 
20862  !Argument variables
20863  TYPE(field_type), POINTER :: field
20864  INTEGER(INTG), INTENT(IN) :: variable_type
20865  INTEGER(INTG), INTENT(IN) :: field_set_type
20866  INTEGER(INTG), INTENT(IN) :: version_number
20867  INTEGER(INTG), INTENT(IN) :: derivative_number
20868  INTEGER(INTG), INTENT(IN) :: user_node_number
20869  INTEGER(INTG), INTENT(IN) :: component_number
20870  INTEGER(INTG), INTENT(OUT) :: VALUE
20871  INTEGER(INTG), INTENT(OUT) :: err
20872  TYPE(varying_string), INTENT(OUT) :: error
20873  !Local Variables
20874  INTEGER(INTG) :: domain_local_node_number,dof_idx
20875  LOGICAL :: ghost_node,user_node_exists
20876  TYPE(domain_type), POINTER :: domain
20877  TYPE(domain_nodes_type), POINTER :: domain_nodes
20878  TYPE(domain_topology_type), POINTER :: domain_topology
20879  TYPE(field_parameter_set_type), POINTER :: parameter_set
20880  TYPE(field_variable_type), POINTER :: field_variable
20881  TYPE(varying_string) :: local_error
20882 
20883  enters("FIELD_PARAMETER_SET_GET_NODE_INTG",err,error,*999)
20884 
20885  IF(ASSOCIATED(field)) THEN
20886  IF(field%FIELD_FINISHED) THEN
20887  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
20888  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
20889  IF(ASSOCIATED(field_variable)) THEN
20890  IF(field_variable%DATA_TYPE==field_intg_type) THEN
20891  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
20892  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
20893  IF(ASSOCIATED(parameter_set)) THEN
20894  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
20895  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
20896  CASE(field_constant_interpolation)
20897  local_error="Can not get by node for component number "// &
20898  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20899  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20900  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
20901  CALL flagerror(local_error,err,error,*999)
20902  CASE(field_element_based_interpolation)
20903  local_error="Can not get by node for component number "// &
20904  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20905  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20906  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
20907  CALL flagerror(local_error,err,error,*999)
20908  CASE(field_node_based_interpolation)
20909  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
20910  IF(ASSOCIATED(domain)) THEN
20911  domain_topology=>domain%TOPOLOGY
20912  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
20913  & domain_local_node_number,ghost_node,err,error,*999)
20914  IF(user_node_exists) THEN
20915  domain_nodes=>domain_topology%NODES
20916  IF(ASSOCIATED(domain_nodes)) THEN
20917  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
20918  & number_of_derivatives) THEN
20919  IF(version_number>0.AND.version_number<= &
20920  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
20921  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
20922  & number_of_versions) THEN
20923  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
20924  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
20925  & versions(version_number)
20926  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
20927  ELSE
20928  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
20929  & " is invalid for derivative number "// &
20930  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
20931  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
20932  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20933  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20934  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
20935  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
20936  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
20937  & "(note version numbers are indexed directly from the value the user specifies during "// &
20938  & "element creation and no record is kept of the total number of versions the user sets."// &
20939  & "The maximum version number the user sets defines the total number of versions allocated)."
20940  CALL flagerror(local_error,err,error,*999)
20941  ENDIF
20942  ELSE
20943  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
20944  & " is invalid for user node number "// &
20945  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
20946  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20947  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20948  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
20949  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
20950  & number_of_derivatives,"*",err,error))//" derivatives."
20951  CALL flagerror(local_error,err,error,*999)
20952  ENDIF
20953  ENDIF
20954  ELSE
20955  local_error="The specified user node number of "// &
20956  & trim(number_to_vstring(user_node_number,"*",err,error))// &
20957  & " does not exist in the domain for field component number "// &
20958  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
20959  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20960  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20961  CALL flagerror(local_error,err,error,*999)
20962  ENDIF
20963  ELSE
20964  CALL flagerror("Domain is not associated.",err,error,*999)
20965  ENDIF
20966  CASE(field_grid_point_based_interpolation)
20967  local_error="Can not get by node for component number "// &
20968  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20969  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20970  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
20971  CALL flagerror(local_error,err,error,*999)
20972  CASE(field_gauss_point_based_interpolation)
20973  local_error="Can not get by node for component number "// &
20974  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20975  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20976  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
20977  CALL flagerror(local_error,err,error,*999)
20978  CASE(field_data_point_based_interpolation)
20979  local_error="Can not add element for component number "// &
20980  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
20981  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
20982  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
20983  CALL flagerror(local_error,err,error,*999)
20984  CASE DEFAULT
20985  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
20986  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
20987  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
20988  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
20989  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
20990  CALL flagerror(local_error,err,error,*999)
20991  END SELECT
20992  ELSE
20993  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
20994  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
20995  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
20996  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
20997  & " components."
20998  CALL flagerror(local_error,err,error,*999)
20999  ENDIF
21000  ELSE
21001  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
21002  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21003  CALL flagerror(local_error,err,error,*999)
21004  ENDIF
21005  ELSE
21006  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
21007  & " is invalid. The field parameter set type must be between 1 and "// &
21008  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
21009  CALL flagerror(local_error,err,error,*999)
21010  ENDIF
21011  ELSE
21012  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
21013  & " does not correspond to the integer data type of the given value."
21014  CALL flagerror(local_error,err,error,*999)
21015  ENDIF
21016  ELSE
21017  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
21018  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21019  CALL flagerror(local_error,err,error,*999)
21020  ENDIF
21021  ELSE
21022  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
21023  & " is invalid. The variable type must be between 1 and "// &
21024  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
21025  CALL flagerror(local_error,err,error,*999)
21026  ENDIF
21027  ELSE
21028  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
21029  & " has not been finished."
21030  CALL flagerror(local_error,err,error,*999)
21031  ENDIF
21032  ELSE
21033  CALL flagerror("Field is not associated.",err,error,*999)
21034  ENDIF
21035 
21036  exits("FIELD_PARAMETER_SET_GET_NODE_INTG")
21037  RETURN
21038 999 errorsexits("FIELD_PARAMETER_SET_GET_NODE_INTG",err,error)
21039  RETURN 1
21040  END SUBROUTINE field_parameter_set_get_node_intg
21041 
21042  !
21043  !================================================================================================================================
21044  !
21045 
21047  SUBROUTINE field_parameter_set_get_node_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
21048  & user_node_number,component_number,VALUE,err,error,*)
21049 
21050  !Argument variables
21051  TYPE(field_type), POINTER :: field
21052  INTEGER(INTG), INTENT(IN) :: variable_type
21053  INTEGER(INTG), INTENT(IN) :: field_set_type
21054  INTEGER(INTG), INTENT(IN) :: version_number
21055  INTEGER(INTG), INTENT(IN) :: derivative_number
21056  INTEGER(INTG), INTENT(IN) :: user_node_number
21057  INTEGER(INTG), INTENT(IN) :: component_number
21058  REAL(SP), INTENT(OUT) :: VALUE
21059  INTEGER(INTG), INTENT(OUT) :: err
21060  TYPE(varying_string), INTENT(OUT) :: error
21061  !Local Variables
21062  INTEGER(INTG) :: domain_local_node_number,dof_idx
21063  LOGICAL :: ghost_node,user_node_exists
21064  TYPE(domain_type), POINTER :: domain
21065  TYPE(domain_nodes_type), POINTER :: domain_nodes
21066  TYPE(domain_topology_type), POINTER :: domain_topology
21067  TYPE(field_parameter_set_type), POINTER :: parameter_set
21068  TYPE(field_variable_type), POINTER :: field_variable
21069  TYPE(varying_string) :: local_error
21070 
21071  enters("FIELD_PARAMETER_SET_GET_NODE_SP",err,error,*999)
21072 
21073  IF(ASSOCIATED(field)) THEN
21074  IF(field%FIELD_FINISHED) THEN
21075  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
21076  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
21077  IF(ASSOCIATED(field_variable)) THEN
21078  IF(field_variable%DATA_TYPE==field_sp_type) THEN
21079  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
21080  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
21081  IF(ASSOCIATED(parameter_set)) THEN
21082  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
21083  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
21084  CASE(field_constant_interpolation)
21085  local_error="Can not get by node for component number "// &
21086  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21087  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21088  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
21089  CALL flagerror(local_error,err,error,*999)
21090  CASE(field_element_based_interpolation)
21091  local_error="Can not get by node for component number "// &
21092  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21093  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21094  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
21095  CALL flagerror(local_error,err,error,*999)
21096  CASE(field_node_based_interpolation)
21097  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
21098  IF(ASSOCIATED(domain)) THEN
21099  domain_topology=>domain%TOPOLOGY
21100  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
21101  & domain_local_node_number,ghost_node,err,error,*999)
21102  IF(user_node_exists) THEN
21103  domain_nodes=>domain_topology%NODES
21104  IF(ASSOCIATED(domain_nodes)) THEN
21105  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
21106  & number_of_derivatives) THEN
21107  IF(version_number>0.AND.version_number<= &
21108  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
21109  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
21110  & number_of_versions) THEN
21111  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
21112  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
21113  & versions(version_number)
21114  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
21115  ELSE
21116  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
21117  & " is invalid for derivative number "// &
21118  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
21119  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
21120  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21121  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21122  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
21123  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
21124  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
21125  & "(note version numbers are indexed directly from the value the user specifies during "// &
21126  & "element creation and no record is kept of the total number of versions the user sets."// &
21127  & "The maximum version number the user sets defines the total number of versions allocated)."
21128  CALL flagerror(local_error,err,error,*999)
21129  ENDIF
21130  ELSE
21131  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
21132  & " is invalid for user node number "// &
21133  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
21134  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21135  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21136  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21137  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
21138  & number_of_derivatives,"*",err,error))//" derivatives."
21139  CALL flagerror(local_error,err,error,*999)
21140  ENDIF
21141  ENDIF
21142  ELSE
21143  local_error="The specified user node number of "// &
21144  & trim(number_to_vstring(user_node_number,"*",err,error))// &
21145  & " does not exist in the domain for field component number "// &
21146  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
21147  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21148  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21149  CALL flagerror(local_error,err,error,*999)
21150  ENDIF
21151  ELSE
21152  CALL flagerror("Domain is not associated.",err,error,*999)
21153  ENDIF
21154  CASE(field_grid_point_based_interpolation)
21155  local_error="Can not get by node for component number "// &
21156  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21157  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21158  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
21159  CALL flagerror(local_error,err,error,*999)
21160  CASE(field_gauss_point_based_interpolation)
21161  local_error="Can not get by node for component number "// &
21162  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21163  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21164  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
21165  CALL flagerror(local_error,err,error,*999)
21166  CASE(field_data_point_based_interpolation)
21167  local_error="Can not add element for component number "// &
21168  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21169  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21170  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
21171  CALL flagerror(local_error,err,error,*999)
21172  CASE DEFAULT
21173  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
21174  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
21175  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
21176  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
21177  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21178  CALL flagerror(local_error,err,error,*999)
21179  END SELECT
21180  ELSE
21181  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
21182  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
21183  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21184  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
21185  & " components."
21186  CALL flagerror(local_error,err,error,*999)
21187  ENDIF
21188  ELSE
21189  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
21190  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21191  CALL flagerror(local_error,err,error,*999)
21192  ENDIF
21193  ELSE
21194  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
21195  & " is invalid. The field parameter set type must be between 1 and "// &
21196  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
21197  CALL flagerror(local_error,err,error,*999)
21198  ENDIF
21199  ELSE
21200  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
21201  & " does not correspond to the single precision data type of the given value."
21202  CALL flagerror(local_error,err,error,*999)
21203  ENDIF
21204  ELSE
21205  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
21206  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21207  CALL flagerror(local_error,err,error,*999)
21208  ENDIF
21209  ELSE
21210  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
21211  & " is invalid. The variable type must be between 1 and "// &
21212  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
21213  CALL flagerror(local_error,err,error,*999)
21214  ENDIF
21215  ELSE
21216  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
21217  & " has not been finished."
21218  CALL flagerror(local_error,err,error,*999)
21219  ENDIF
21220  ELSE
21221  CALL flagerror("Field is not associated.",err,error,*999)
21222  ENDIF
21223 
21224  exits("FIELD_PARAMETER_SET_GET_NODE_SP")
21225  RETURN
21226 999 errorsexits("FIELD_PARAMETER_SET_GET_NODE_SP",err,error)
21227  RETURN 1
21228  END SUBROUTINE field_parameter_set_get_node_sp
21229 
21230  !
21231  !================================================================================================================================
21232  !
21233 
21235  SUBROUTINE field_parameter_set_get_node_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
21236  & user_node_number,component_number,VALUE,err,error,*)
21237 
21238  !Argument variables
21239  TYPE(field_type), POINTER :: field
21240  INTEGER(INTG), INTENT(IN) :: variable_type
21241  INTEGER(INTG), INTENT(IN) :: field_set_type
21242  INTEGER(INTG), INTENT(IN) :: version_number
21243  INTEGER(INTG), INTENT(IN) :: derivative_number
21244  INTEGER(INTG), INTENT(IN) :: user_node_number
21245  INTEGER(INTG), INTENT(IN) :: component_number
21246  REAL(DP), INTENT(OUT) :: VALUE
21247  INTEGER(INTG), INTENT(OUT) :: err
21248  TYPE(varying_string), INTENT(OUT) :: error
21249  !Local Variables
21250  INTEGER(INTG) :: domain_local_node_number,dof_idx
21251  LOGICAL :: ghost_node,user_node_exists
21252  TYPE(domain_type), POINTER :: domain
21253  TYPE(domain_nodes_type), POINTER :: domain_nodes
21254  TYPE(domain_topology_type), POINTER :: domain_topology
21255  TYPE(field_parameter_set_type), POINTER :: parameter_set
21256  TYPE(field_variable_type), POINTER :: field_variable
21257  TYPE(varying_string) :: local_error
21258 
21259  enters("FIELD_PARAMETER_SET_GET_NODE_DP",err,error,*999)
21260 
21261  IF(ASSOCIATED(field)) THEN
21262  IF(field%FIELD_FINISHED) THEN
21263  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
21264  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
21265  IF(ASSOCIATED(field_variable)) THEN
21266  IF(field_variable%DATA_TYPE==field_dp_type) THEN
21267  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
21268  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
21269  IF(ASSOCIATED(parameter_set)) THEN
21270  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
21271  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
21272  CASE(field_constant_interpolation)
21273  local_error="Can not get by node for component number "// &
21274  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21275  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21276  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
21277  CALL flagerror(local_error,err,error,*999)
21278  CASE(field_element_based_interpolation)
21279  local_error="Can not get by node for component number "// &
21280  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21281  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21282  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
21283  CALL flagerror(local_error,err,error,*999)
21284  CASE(field_node_based_interpolation)
21285  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
21286  IF(ASSOCIATED(domain)) THEN
21287  domain_topology=>domain%TOPOLOGY
21288  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
21289  & domain_local_node_number,ghost_node,err,error,*999)
21290  IF(user_node_exists) THEN
21291  domain_nodes=>domain_topology%NODES
21292  IF(ASSOCIATED(domain_nodes)) THEN
21293  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
21294  & number_of_derivatives) THEN
21295  IF(version_number>0.AND.version_number<= &
21296  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
21297  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
21298  & number_of_versions) THEN
21299  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
21300  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
21301  & versions(version_number)
21302  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
21303  ELSE
21304  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
21305  & " is invalid for derivative number "// &
21306  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
21307  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
21308  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21309  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21310  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
21311  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
21312  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
21313  & "(note version numbers are indexed directly from the value the user specifies during "// &
21314  & "element creation and no record is kept of the total number of versions the user sets."// &
21315  & "The maximum version number the user sets defines the total number of versions allocated)."
21316  CALL flagerror(local_error,err,error,*999)
21317  ENDIF
21318  ELSE
21319  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
21320  & " is invalid for user node number "// &
21321  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
21322  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21323  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21324  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21325  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
21326  & number_of_derivatives,"*",err,error))//" derivatives."
21327  CALL flagerror(local_error,err,error,*999)
21328  ENDIF
21329  ENDIF
21330  ELSE
21331  local_error="The specified user node number of "// &
21332  & trim(number_to_vstring(user_node_number,"*",err,error))// &
21333  & " does not exist in the domain for field component number "// &
21334  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
21335  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21336  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21337  CALL flagerror(local_error,err,error,*999)
21338  ENDIF
21339  ELSE
21340  CALL flagerror("Domain is not associated.",err,error,*999)
21341  ENDIF
21342  CASE(field_grid_point_based_interpolation)
21343  local_error="Can not get by node for component number "// &
21344  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21345  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21346  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
21347  CALL flagerror(local_error,err,error,*999)
21348  CASE(field_gauss_point_based_interpolation)
21349  local_error="Can not get by node for component number "// &
21350  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21351  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21352  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
21353  CALL flagerror(local_error,err,error,*999)
21354  CASE(field_data_point_based_interpolation)
21355  local_error="Can not add element for component number "// &
21356  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21357  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21358  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
21359  CALL flagerror(local_error,err,error,*999)
21360  CASE DEFAULT
21361  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
21362  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
21363  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
21364  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
21365  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21366  CALL flagerror(local_error,err,error,*999)
21367  END SELECT
21368  ELSE
21369  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
21370  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
21371  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21372  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
21373  & " components."
21374  CALL flagerror(local_error,err,error,*999)
21375  ENDIF
21376  ELSE
21377  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
21378  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21379  CALL flagerror(local_error,err,error,*999)
21380  ENDIF
21381  ELSE
21382  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
21383  & " is invalid. The field parameter set type must be between 1 and "// &
21384  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
21385  CALL flagerror(local_error,err,error,*999)
21386  ENDIF
21387  ELSE
21388  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
21389  & " does not correspond to the double precision data type of the given value."
21390  CALL flagerror(local_error,err,error,*999)
21391  ENDIF
21392  ELSE
21393  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
21394  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21395  CALL flagerror(local_error,err,error,*999)
21396  ENDIF
21397  ELSE
21398  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
21399  & " is invalid. The variable type must be between 1 and "// &
21400  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
21401  CALL flagerror(local_error,err,error,*999)
21402  ENDIF
21403  ELSE
21404  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
21405  & " has not been finished."
21406  CALL flagerror(local_error,err,error,*999)
21407  ENDIF
21408  ELSE
21409  CALL flagerror("Field is not associated.",err,error,*999)
21410  ENDIF
21411 
21412  exits("FIELD_PARAMETER_SET_GET_NODE_DP")
21413  RETURN
21414 999 errorsexits("FIELD_PARAMETER_SET_GET_NODE_DP",err,error)
21415  RETURN 1
21416  END SUBROUTINE field_parameter_set_get_node_dp
21417 
21418  !
21419  !================================================================================================================================
21420  !
21421 
21423  SUBROUTINE field_parameter_set_get_node_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
21424  & user_node_number,component_number,VALUE,err,error,*)
21425 
21426  !Argument variables
21427  TYPE(field_type), POINTER :: field
21428  INTEGER(INTG), INTENT(IN) :: variable_type
21429  INTEGER(INTG), INTENT(IN) :: field_set_type
21430  INTEGER(INTG), INTENT(IN) :: version_number
21431  INTEGER(INTG), INTENT(IN) :: derivative_number
21432  INTEGER(INTG), INTENT(IN) :: user_node_number
21433  INTEGER(INTG), INTENT(IN) :: component_number
21434  LOGICAL, INTENT(OUT) :: VALUE
21435  INTEGER(INTG), INTENT(OUT) :: err
21436  TYPE(varying_string), INTENT(OUT) :: error
21437  !Local Variables
21438  INTEGER(INTG) :: domain_local_node_number,dof_idx
21439  LOGICAL :: ghost_node,user_node_exists
21440  TYPE(domain_type), POINTER :: domain
21441  TYPE(domain_nodes_type), POINTER :: domain_nodes
21442  TYPE(domain_topology_type), POINTER :: domain_topology
21443  TYPE(field_parameter_set_type), POINTER :: parameter_set
21444  TYPE(field_variable_type), POINTER :: field_variable
21445  TYPE(varying_string) :: local_error
21446 
21447  enters("FIELD_PARAMETER_SET_GET_NODE_L",err,error,*999)
21448 
21449  IF(ASSOCIATED(field)) THEN
21450  IF(field%FIELD_FINISHED) THEN
21451  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
21452  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
21453  IF(ASSOCIATED(field_variable)) THEN
21454  IF(field_variable%DATA_TYPE==field_l_type) THEN
21455  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
21456  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
21457  IF(ASSOCIATED(parameter_set)) THEN
21458  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
21459  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
21460  CASE(field_constant_interpolation)
21461  local_error="Can not get by node for component number "// &
21462  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21463  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21464  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
21465  CALL flagerror(local_error,err,error,*999)
21466  CASE(field_element_based_interpolation)
21467  local_error="Can not get by node for component number "// &
21468  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21469  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21470  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
21471  CALL flagerror(local_error,err,error,*999)
21472  CASE(field_node_based_interpolation)
21473  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
21474  IF(ASSOCIATED(domain)) THEN
21475  domain_topology=>domain%TOPOLOGY
21476  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
21477  & domain_local_node_number,ghost_node,err,error,*999)
21478  IF(user_node_exists) THEN
21479  domain_nodes=>domain_topology%NODES
21480  IF(ASSOCIATED(domain_nodes)) THEN
21481  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
21482  & number_of_derivatives) THEN
21483  IF(version_number>0.AND.version_number<= &
21484  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
21485  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
21486  & number_of_versions) THEN
21487  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
21488  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
21489  & versions(version_number)
21490  CALL distributed_vector_values_get(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
21491  ELSE
21492  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
21493  & " is invalid for derivative number "// &
21494  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
21495  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
21496  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21497  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21498  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
21499  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
21500  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
21501  & "(note version numbers are indexed directly from the value the user specifies during "// &
21502  & "element creation and no record is kept of the total number of versions the user sets."// &
21503  & "The maximum version number the user sets defines the total number of versions allocated)."
21504  CALL flagerror(local_error,err,error,*999)
21505  ENDIF
21506  ELSE
21507  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
21508  & " is invalid for user node number "// &
21509  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
21510  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21511  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21512  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21513  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
21514  & number_of_derivatives,"*",err,error))//" derivatives."
21515  CALL flagerror(local_error,err,error,*999)
21516  ENDIF
21517  ELSE
21518  CALL flagerror("Domain topology nodes is not associated.",err,error,*999)
21519  ENDIF
21520  ELSE
21521  local_error="The specified user node number of "// &
21522  & trim(number_to_vstring(user_node_number,"*",err,error))// &
21523  & " does not exist in the domain for field component number "// &
21524  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
21525  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21526  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21527  CALL flagerror(local_error,err,error,*999)
21528  ENDIF
21529  ELSE
21530  CALL flagerror("Domain is not associated.",err,error,*999)
21531  ENDIF
21532  CASE(field_grid_point_based_interpolation)
21533  local_error="Can not get by node for component number "// &
21534  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21535  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21536  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
21537  CALL flagerror(local_error,err,error,*999)
21538  CASE(field_gauss_point_based_interpolation)
21539  local_error="Can not get by node for component number "// &
21540  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21541  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21542  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
21543  CALL flagerror(local_error,err,error,*999)
21544  CASE(field_data_point_based_interpolation)
21545  local_error="Can not add element for component number "// &
21546  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
21547  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
21548  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
21549  CALL flagerror(local_error,err,error,*999)
21550  CASE DEFAULT
21551  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
21552  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
21553  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
21554  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
21555  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21556  CALL flagerror(local_error,err,error,*999)
21557  END SELECT
21558  ELSE
21559  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
21560  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
21561  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21562  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
21563  & " components."
21564  CALL flagerror(local_error,err,error,*999)
21565  ENDIF
21566  ELSE
21567  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
21568  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21569  CALL flagerror(local_error,err,error,*999)
21570  ENDIF
21571  ELSE
21572  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
21573  & " is invalid. The field parameter set type must be between 1 and "// &
21574  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
21575  CALL flagerror(local_error,err,error,*999)
21576  ENDIF
21577  ELSE
21578  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
21579  & " does not correspond to the double precision data type of the given value."
21580  CALL flagerror(local_error,err,error,*999)
21581  ENDIF
21582  ELSE
21583  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
21584  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21585  CALL flagerror(local_error,err,error,*999)
21586  ENDIF
21587  ELSE
21588  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
21589  & " is invalid. The variable type must be between 1 and "// &
21590  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
21591  CALL flagerror(local_error,err,error,*999)
21592  ENDIF
21593  ELSE
21594  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
21595  & " has not been finished."
21596  CALL flagerror(local_error,err,error,*999)
21597  ENDIF
21598  ELSE
21599  CALL flagerror("Field is not associated.",err,error,*999)
21600  ENDIF
21601 
21602  exits("FIELD_PARAMETER_SET_GET_NODE_L")
21603  RETURN
21604 999 errorsexits("FIELD_PARAMETER_SET_GET_NODE_L",err,error)
21605  RETURN 1
21606  END SUBROUTINE field_parameter_set_get_node_l
21607 
21608  !
21609  !================================================================================================================================
21610  !
21611 
21614  SUBROUTINE field_parametersetgetlocalnode_intg(field,variableType,fieldSetType,versionNumber,derivativeNumber,localNodeNumber, &
21615  & componentnumber,VALUE,err,error,*)
21616 
21617  !Argument variables
21618  TYPE(field_type), POINTER :: field
21619  INTEGER(INTG), INTENT(IN) :: variabletype
21620  INTEGER(INTG), INTENT(IN) :: fieldsettype
21621  INTEGER(INTG), INTENT(IN) :: versionnumber
21622  INTEGER(INTG), INTENT(IN) :: derivativenumber
21623  INTEGER(INTG), INTENT(IN) :: localnodenumber
21624  INTEGER(INTG), INTENT(IN) :: componentnumber
21625  INTEGER(INTG), INTENT(OUT) :: value
21626  INTEGER(INTG), INTENT(OUT) :: err
21627  TYPE(varying_string), INTENT(OUT) :: error
21628  !Local Variables
21629  INTEGER(INTG) :: dofidx
21630  TYPE(domain_type), POINTER :: domain
21631  TYPE(domain_nodes_type), POINTER :: domainnodes
21632  TYPE(domain_topology_type), POINTER :: domaintopology
21633  TYPE(field_parameter_set_type), POINTER :: parameterset
21634  TYPE(field_variable_type), POINTER :: fieldvariable
21635  TYPE(varying_string) :: localerror
21636 
21637  enters("Field_ParameterSetGetLocalNode_Intg",err,error,*999)
21638 
21639  IF(ASSOCIATED(field)) THEN
21640  IF(field%FIELD_FINISHED) THEN
21641  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
21642  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
21643  IF(ASSOCIATED(fieldvariable)) THEN
21644  IF(fieldvariable%DATA_TYPE==field_intg_type) THEN
21645  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
21646  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%ptr
21647  IF(ASSOCIATED(parameterset)) THEN
21648  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
21649  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
21650  CASE(field_constant_interpolation)
21651  localerror="Can not get by node for component number "// &
21652  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21653  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21654  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
21655  CALL flagerror(localerror,err,error,*999)
21656  CASE(field_element_based_interpolation)
21657  localerror="Can not get by node for component number "// &
21658  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21659  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21660  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
21661  CALL flagerror(localerror,err,error,*999)
21662  CASE(field_node_based_interpolation)
21663  domain=>fieldvariable%components(componentnumber)%domain
21664  IF(ASSOCIATED(domain)) THEN
21665  domaintopology=>domain%topology
21666  IF(ASSOCIATED(domaintopology)) THEN
21667  domainnodes=>domaintopology%nodes
21668  IF(ASSOCIATED(domainnodes)) THEN
21669  IF(localnodenumber>0.AND.localnodenumber<=domainnodes%TOTAL_NUMBER_OF_NODES) THEN
21670  IF(derivativenumber>0.AND.derivativenumber<=domainnodes%nodes(localnodenumber)% &
21671  & number_of_derivatives) THEN
21672  IF(versionnumber>0.AND.versionnumber<=domainnodes%nodes(localnodenumber)%derivatives( &
21673  & derivativenumber)%numberOfVersions) THEN
21674  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
21675  & node_param2dof_map%NODES(localnodenumber)%derivatives(derivativenumber)% &
21676  & versions(versionnumber)
21677  CALL distributed_vector_values_get(parameterset%parameters,dofidx,value,err,error,*999)
21678  ELSE
21679  localerror="Version number "//trim(number_to_vstring(versionnumber,"*",err,error))// &
21680  & " is invalid for derivative number "// &
21681  & trim(number_to_vstring(derivativenumber,"*",err,error))//" of local node number "// &
21682  & trim(number_to_vstring(localnodenumber,"*",err,error))//" of component number "// &
21683  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21684  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21685  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
21686  & trim(number_to_vstring(domainnodes%nodes(localnodenumber)%derivatives( &
21687  & derivativenumber)%numberOfVersions,"*",err,error))//" versions "// &
21688  & "(note version numbers are indexed directly from the value the user specifies during "// &
21689  & "element creation and no record is kept of the total number of versions the user sets."// &
21690  & "The maximum version number the user sets defines the total number of versions allocated)."
21691  CALL flagerror(localerror,err,error,*999)
21692  ENDIF
21693  ELSE
21694  localerror="Derivative number "//trim(number_to_vstring(derivativenumber,"*",err,error))// &
21695  & " is invalid for local node number "// &
21696  & trim(number_to_vstring(localnodenumber,"*",err,error))//" of component number "// &
21697  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21698  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21699  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21700  & trim(number_to_vstring(domainnodes%nodes(localnodenumber)% &
21701  & number_of_derivatives,"*",err,error))//" derivatives."
21702  CALL flagerror(localerror,err,error,*999)
21703  ENDIF
21704  ELSE
21705  localerror="The specified local node number of "// &
21706  & trim(number_to_vstring(localnodenumber,"*",err,error))// &
21707  & " does not exist in the domain for field component number "// &
21708  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
21709  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21710  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21711  & trim(number_to_vstring(domainnodes%TOTAL_NUMBER_OF_NODES,"*",err,error))//" local nodes."
21712  CALL flagerror(localerror,err,error,*999)
21713  ENDIF
21714  ELSE
21715  CALL flagerror("Domain topology nodes is not associated.",err,error,*999)
21716  ENDIF
21717  ELSE
21718  CALL flagerror("Domain topology is not associated.",err,error,*999)
21719  ENDIF
21720  ELSE
21721  CALL flagerror("Domain is not associated.",err,error,*999)
21722  ENDIF
21723  CASE(field_grid_point_based_interpolation)
21724  localerror="Can not get by node for component number "// &
21725  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21726  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21727  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
21728  CALL flagerror(localerror,err,error,*999)
21729  CASE(field_gauss_point_based_interpolation)
21730  localerror="Can not get by node for component number "// &
21731  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21732  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21733  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
21734  CALL flagerror(localerror,err,error,*999)
21735  CASE(field_data_point_based_interpolation)
21736  localerror="Can not add element for component number "// &
21737  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21738  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21739  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
21740  CALL flagerror(localerror,err,error,*999)
21741  CASE DEFAULT
21742  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
21743  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
21744  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
21745  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
21746  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21747  CALL flagerror(localerror,err,error,*999)
21748  END SELECT
21749  ELSE
21750  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
21751  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
21752  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21753  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
21754  & " components."
21755  CALL flagerror(localerror,err,error,*999)
21756  ENDIF
21757  ELSE
21758  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
21759  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21760  CALL flagerror(localerror,err,error,*999)
21761  ENDIF
21762  ELSE
21763  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
21764  & " is invalid. The field parameter set type must be between 1 and "// &
21765  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
21766  CALL flagerror(localerror,err,error,*999)
21767  ENDIF
21768  ELSE
21769  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
21770  & " does not correspond to the integer data type of the given value."
21771  CALL flagerror(localerror,err,error,*999)
21772  ENDIF
21773  ELSE
21774  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
21775  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21776  CALL flagerror(localerror,err,error,*999)
21777  ENDIF
21778  ELSE
21779  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
21780  & " is invalid. The variable type must be between 1 and "// &
21781  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
21782  CALL flagerror(localerror,err,error,*999)
21783  ENDIF
21784  ELSE
21785  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
21786  & " has not been finished."
21787  CALL flagerror(localerror,err,error,*999)
21788  ENDIF
21789  ELSE
21790  CALL flagerror("Field is not associated.",err,error,*999)
21791  ENDIF
21792 
21793  exits("Field_ParameterSetGetLocalNode_Intg")
21794  RETURN
21795 999 errorsexits("Field_ParameterSetGetLocalNode_Intg",err,error)
21796  RETURN 1
21797  END SUBROUTINE field_parametersetgetlocalnode_intg
21798  !
21799  !================================================================================================================================
21800  !
21801 
21804  SUBROUTINE field_parametersetgetlocalnode_sp(field,variableType,fieldSetType,versionNumber,derivativeNumber,localNodeNumber, &
21805  & componentnumber,VALUE,err,error,*)
21806 
21807  !Argument variables
21808  TYPE(field_type), POINTER :: field
21809  INTEGER(INTG), INTENT(IN) :: variabletype
21810  INTEGER(INTG), INTENT(IN) :: fieldsettype
21811  INTEGER(INTG), INTENT(IN) :: versionnumber
21812  INTEGER(INTG), INTENT(IN) :: derivativenumber
21813  INTEGER(INTG), INTENT(IN) :: localnodenumber
21814  INTEGER(INTG), INTENT(IN) :: componentnumber
21815  REAL(SP), INTENT(OUT) :: value
21816  INTEGER(INTG), INTENT(OUT) :: err
21817  TYPE(varying_string), INTENT(OUT) :: error
21818  !Local Variables
21819  INTEGER(INTG) :: dofidx
21820  TYPE(domain_type), POINTER :: domain
21821  TYPE(domain_nodes_type), POINTER :: domainnodes
21822  TYPE(domain_topology_type), POINTER :: domaintopology
21823  TYPE(field_parameter_set_type), POINTER :: parameterset
21824  TYPE(field_variable_type), POINTER :: fieldvariable
21825  TYPE(varying_string) :: localerror
21826 
21827  enters("Field_ParameterSetGetLocalNode_Sp",err,error,*999)
21828 
21829  IF(ASSOCIATED(field)) THEN
21830  IF(field%FIELD_FINISHED) THEN
21831  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
21832  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
21833  IF(ASSOCIATED(fieldvariable)) THEN
21834  IF(fieldvariable%DATA_TYPE==field_sp_type) THEN
21835  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
21836  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%ptr
21837  IF(ASSOCIATED(parameterset)) THEN
21838  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
21839  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
21840  CASE(field_constant_interpolation)
21841  localerror="Can not get by node for component number "// &
21842  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21843  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21844  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
21845  CALL flagerror(localerror,err,error,*999)
21846  CASE(field_element_based_interpolation)
21847  localerror="Can not get by node for component number "// &
21848  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21849  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21850  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
21851  CALL flagerror(localerror,err,error,*999)
21852  CASE(field_node_based_interpolation)
21853  domain=>fieldvariable%components(componentnumber)%domain
21854  IF(ASSOCIATED(domain)) THEN
21855  domaintopology=>domain%topology
21856  IF(ASSOCIATED(domaintopology)) THEN
21857  domainnodes=>domaintopology%nodes
21858  IF(ASSOCIATED(domainnodes)) THEN
21859  IF(localnodenumber>0.AND.localnodenumber<=domainnodes%TOTAL_NUMBER_OF_NODES) THEN
21860  IF(derivativenumber>0.AND.derivativenumber<=domainnodes%nodes(localnodenumber)% &
21861  & number_of_derivatives) THEN
21862  IF(versionnumber>0.AND.versionnumber<=domainnodes%nodes(localnodenumber)%derivatives( &
21863  & derivativenumber)%numberOfVersions) THEN
21864  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
21865  & node_param2dof_map%NODES(localnodenumber)%derivatives(derivativenumber)% &
21866  & versions(versionnumber)
21867  CALL distributed_vector_values_get(parameterset%parameters,dofidx,value,err,error,*999)
21868  ELSE
21869  localerror="Version number "//trim(number_to_vstring(versionnumber,"*",err,error))// &
21870  & " is invalid for derivative number "// &
21871  & trim(number_to_vstring(derivativenumber,"*",err,error))//" of local node number "// &
21872  & trim(number_to_vstring(localnodenumber,"*",err,error))//" of component number "// &
21873  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21874  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21875  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
21876  & trim(number_to_vstring(domainnodes%nodes(localnodenumber)%derivatives( &
21877  & derivativenumber)%numberOfVersions,"*",err,error))//" versions "// &
21878  & "(note version numbers are indexed directly from the value the user specifies during "// &
21879  & "element creation and no record is kept of the total number of versions the user sets."// &
21880  & "The maximum version number the user sets defines the total number of versions allocated)."
21881  CALL flagerror(localerror,err,error,*999)
21882  ENDIF
21883  ELSE
21884  localerror="Derivative number "//trim(number_to_vstring(derivativenumber,"*",err,error))// &
21885  & " is invalid for local node number "// &
21886  & trim(number_to_vstring(localnodenumber,"*",err,error))//" of component number "// &
21887  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21888  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21889  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21890  & trim(number_to_vstring(domainnodes%nodes(localnodenumber)% &
21891  & number_of_derivatives,"*",err,error))//" derivatives."
21892  CALL flagerror(localerror,err,error,*999)
21893  ENDIF
21894  ELSE
21895  localerror="The specified local node number of "// &
21896  & trim(number_to_vstring(localnodenumber,"*",err,error))// &
21897  & " does not exist in the domain for field component number "// &
21898  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
21899  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21900  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21901  & trim(number_to_vstring(domainnodes%TOTAL_NUMBER_OF_NODES,"*",err,error))//" local nodes."
21902  CALL flagerror(localerror,err,error,*999)
21903  ENDIF
21904  ELSE
21905  CALL flagerror("Domain topology nodes is not associated.",err,error,*999)
21906  ENDIF
21907  ELSE
21908  CALL flagerror("Domain topology is not associated.",err,error,*999)
21909  ENDIF
21910  ELSE
21911  CALL flagerror("Domain is not associated.",err,error,*999)
21912  ENDIF
21913  CASE(field_grid_point_based_interpolation)
21914  localerror="Can not get by node for component number "// &
21915  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21916  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21917  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
21918  CALL flagerror(localerror,err,error,*999)
21919  CASE(field_gauss_point_based_interpolation)
21920  localerror="Can not get by node for component number "// &
21921  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21922  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21923  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
21924  CALL flagerror(localerror,err,error,*999)
21925  CASE(field_data_point_based_interpolation)
21926  localerror="Can not add element for component number "// &
21927  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
21928  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
21929  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
21930  CALL flagerror(localerror,err,error,*999)
21931  CASE DEFAULT
21932  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
21933  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
21934  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
21935  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
21936  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21937  CALL flagerror(localerror,err,error,*999)
21938  END SELECT
21939  ELSE
21940  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
21941  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
21942  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
21943  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
21944  & " components."
21945  CALL flagerror(localerror,err,error,*999)
21946  ENDIF
21947  ELSE
21948  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
21949  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21950  CALL flagerror(localerror,err,error,*999)
21951  ENDIF
21952  ELSE
21953  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
21954  & " is invalid. The field parameter set type must be between 1 and "// &
21955  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
21956  CALL flagerror(localerror,err,error,*999)
21957  ENDIF
21958  ELSE
21959  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
21960  & " does not correspond to the single precision data type of the given value."
21961  CALL flagerror(localerror,err,error,*999)
21962  ENDIF
21963  ELSE
21964  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
21965  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
21966  CALL flagerror(localerror,err,error,*999)
21967  ENDIF
21968  ELSE
21969  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
21970  & " is invalid. The variable type must be between 1 and "// &
21971  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
21972  CALL flagerror(localerror,err,error,*999)
21973  ENDIF
21974  ELSE
21975  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
21976  & " has not been finished."
21977  CALL flagerror(localerror,err,error,*999)
21978  ENDIF
21979  ELSE
21980  CALL flagerror("Field is not associated.",err,error,*999)
21981  ENDIF
21982 
21983  exits("Field_ParameterSetGetLocalNode_Sp")
21984  RETURN
21985 999 errorsexits("Field_ParameterSetGetLocalNode_Sp",err,error)
21986  RETURN 1
21987  END SUBROUTINE field_parametersetgetlocalnode_sp
21988  !
21989  !================================================================================================================================
21990  !
21991 
21994  SUBROUTINE field_parametersetgetlocalnode_dp(field,variableType,fieldSetType,versionNumber,derivativeNumber,localNodeNumber, &
21995  & componentnumber,VALUE,err,error,*)
21996 
21997  !Argument variables
21998  TYPE(field_type), POINTER :: field
21999  INTEGER(INTG), INTENT(IN) :: variabletype
22000  INTEGER(INTG), INTENT(IN) :: fieldsettype
22001  INTEGER(INTG), INTENT(IN) :: versionnumber
22002  INTEGER(INTG), INTENT(IN) :: derivativenumber
22003  INTEGER(INTG), INTENT(IN) :: localnodenumber
22004  INTEGER(INTG), INTENT(IN) :: componentnumber
22005  REAL(DP), INTENT(OUT) :: value
22006  INTEGER(INTG), INTENT(OUT) :: err
22007  TYPE(varying_string), INTENT(OUT) :: error
22008  !Local Variables
22009  INTEGER(INTG) :: dofidx
22010  TYPE(domain_type), POINTER :: domain
22011  TYPE(domain_nodes_type), POINTER :: domainnodes
22012  TYPE(domain_topology_type), POINTER :: domaintopology
22013  TYPE(field_parameter_set_type), POINTER :: parameterset
22014  TYPE(field_variable_type), POINTER :: fieldvariable
22015  TYPE(varying_string) :: localerror
22016 
22017  enters("Field_ParameterSetGetLocalNode_Dp",err,error,*999)
22018 
22019  IF(ASSOCIATED(field)) THEN
22020  IF(field%FIELD_FINISHED) THEN
22021  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
22022  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
22023  IF(ASSOCIATED(fieldvariable)) THEN
22024  IF(fieldvariable%DATA_TYPE==field_dp_type) THEN
22025  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
22026  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%ptr
22027  IF(ASSOCIATED(parameterset)) THEN
22028  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
22029  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
22030  CASE(field_constant_interpolation)
22031  localerror="Can not get by node for component number "// &
22032  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22033  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22034  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
22035  CALL flagerror(localerror,err,error,*999)
22036  CASE(field_element_based_interpolation)
22037  localerror="Can not get by node for component number "// &
22038  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22039  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22040  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
22041  CALL flagerror(localerror,err,error,*999)
22042  CASE(field_node_based_interpolation)
22043  domain=>fieldvariable%components(componentnumber)%domain
22044  IF(ASSOCIATED(domain)) THEN
22045  domaintopology=>domain%topology
22046  IF(ASSOCIATED(domaintopology)) THEN
22047  domainnodes=>domaintopology%nodes
22048  IF(ASSOCIATED(domainnodes)) THEN
22049  IF(localnodenumber>0.AND.localnodenumber<=domainnodes%TOTAL_NUMBER_OF_NODES) THEN
22050  IF(derivativenumber>0.AND.derivativenumber<=domainnodes%nodes(localnodenumber)% &
22051  & number_of_derivatives) THEN
22052  IF(versionnumber>0.AND.versionnumber<=domainnodes%nodes(localnodenumber)%derivatives( &
22053  & derivativenumber)%numberOfVersions) THEN
22054  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
22055  & node_param2dof_map%NODES(localnodenumber)%derivatives(derivativenumber)% &
22056  & versions(versionnumber)
22057  CALL distributed_vector_values_get(parameterset%parameters,dofidx,value,err,error,*999)
22058  ELSE
22059  localerror="Version number "//trim(number_to_vstring(versionnumber,"*",err,error))// &
22060  & " is invalid for derivative number "// &
22061  & trim(number_to_vstring(derivativenumber,"*",err,error))//" of local node number "// &
22062  & trim(number_to_vstring(localnodenumber,"*",err,error))//" of component number "// &
22063  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22064  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22065  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
22066  & trim(number_to_vstring(domainnodes%nodes(localnodenumber)%derivatives( &
22067  & derivativenumber)%numberOfVersions,"*",err,error))//" versions "// &
22068  & "(note version numbers are indexed directly from the value the user specifies during "// &
22069  & "element creation and no record is kept of the total number of versions the user sets."// &
22070  & "The maximum version number the user sets defines the total number of versions allocated)."
22071  CALL flagerror(localerror,err,error,*999)
22072  ENDIF
22073  ELSE
22074  localerror="Derivative number "//trim(number_to_vstring(derivativenumber,"*",err,error))// &
22075  & " is invalid for local node number "// &
22076  & trim(number_to_vstring(localnodenumber,"*",err,error))//" of component number "// &
22077  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22078  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22079  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22080  & trim(number_to_vstring(domainnodes%nodes(localnodenumber)% &
22081  & number_of_derivatives,"*",err,error))//" derivatives."
22082  CALL flagerror(localerror,err,error,*999)
22083  ENDIF
22084  ELSE
22085  localerror="The specified local node number of "// &
22086  & trim(number_to_vstring(localnodenumber,"*",err,error))// &
22087  & " does not exist in the domain for field component number "// &
22088  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
22089  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22090  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22091  & trim(number_to_vstring(domainnodes%TOTAL_NUMBER_OF_NODES,"*",err,error))//" local nodes."
22092  CALL flagerror(localerror,err,error,*999)
22093  ENDIF
22094  ELSE
22095  CALL flagerror("Domain topology nodes is not associated.",err,error,*999)
22096  ENDIF
22097  ELSE
22098  CALL flagerror("Domain topology is not associated.",err,error,*999)
22099  ENDIF
22100  ELSE
22101  CALL flagerror("Domain is not associated.",err,error,*999)
22102  ENDIF
22103  CASE(field_grid_point_based_interpolation)
22104  localerror="Can not get by node for component number "// &
22105  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22106  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22107  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
22108  CALL flagerror(localerror,err,error,*999)
22109  CASE(field_gauss_point_based_interpolation)
22110  localerror="Can not get by node for component number "// &
22111  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22112  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22113  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
22114  CALL flagerror(localerror,err,error,*999)
22115  CASE(field_data_point_based_interpolation)
22116  localerror="Can not add element for component number "// &
22117  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22118  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22119  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
22120  CALL flagerror(localerror,err,error,*999)
22121  CASE DEFAULT
22122  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
22123  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
22124  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22125  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22126  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22127  CALL flagerror(localerror,err,error,*999)
22128  END SELECT
22129  ELSE
22130  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22131  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22132  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22133  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
22134  & " components."
22135  CALL flagerror(localerror,err,error,*999)
22136  ENDIF
22137  ELSE
22138  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22139  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22140  CALL flagerror(localerror,err,error,*999)
22141  ENDIF
22142  ELSE
22143  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22144  & " is invalid. The field parameter set type must be between 1 and "// &
22145  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
22146  CALL flagerror(localerror,err,error,*999)
22147  ENDIF
22148  ELSE
22149  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
22150  & " does not correspond to the double precision data type of the given value."
22151  CALL flagerror(localerror,err,error,*999)
22152  ENDIF
22153  ELSE
22154  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22155  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22156  CALL flagerror(localerror,err,error,*999)
22157  ENDIF
22158  ELSE
22159  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22160  & " is invalid. The variable type must be between 1 and "// &
22161  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
22162  CALL flagerror(localerror,err,error,*999)
22163  ENDIF
22164  ELSE
22165  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
22166  & " has not been finished."
22167  CALL flagerror(localerror,err,error,*999)
22168  ENDIF
22169  ELSE
22170  CALL flagerror("Field is not associated.",err,error,*999)
22171  ENDIF
22172 
22173  exits("Field_ParameterSetGetLocalNode_Dp")
22174  RETURN
22175 999 errorsexits("Field_ParameterSetGetLocalNode_Dp",err,error)
22176  RETURN 1
22177  END SUBROUTINE field_parametersetgetlocalnode_dp
22178  !
22179  !================================================================================================================================
22180  !
22181 
22184  SUBROUTINE field_parametersetgetlocalnode_l(field,variableType,fieldSetType,versionNumber,derivativeNumber,localNodeNumber, &
22185  & componentnumber,VALUE,err,error,*)
22186 
22187  !Argument variables
22188  TYPE(field_type), POINTER :: field
22189  INTEGER(INTG), INTENT(IN) :: variabletype
22190  INTEGER(INTG), INTENT(IN) :: fieldsettype
22191  INTEGER(INTG), INTENT(IN) :: versionnumber
22192  INTEGER(INTG), INTENT(IN) :: derivativenumber
22193  INTEGER(INTG), INTENT(IN) :: localnodenumber
22194  INTEGER(INTG), INTENT(IN) :: componentnumber
22195  LOGICAL, INTENT(OUT) :: value
22196  INTEGER(INTG), INTENT(OUT) :: err
22197  TYPE(varying_string), INTENT(OUT) :: error
22198  !Local Variables
22199  INTEGER(INTG) :: dofidx
22200  TYPE(domain_type), POINTER :: domain
22201  TYPE(domain_nodes_type), POINTER :: domainnodes
22202  TYPE(domain_topology_type), POINTER :: domaintopology
22203  TYPE(field_parameter_set_type), POINTER :: parameterset
22204  TYPE(field_variable_type), POINTER :: fieldvariable
22205  TYPE(varying_string) :: localerror
22206 
22207  enters("Field_ParameterSetGetLocalNode_L",err,error,*999)
22208 
22209  IF(ASSOCIATED(field)) THEN
22210  IF(field%FIELD_FINISHED) THEN
22211  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
22212  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
22213  IF(ASSOCIATED(fieldvariable)) THEN
22214  IF(fieldvariable%DATA_TYPE==field_l_type) THEN
22215  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
22216  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%ptr
22217  IF(ASSOCIATED(parameterset)) THEN
22218  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
22219  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
22220  CASE(field_constant_interpolation)
22221  localerror="Can not get by node for component number "// &
22222  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22223  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22224  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
22225  CALL flagerror(localerror,err,error,*999)
22226  CASE(field_element_based_interpolation)
22227  localerror="Can not get by node for component number "// &
22228  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22229  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22230  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
22231  CALL flagerror(localerror,err,error,*999)
22232  CASE(field_node_based_interpolation)
22233  domain=>fieldvariable%components(componentnumber)%domain
22234  IF(ASSOCIATED(domain)) THEN
22235  domaintopology=>domain%topology
22236  IF(ASSOCIATED(domaintopology)) THEN
22237  domainnodes=>domaintopology%nodes
22238  IF(ASSOCIATED(domainnodes)) THEN
22239  IF(localnodenumber>0.AND.localnodenumber<=domainnodes%TOTAL_NUMBER_OF_NODES) THEN
22240  IF(derivativenumber>0.AND.derivativenumber<=domainnodes%nodes(localnodenumber)% &
22241  & number_of_derivatives) THEN
22242  IF(versionnumber>0.AND.versionnumber<=domainnodes%nodes(localnodenumber)%derivatives( &
22243  & derivativenumber)%numberOfVersions) THEN
22244  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
22245  & node_param2dof_map%NODES(localnodenumber)%derivatives(derivativenumber)% &
22246  & versions(versionnumber)
22247  CALL distributed_vector_values_get(parameterset%parameters,dofidx,value,err,error,*999)
22248  ELSE
22249  localerror="Version number "//trim(number_to_vstring(versionnumber,"*",err,error))// &
22250  & " is invalid for derivative number "// &
22251  & trim(number_to_vstring(derivativenumber,"*",err,error))//" of local node number "// &
22252  & trim(number_to_vstring(localnodenumber,"*",err,error))//" of component number "// &
22253  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22254  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22255  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
22256  & trim(number_to_vstring(domainnodes%nodes(localnodenumber)%derivatives( &
22257  & derivativenumber)%numberOfVersions,"*",err,error))//" versions "// &
22258  & "(note version numbers are indexed directly from the value the user specifies during "// &
22259  & "element creation and no record is kept of the total number of versions the user sets."// &
22260  & "The maximum version number the user sets defines the total number of versions allocated)."
22261  CALL flagerror(localerror,err,error,*999)
22262  ENDIF
22263  ELSE
22264  localerror="Derivative number "//trim(number_to_vstring(derivativenumber,"*",err,error))// &
22265  & " is invalid for local node number "// &
22266  & trim(number_to_vstring(localnodenumber,"*",err,error))//" of component number "// &
22267  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22268  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22269  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22270  & trim(number_to_vstring(domainnodes%nodes(localnodenumber)% &
22271  & number_of_derivatives,"*",err,error))//" derivatives."
22272  CALL flagerror(localerror,err,error,*999)
22273  ENDIF
22274  ELSE
22275  localerror="The specified local node number of "// &
22276  & trim(number_to_vstring(localnodenumber,"*",err,error))// &
22277  & " does not exist in the domain for field component number "// &
22278  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
22279  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22280  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22281  & trim(number_to_vstring(domainnodes%TOTAL_NUMBER_OF_NODES,"*",err,error))//" local nodes."
22282  CALL flagerror(localerror,err,error,*999)
22283  ENDIF
22284  ELSE
22285  CALL flagerror("Domain topology nodes is not associated.",err,error,*999)
22286  ENDIF
22287  ELSE
22288  CALL flagerror("Domain topology is not associated.",err,error,*999)
22289  ENDIF
22290  ELSE
22291  CALL flagerror("Domain is not associated.",err,error,*999)
22292  ENDIF
22293  CASE(field_grid_point_based_interpolation)
22294  localerror="Can not get by node for component number "// &
22295  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22296  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22297  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
22298  CALL flagerror(localerror,err,error,*999)
22299  CASE(field_gauss_point_based_interpolation)
22300  localerror="Can not get by node for component number "// &
22301  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22302  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22303  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
22304  CALL flagerror(localerror,err,error,*999)
22305  CASE(field_data_point_based_interpolation)
22306  localerror="Can not add element for component number "// &
22307  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22308  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22309  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
22310  CALL flagerror(localerror,err,error,*999)
22311  CASE DEFAULT
22312  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
22313  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
22314  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22315  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22316  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22317  CALL flagerror(localerror,err,error,*999)
22318  END SELECT
22319  ELSE
22320  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22321  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22322  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22323  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
22324  & " components."
22325  CALL flagerror(localerror,err,error,*999)
22326  ENDIF
22327  ELSE
22328  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22329  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22330  CALL flagerror(localerror,err,error,*999)
22331  ENDIF
22332  ELSE
22333  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22334  & " is invalid. The field parameter set type must be between 1 and "// &
22335  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
22336  CALL flagerror(localerror,err,error,*999)
22337  ENDIF
22338  ELSE
22339  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
22340  & " does not correspond to the logical data type of the given value."
22341  CALL flagerror(localerror,err,error,*999)
22342  ENDIF
22343  ELSE
22344  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22345  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22346  CALL flagerror(localerror,err,error,*999)
22347  ENDIF
22348  ELSE
22349  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22350  & " is invalid. The variable type must be between 1 and "// &
22351  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
22352  CALL flagerror(localerror,err,error,*999)
22353  ENDIF
22354  ELSE
22355  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
22356  & " has not been finished."
22357  CALL flagerror(localerror,err,error,*999)
22358  ENDIF
22359  ELSE
22360  CALL flagerror("Field is not associated.",err,error,*999)
22361  ENDIF
22362 
22363  exits("Field_ParameterSetGetLocalNode_L")
22364  RETURN
22365 999 errorsexits("Field_ParameterSetGetLocalNode_L",err,error)
22366  RETURN 1
22367  END SUBROUTINE field_parametersetgetlocalnode_l
22368 
22369  !
22370  !================================================================================================================================
22371  !
22372 
22375  SUBROUTINE field_parametersetgetlocalelement_intg(field,variableType,fieldSetType,localElementNumber, &
22376  & componentnumber,VALUE,err,error,*)
22377 
22378  !Argument variables
22379  TYPE(field_type), POINTER :: field
22380  INTEGER(INTG), INTENT(IN) :: variabletype
22381  INTEGER(INTG), INTENT(IN) :: fieldsettype
22382  INTEGER(INTG), INTENT(IN) :: localelementnumber
22383  INTEGER(INTG), INTENT(IN) :: componentnumber
22384  INTEGER(INTG), INTENT(OUT) :: value
22385  INTEGER(INTG), INTENT(OUT) :: err
22386  TYPE(varying_string), INTENT(OUT) :: error
22387  !Local Variables
22388  INTEGER(INTG) :: dofidx
22389  TYPE(domain_type), POINTER :: domain
22390  TYPE(domain_elements_type), POINTER :: domainelements
22391  TYPE(domain_topology_type), POINTER :: domaintopology
22392  TYPE(field_parameter_set_type), POINTER :: parameterset
22393  TYPE(field_variable_type), POINTER :: fieldvariable
22394  TYPE(varying_string) :: localerror
22395 
22396  enters("Field_ParameterSetGetLocalElement_Intg",err,error,*999)
22397 
22398  IF(ASSOCIATED(field)) THEN
22399  IF(field%FIELD_FINISHED) THEN
22400  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
22401  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
22402  IF(ASSOCIATED(fieldvariable)) THEN
22403  IF(fieldvariable%DATA_TYPE==field_intg_type) THEN
22404  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
22405  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%ptr
22406  IF(ASSOCIATED(parameterset)) THEN
22407  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
22408  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
22409  CASE(field_constant_interpolation)
22410  localerror="Can not get by element for component number "// &
22411  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22412  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22413  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
22414  CALL flagerror(localerror,err,error,*999)
22415  CASE(field_element_based_interpolation)
22416  domain=>fieldvariable%components(componentnumber)%domain
22417  IF(ASSOCIATED(domain)) THEN
22418  domaintopology=>domain%topology
22419  IF(ASSOCIATED(domaintopology)) THEN
22420  domainelements=>domaintopology%elements
22421  IF(ASSOCIATED(domainelements)) THEN
22422  IF(localelementnumber>0.AND.localelementnumber<=domainelements%TOTAL_NUMBER_OF_ELEMENTS) THEN
22423  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
22424  & element_param2dof_map%ELEMENTS(localelementnumber)
22425  CALL distributed_vector_values_get(parameterset%parameters,dofidx,value,err,error,*999)
22426  ELSE
22427  localerror="The specified local element number of "// &
22428  & trim(number_to_vstring(localelementnumber,"*",err,error))// &
22429  & " does not exist in the domain for field component number "// &
22430  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
22431  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22432  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22433  & trim(number_to_vstring(domainelements%TOTAL_NUMBER_OF_ELEMENTS,"*",err,error))//" local elements."
22434  CALL flagerror(localerror,err,error,*999)
22435  ENDIF
22436  ELSE
22437  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
22438  ENDIF
22439  ELSE
22440  CALL flagerror("Domain topology is not associated.",err,error,*999)
22441  ENDIF
22442  ELSE
22443  CALL flagerror("Domain is not associated.",err,error,*999)
22444  ENDIF
22445  CASE(field_node_based_interpolation)
22446  localerror="Can not get by element for component number "// &
22447  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22448  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22449  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
22450  CALL flagerror(localerror,err,error,*999)
22451  CASE(field_grid_point_based_interpolation)
22452  localerror="Can not get by element for component number "// &
22453  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22454  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22455  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
22456  CALL flagerror(localerror,err,error,*999)
22457  CASE(field_gauss_point_based_interpolation)
22458  localerror="Can not get by element for component number "// &
22459  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22460  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22461  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
22462  CALL flagerror(localerror,err,error,*999)
22463  CASE(field_data_point_based_interpolation)
22464  localerror="Can not add element for component number "// &
22465  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22466  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22467  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
22468  CALL flagerror(localerror,err,error,*999)
22469  CASE DEFAULT
22470  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
22471  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
22472  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22473  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22474  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22475  CALL flagerror(localerror,err,error,*999)
22476  END SELECT
22477  ELSE
22478  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22479  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22480  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22481  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
22482  & " components."
22483  CALL flagerror(localerror,err,error,*999)
22484  ENDIF
22485  ELSE
22486  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22487  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22488  CALL flagerror(localerror,err,error,*999)
22489  ENDIF
22490  ELSE
22491  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22492  & " is invalid. The field parameter set type must be between 1 and "// &
22493  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
22494  CALL flagerror(localerror,err,error,*999)
22495  ENDIF
22496  ELSE
22497  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
22498  & " does not correspond to the integer data type of the given value."
22499  CALL flagerror(localerror,err,error,*999)
22500  ENDIF
22501  ELSE
22502  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22503  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22504  CALL flagerror(localerror,err,error,*999)
22505  ENDIF
22506  ELSE
22507  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22508  & " is invalid. The variable type must be between 1 and "// &
22509  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
22510  CALL flagerror(localerror,err,error,*999)
22511  ENDIF
22512  ELSE
22513  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
22514  & " has not been finished."
22515  CALL flagerror(localerror,err,error,*999)
22516  ENDIF
22517  ELSE
22518  CALL flagerror("Field is not associated.",err,error,*999)
22519  ENDIF
22520 
22521  exits("Field_ParameterSetGetLocalElement_Intg")
22522  RETURN
22523 999 errorsexits("Field_ParameterSetGetLocalElement_Intg",err,error)
22524  RETURN 1
22525  END SUBROUTINE field_parametersetgetlocalelement_intg
22526 
22527  !
22528  !================================================================================================================================
22529  !
22530 
22533  SUBROUTINE field_parametersetgetlocalelement_sp(field,variableType,fieldSetType,localElementNumber, &
22534  & componentnumber,VALUE,err,error,*)
22535 
22536  !Argument variables
22537  TYPE(field_type), POINTER :: field
22538  INTEGER(INTG), INTENT(IN) :: variabletype
22539  INTEGER(INTG), INTENT(IN) :: fieldsettype
22540  INTEGER(INTG), INTENT(IN) :: localelementnumber
22541  INTEGER(INTG), INTENT(IN) :: componentnumber
22542  REAL(SP), INTENT(OUT) :: value
22543  INTEGER(INTG), INTENT(OUT) :: err
22544  TYPE(varying_string), INTENT(OUT) :: error
22545  !Local Variables
22546  INTEGER(INTG) :: dofidx
22547  TYPE(domain_type), POINTER :: domain
22548  TYPE(domain_elements_type), POINTER :: domainelements
22549  TYPE(domain_topology_type), POINTER :: domaintopology
22550  TYPE(field_parameter_set_type), POINTER :: parameterset
22551  TYPE(field_variable_type), POINTER :: fieldvariable
22552  TYPE(varying_string) :: localerror
22553 
22554  enters("Field_ParameterSetGetLocalElement_Sp",err,error,*999)
22555 
22556  IF(ASSOCIATED(field)) THEN
22557  IF(field%FIELD_FINISHED) THEN
22558  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
22559  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
22560  IF(ASSOCIATED(fieldvariable)) THEN
22561  IF(fieldvariable%DATA_TYPE==field_sp_type) THEN
22562  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
22563  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%ptr
22564  IF(ASSOCIATED(parameterset)) THEN
22565  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
22566  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
22567  CASE(field_constant_interpolation)
22568  localerror="Can not get by element for component number "// &
22569  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22570  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22571  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
22572  CALL flagerror(localerror,err,error,*999)
22573  CASE(field_element_based_interpolation)
22574  domain=>fieldvariable%components(componentnumber)%domain
22575  IF(ASSOCIATED(domain)) THEN
22576  domaintopology=>domain%topology
22577  IF(ASSOCIATED(domaintopology)) THEN
22578  domainelements=>domaintopology%elements
22579  IF(ASSOCIATED(domainelements)) THEN
22580  IF(localelementnumber>0.AND.localelementnumber<=domainelements%TOTAL_NUMBER_OF_ELEMENTS) THEN
22581  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
22582  & element_param2dof_map%ELEMENTS(localelementnumber)
22583  CALL distributed_vector_values_get(parameterset%parameters,dofidx,value,err,error,*999)
22584  ELSE
22585  localerror="The specified local element number of "// &
22586  & trim(number_to_vstring(localelementnumber,"*",err,error))// &
22587  & " does not exist in the domain for field component number "// &
22588  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
22589  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22590  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22591  & trim(number_to_vstring(domainelements%TOTAL_NUMBER_OF_ELEMENTS,"*",err,error))//" local elements."
22592  CALL flagerror(localerror,err,error,*999)
22593  ENDIF
22594  ELSE
22595  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
22596  ENDIF
22597  ELSE
22598  CALL flagerror("Domain topology is not associated.",err,error,*999)
22599  ENDIF
22600  ELSE
22601  CALL flagerror("Domain is not associated.",err,error,*999)
22602  ENDIF
22603  CASE(field_node_based_interpolation)
22604  localerror="Can not get by element for component number "// &
22605  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22606  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22607  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
22608  CALL flagerror(localerror,err,error,*999)
22609  CASE(field_grid_point_based_interpolation)
22610  localerror="Can not get by element for component number "// &
22611  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22612  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22613  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
22614  CALL flagerror(localerror,err,error,*999)
22615  CASE(field_gauss_point_based_interpolation)
22616  localerror="Can not get by element for component number "// &
22617  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22618  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22619  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
22620  CALL flagerror(localerror,err,error,*999)
22621  CASE(field_data_point_based_interpolation)
22622  localerror="Can not add element for component number "// &
22623  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22624  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22625  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
22626  CALL flagerror(localerror,err,error,*999)
22627  CASE DEFAULT
22628  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
22629  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
22630  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22631  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22632  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22633  CALL flagerror(localerror,err,error,*999)
22634  END SELECT
22635  ELSE
22636  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22637  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22638  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22639  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
22640  & " components."
22641  CALL flagerror(localerror,err,error,*999)
22642  ENDIF
22643  ELSE
22644  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22645  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22646  CALL flagerror(localerror,err,error,*999)
22647  ENDIF
22648  ELSE
22649  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22650  & " is invalid. The field parameter set type must be between 1 and "// &
22651  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
22652  CALL flagerror(localerror,err,error,*999)
22653  ENDIF
22654  ELSE
22655  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
22656  & " does not correspond to the single precision data type of the given value."
22657  CALL flagerror(localerror,err,error,*999)
22658  ENDIF
22659  ELSE
22660  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22661  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22662  CALL flagerror(localerror,err,error,*999)
22663  ENDIF
22664  ELSE
22665  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22666  & " is invalid. The variable type must be between 1 and "// &
22667  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
22668  CALL flagerror(localerror,err,error,*999)
22669  ENDIF
22670  ELSE
22671  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
22672  & " has not been finished."
22673  CALL flagerror(localerror,err,error,*999)
22674  ENDIF
22675  ELSE
22676  CALL flagerror("Field is not associated.",err,error,*999)
22677  ENDIF
22678 
22679  exits("Field_ParameterSetGetLocalElement_Sp")
22680  RETURN
22681 999 errorsexits("Field_ParameterSetGetLocalElement_Sp",err,error)
22682  RETURN 1
22683  END SUBROUTINE field_parametersetgetlocalelement_sp
22684 
22685  !
22686  !================================================================================================================================
22687  !
22688 
22691  SUBROUTINE field_parametersetgetlocalelement_dp(field,variableType,fieldSetType,localElementNumber, &
22692  & componentnumber,VALUE,err,error,*)
22693 
22694  !Argument variables
22695  TYPE(field_type), POINTER :: field
22696  INTEGER(INTG), INTENT(IN) :: variabletype
22697  INTEGER(INTG), INTENT(IN) :: fieldsettype
22698  INTEGER(INTG), INTENT(IN) :: localelementnumber
22699  INTEGER(INTG), INTENT(IN) :: componentnumber
22700  REAL(DP), INTENT(OUT) :: value
22701  INTEGER(INTG), INTENT(OUT) :: err
22702  TYPE(varying_string), INTENT(OUT) :: error
22703  !Local Variables
22704  INTEGER(INTG) :: dofidx
22705  TYPE(domain_type), POINTER :: domain
22706  TYPE(domain_elements_type), POINTER :: domainelements
22707  TYPE(domain_topology_type), POINTER :: domaintopology
22708  TYPE(field_parameter_set_type), POINTER :: parameterset
22709  TYPE(field_variable_type), POINTER :: fieldvariable
22710  TYPE(varying_string) :: localerror
22711 
22712  enters("Field_ParameterSetGetLocalElement_Dp",err,error,*999)
22713 
22714  IF(ASSOCIATED(field)) THEN
22715  IF(field%FIELD_FINISHED) THEN
22716  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
22717  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
22718  IF(ASSOCIATED(fieldvariable)) THEN
22719  IF(fieldvariable%DATA_TYPE==field_dp_type) THEN
22720  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
22721  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%ptr
22722  IF(ASSOCIATED(parameterset)) THEN
22723  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
22724  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
22725  CASE(field_constant_interpolation)
22726  localerror="Can not get by element for component number "// &
22727  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22728  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22729  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
22730  CALL flagerror(localerror,err,error,*999)
22731  CASE(field_element_based_interpolation)
22732  domain=>fieldvariable%components(componentnumber)%domain
22733  IF(ASSOCIATED(domain)) THEN
22734  domaintopology=>domain%topology
22735  IF(ASSOCIATED(domaintopology)) THEN
22736  domainelements=>domaintopology%elements
22737  IF(ASSOCIATED(domainelements)) THEN
22738  IF(localelementnumber>0.AND.localelementnumber<=domainelements%TOTAL_NUMBER_OF_ELEMENTS) THEN
22739  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
22740  & element_param2dof_map%ELEMENTS(localelementnumber)
22741  CALL distributed_vector_values_get(parameterset%parameters,dofidx,value,err,error,*999)
22742  ELSE
22743  localerror="The specified local element number of "// &
22744  & trim(number_to_vstring(localelementnumber,"*",err,error))// &
22745  & " does not exist in the domain for field component number "// &
22746  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
22747  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22748  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22749  & trim(number_to_vstring(domainelements%TOTAL_NUMBER_OF_ELEMENTS,"*",err,error))//" local elements."
22750  CALL flagerror(localerror,err,error,*999)
22751  ENDIF
22752  ELSE
22753  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
22754  ENDIF
22755  ELSE
22756  CALL flagerror("Domain topology is not associated.",err,error,*999)
22757  ENDIF
22758  ELSE
22759  CALL flagerror("Domain is not associated.",err,error,*999)
22760  ENDIF
22761  CASE(field_node_based_interpolation)
22762  localerror="Can not get by element for component number "// &
22763  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22764  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22765  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
22766  CALL flagerror(localerror,err,error,*999)
22767  CASE(field_grid_point_based_interpolation)
22768  localerror="Can not get by element for component number "// &
22769  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22770  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22771  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
22772  CALL flagerror(localerror,err,error,*999)
22773  CASE(field_gauss_point_based_interpolation)
22774  localerror="Can not get by element for component number "// &
22775  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22776  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22777  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
22778  CALL flagerror(localerror,err,error,*999)
22779  CASE(field_data_point_based_interpolation)
22780  localerror="Can not add element for component number "// &
22781  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22782  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22783  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
22784  CALL flagerror(localerror,err,error,*999)
22785  CASE DEFAULT
22786  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
22787  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
22788  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22789  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22790  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22791  CALL flagerror(localerror,err,error,*999)
22792  END SELECT
22793  ELSE
22794  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22795  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22796  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22797  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
22798  & " components."
22799  CALL flagerror(localerror,err,error,*999)
22800  ENDIF
22801  ELSE
22802  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22803  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22804  CALL flagerror(localerror,err,error,*999)
22805  ENDIF
22806  ELSE
22807  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22808  & " is invalid. The field parameter set type must be between 1 and "// &
22809  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
22810  CALL flagerror(localerror,err,error,*999)
22811  ENDIF
22812  ELSE
22813  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
22814  & " does not correspond to the double precision data type of the given value."
22815  CALL flagerror(localerror,err,error,*999)
22816  ENDIF
22817  ELSE
22818  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22819  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22820  CALL flagerror(localerror,err,error,*999)
22821  ENDIF
22822  ELSE
22823  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22824  & " is invalid. The variable type must be between 1 and "// &
22825  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
22826  CALL flagerror(localerror,err,error,*999)
22827  ENDIF
22828  ELSE
22829  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
22830  & " has not been finished."
22831  CALL flagerror(localerror,err,error,*999)
22832  ENDIF
22833  ELSE
22834  CALL flagerror("Field is not associated.",err,error,*999)
22835  ENDIF
22836 
22837  exits("Field_ParameterSetGetLocalElement_Dp")
22838  RETURN
22839 999 errorsexits("Field_ParameterSetGetLocalElement_Dp",err,error)
22840  RETURN 1
22841  END SUBROUTINE field_parametersetgetlocalelement_dp
22842 
22843  !
22844  !================================================================================================================================
22845  !
22846 
22849  SUBROUTINE field_parametersetgetlocalelement_l(field,variableType,fieldSetType,localElementNumber, &
22850  & componentnumber,VALUE,err,error,*)
22851 
22852  !Argument variables
22853  TYPE(field_type), POINTER :: field
22854  INTEGER(INTG), INTENT(IN) :: variabletype
22855  INTEGER(INTG), INTENT(IN) :: fieldsettype
22856  INTEGER(INTG), INTENT(IN) :: localelementnumber
22857  INTEGER(INTG), INTENT(IN) :: componentnumber
22858  LOGICAL, INTENT(OUT) :: value
22859  INTEGER(INTG), INTENT(OUT) :: err
22860  TYPE(varying_string), INTENT(OUT) :: error
22861  !Local Variables
22862  INTEGER(INTG) :: dofidx
22863  TYPE(domain_type), POINTER :: domain
22864  TYPE(domain_elements_type), POINTER :: domainelements
22865  TYPE(domain_topology_type), POINTER :: domaintopology
22866  TYPE(field_parameter_set_type), POINTER :: parameterset
22867  TYPE(field_variable_type), POINTER :: fieldvariable
22868  TYPE(varying_string) :: localerror
22869 
22870  enters("Field_ParameterSetGetLocalElement_L",err,error,*999)
22871 
22872  IF(ASSOCIATED(field)) THEN
22873  IF(field%FIELD_FINISHED) THEN
22874  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
22875  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
22876  IF(ASSOCIATED(fieldvariable)) THEN
22877  IF(fieldvariable%DATA_TYPE==field_l_type) THEN
22878  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
22879  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%ptr
22880  IF(ASSOCIATED(parameterset)) THEN
22881  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
22882  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
22883  CASE(field_constant_interpolation)
22884  localerror="Can not get by element for component number "// &
22885  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22886  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22887  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
22888  CALL flagerror(localerror,err,error,*999)
22889  CASE(field_element_based_interpolation)
22890  domain=>fieldvariable%components(componentnumber)%domain
22891  IF(ASSOCIATED(domain)) THEN
22892  domaintopology=>domain%topology
22893  IF(ASSOCIATED(domaintopology)) THEN
22894  domainelements=>domaintopology%elements
22895  IF(ASSOCIATED(domainelements)) THEN
22896  IF(localelementnumber>0.AND.localelementnumber<=domainelements%TOTAL_NUMBER_OF_ELEMENTS) THEN
22897  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
22898  & element_param2dof_map%ELEMENTS(localelementnumber)
22899  CALL distributed_vector_values_get(parameterset%parameters,dofidx,value,err,error,*999)
22900  ELSE
22901  localerror="The specified local element number of "// &
22902  & trim(number_to_vstring(localelementnumber,"*",err,error))// &
22903  & " does not exist in the domain for field component number "// &
22904  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
22905  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22906  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22907  & trim(number_to_vstring(domainelements%TOTAL_NUMBER_OF_ELEMENTS,"*",err,error))//" local elements."
22908  CALL flagerror(localerror,err,error,*999)
22909  ENDIF
22910  ELSE
22911  CALL flagerror("Domain topology elements is not associated.",err,error,*999)
22912  ENDIF
22913  ELSE
22914  CALL flagerror("Domain topology is not associated.",err,error,*999)
22915  ENDIF
22916  ELSE
22917  CALL flagerror("Domain is not associated.",err,error,*999)
22918  ENDIF
22919  CASE(field_node_based_interpolation)
22920  localerror="Can not get by element for component number "// &
22921  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22922  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22923  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
22924  CALL flagerror(localerror,err,error,*999)
22925  CASE(field_grid_point_based_interpolation)
22926  localerror="Can not get by element for component number "// &
22927  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22928  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22929  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
22930  CALL flagerror(localerror,err,error,*999)
22931  CASE(field_gauss_point_based_interpolation)
22932  localerror="Can not get by element for component number "// &
22933  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22934  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22935  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
22936  CALL flagerror(localerror,err,error,*999)
22937  CASE(field_data_point_based_interpolation)
22938  localerror="Can not add element for component number "// &
22939  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
22940  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
22941  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
22942  CALL flagerror(localerror,err,error,*999)
22943  CASE DEFAULT
22944  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
22945  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
22946  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22947  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22948  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22949  CALL flagerror(localerror,err,error,*999)
22950  END SELECT
22951  ELSE
22952  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
22953  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
22954  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
22955  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))// &
22956  & " components."
22957  CALL flagerror(localerror,err,error,*999)
22958  ENDIF
22959  ELSE
22960  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22961  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22962  CALL flagerror(localerror,err,error,*999)
22963  ENDIF
22964  ELSE
22965  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
22966  & " is invalid. The field parameter set type must be between 1 and "// &
22967  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
22968  CALL flagerror(localerror,err,error,*999)
22969  ENDIF
22970  ELSE
22971  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
22972  & " does not correspond to the logical data type of the given value."
22973  CALL flagerror(localerror,err,error,*999)
22974  ENDIF
22975  ELSE
22976  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22977  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
22978  CALL flagerror(localerror,err,error,*999)
22979  ENDIF
22980  ELSE
22981  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
22982  & " is invalid. The variable type must be between 1 and "// &
22983  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
22984  CALL flagerror(localerror,err,error,*999)
22985  ENDIF
22986  ELSE
22987  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
22988  & " has not been finished."
22989  CALL flagerror(localerror,err,error,*999)
22990  ENDIF
22991  ELSE
22992  CALL flagerror("Field is not associated.",err,error,*999)
22993  ENDIF
22994 
22995  exits("Field_ParameterSetGetLocalElement_L")
22996  RETURN
22997 999 errorsexits("Field_ParameterSetGetLocalElement_L",err,error)
22998  RETURN 1
22999  END SUBROUTINE field_parametersetgetlocalelement_l
23000 
23001  !
23002  !================================================================================================================================
23003  !
23004 
23006  SUBROUTINE field_parametersetgetgausspointdp(field,variableType,fieldSetType,gaussPointNumber,userElementNumber, &
23007  & componentnumber,value,err,error,*)
23008 
23009  !Argument variables
23010  TYPE(field_type), POINTER :: field
23011  INTEGER(INTG), INTENT(IN) :: variabletype
23012  INTEGER(INTG), INTENT(IN) :: fieldsettype
23013  INTEGER(INTG), INTENT(IN) :: gausspointnumber
23014  INTEGER(INTG), INTENT(IN) :: userelementnumber
23015  INTEGER(INTG), INTENT(IN) :: componentnumber
23016  REAL(DP), INTENT(OUT) :: value
23017  INTEGER(INTG), INTENT(OUT) :: err
23018  TYPE(varying_string), INTENT(OUT) :: error
23019  !Local Variables
23020  INTEGER(INTG) :: decompositionlocalelementnumber,dofidx
23021  LOGICAL :: ghostelement,userelementexists
23022  TYPE(decomposition_type), POINTER :: decomposition
23023  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
23024  TYPE(field_parameter_set_type), POINTER :: parameterset
23025  TYPE(field_variable_type), POINTER :: fieldvariable
23026  TYPE(varying_string) :: localerror
23027 
23028  enters("Field_ParameterSetGetGaussPointDP",err,error,*999)
23029 
23030  IF(ASSOCIATED(field)) THEN
23031  IF(field%FIELD_FINISHED) THEN
23032  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
23033  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%ptr
23034  IF(ASSOCIATED(fieldvariable)) THEN
23035  IF(fieldvariable%DATA_TYPE==field_dp_type) THEN
23036  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
23037  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%ptr
23038  IF(ASSOCIATED(parameterset)) THEN
23039  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
23040  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
23041  CASE(field_constant_interpolation)
23042  localerror="Can not get by gauss point for component number "// &
23043  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
23044  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23045  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
23046  CALL flagerror(localerror,err,error,*999)
23047  CASE(field_element_based_interpolation)
23048  localerror="Can not get by gauss point for component number "// &
23049  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
23050  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23051  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
23052  CALL flagerror(localerror,err,error,*999)
23053  CASE(field_node_based_interpolation)
23054  localerror="Can not get by gauss point for component number "// &
23055  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
23056  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23057  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
23058  CALL flagerror(localerror,err,error,*999)
23059  CASE(field_grid_point_based_interpolation)
23060  localerror="Can not get by gauss point for component number "// &
23061  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
23062  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23063  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
23064  CALL flagerror(localerror,err,error,*999)
23065  CASE(field_gauss_point_based_interpolation)
23066  decomposition=>field%decomposition
23067  IF(ASSOCIATED(decomposition)) THEN
23068  decompositiontopology=>decomposition%topology
23069  CALL decomposition_topology_element_check_exists(decompositiontopology,userelementnumber, &
23070  & userelementexists,decompositionlocalelementnumber,ghostelement,err,error,*999)
23071  IF(userelementexists) THEN
23072  IF(gausspointnumber >= 1 .AND. gausspointnumber <= SIZE(fieldvariable% & !TODO: check for actual # of gp?
23073  & components(componentnumber)%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)) THEN
23074  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
23075  & gauss_point_param2dof_map%GAUSS_POINTS(gausspointnumber,decompositionlocalelementnumber)
23076  CALL distributed_vector_values_get(parameterset%parameters,dofidx,value,err,error,*999)
23077  ELSE
23078  localerror="The specified gauss point number "// &
23079  & trim(numbertovstring(gausspointnumber,"*",err,error))// &
23080  & " is not within the expected range."
23081  CALL flagerror(localerror,err,error,*999)
23082  ENDIF
23083  ELSE
23084  localerror="The specified user element number of "// &
23085  & trim(numbertovstring(userelementnumber,"*",err,error))// &
23086  & " does not exist in the decomposition for field component number "// &
23087  & trim(numbertovstring(componentnumber,"*",err,error))//" of field variable type "// &
23088  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23089  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
23090  CALL flagerror(localerror,err,error,*999)
23091  ENDIF
23092  ELSE
23093  CALL flagerror("Field decomposition is not associated.",err,error,*999)
23094  ENDIF
23095  CASE(field_data_point_based_interpolation)
23096  localerror="Can not add element for component number "// &
23097  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
23098  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23099  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
23100  CALL flagerror(localerror,err,error,*999)
23101  CASE DEFAULT
23102  localerror="The field component interpolation type of "//trim(numbertovstring(fieldvariable% &
23103  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
23104  & " is invalid for component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
23105  & " of variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
23106  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
23107  CALL flagerror(localerror,err,error,*999)
23108  END SELECT
23109  ELSE
23110  localerror="Component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
23111  & " is invalid for variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
23112  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has "// &
23113  & trim(numbertovstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
23114  CALL flagerror(localerror,err,error,*999)
23115  ENDIF
23116  ELSE
23117  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
23118  & " has not been created on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))
23119  CALL flagerror(localerror,err,error,*999)
23120  ENDIF
23121  ELSE
23122  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
23123  & " is invalid. The field parameter set type must be between 1 and "// &
23124  & trim(numbertovstring(field_number_of_set_types,"*",err,error))
23125  CALL flagerror(localerror,err,error,*999)
23126  ENDIF
23127  ELSE
23128  localerror="The field variable data type of "//trim(numbertovstring(fieldvariable%DATA_TYPE,"*",err,error))// &
23129  & " does not correspond to the double precision data type of the given value."
23130  CALL flagerror(localerror,err,error,*999)
23131  ENDIF
23132  ELSE
23133  localerror="The specified field variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
23134  & " has not been defined on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
23135  CALL flagerror(localerror,err,error,*999)
23136  ENDIF
23137  ELSE
23138  localerror="The specified variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
23139  & " is invalid. The variable type must be between 1 and "// &
23140  & trim(numbertovstring(field_number_of_variable_types,"*",err,error))//"."
23141  CALL flagerror(localerror,err,error,*999)
23142  ENDIF
23143  ELSE
23144  localerror="Field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))// &
23145  & " has not been finished."
23146  CALL flagerror(localerror,err,error,*999)
23147  ENDIF
23148  ELSE
23149  CALL flagerror("Field is not associated.",err,error,*999)
23150  ENDIF
23151 
23152  exits("Field_ParameterSetGetGaussPointDP")
23153  RETURN
23154 999 errorsexits("Field_ParameterSetGetGaussPointDP",err,error)
23155  RETURN 1
23156 
23157  END SUBROUTINE field_parametersetgetgausspointdp
23158 
23159  !
23160  !================================================================================================================================
23161  !
23162 
23164  SUBROUTINE field_parametersetgetlocalgausspointdp(field,variableType,fieldSetType,gaussPointNumber,localElementNumber, &
23165  & componentnumber,value,err,error,*)
23166 
23167  !Argument variables
23168  TYPE(field_type), POINTER :: field
23169  INTEGER(INTG), INTENT(IN) :: variabletype
23170  INTEGER(INTG), INTENT(IN) :: fieldsettype
23171  INTEGER(INTG), INTENT(IN) :: gausspointnumber
23172  INTEGER(INTG), INTENT(IN) :: localelementnumber
23173  INTEGER(INTG), INTENT(IN) :: componentnumber
23174  REAL(DP), INTENT(OUT) :: value
23175  INTEGER(INTG), INTENT(OUT) :: err
23176  TYPE(varying_string), INTENT(OUT) :: error
23177  !Local Variables
23178  INTEGER(INTG) :: dofidx
23179  TYPE(decomposition_type), POINTER :: decomposition
23180  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
23181  TYPE(field_parameter_set_type), POINTER :: parameterset
23182  TYPE(field_variable_type), POINTER :: fieldvariable
23183  TYPE(varying_string) :: localerror
23184 
23185  enters("Field_ParameterSetGetLocalGaussPointDP",err,error,*999)
23186 
23187  IF(ASSOCIATED(field)) THEN
23188  IF(field%FIELD_FINISHED) THEN
23189  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
23190  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%ptr
23191  IF(ASSOCIATED(fieldvariable)) THEN
23192  IF(fieldvariable%DATA_TYPE==field_dp_type) THEN
23193  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
23194  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%ptr
23195  IF(ASSOCIATED(parameterset)) THEN
23196  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
23197  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
23198  CASE(field_constant_interpolation)
23199  localerror="Can not get by gauss point for component number "// &
23200  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
23201  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23202  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
23203  CALL flagerror(localerror,err,error,*999)
23204  CASE(field_element_based_interpolation)
23205  localerror="Can not get by gauss point for component number "// &
23206  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
23207  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23208  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
23209  CALL flagerror(localerror,err,error,*999)
23210  CASE(field_node_based_interpolation)
23211  localerror="Can not get by gauss point for component number "// &
23212  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
23213  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23214  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
23215  CALL flagerror(localerror,err,error,*999)
23216  CASE(field_grid_point_based_interpolation)
23217  localerror="Can not get by gauss point for component number "// &
23218  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
23219  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23220  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
23221  CALL flagerror(localerror,err,error,*999)
23222  CASE(field_gauss_point_based_interpolation)
23223  decomposition=>field%decomposition
23224  IF(ASSOCIATED(decomposition)) THEN
23225  decompositiontopology=>decomposition%topology
23226  IF(ASSOCIATED(decompositiontopology)) THEN
23227  IF(ASSOCIATED(decompositiontopology%elements)) THEN
23228  IF(localelementnumber>=1.AND. &
23229  & localelementnumber<=decompositiontopology%elements%TOTAL_NUMBER_OF_ELEMENTS) THEN
23230  !!TODO: check for actual # of gp?
23231  IF(gausspointnumber >= 1 .AND. gausspointnumber <= SIZE(fieldvariable% &
23232  & components(componentnumber)%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)) THEN
23233  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
23234  & gauss_point_param2dof_map%GAUSS_POINTS(gausspointnumber,localelementnumber)
23235  CALL distributed_vector_values_get(parameterset%parameters,dofidx,VALUE,err,error,*999)
23236  ELSE
23237  localerror="The specified gauss point number "// &
23238  & trim(numbertovstring(gausspointnumber,"*",err,error))// &
23239  & " is not within the expected range."
23240  CALL flagerror(localerror,err,error,*999)
23241  ENDIF
23242  ELSE
23243  localerror="Local element number "//trim(numbertovstring(localelementnumber,"*",err,error))// &
23244  & " is invalid. The local element number must be >=1 and <= "// &
23245  & trim(numbertovstring(decompositiontopology%elements%TOTAL_NUMBER_OF_ELEMENTS,"*",err,error))//"."
23246  CALL flagerror(localerror,err,error,*999)
23247  ENDIF
23248  ELSE
23249  CALL flagerror("Decomposition topology elements is not associated.",err,error,*999)
23250  ENDIF
23251  ELSE
23252  CALL flagerror("Decomposition topology is not associated.",err,error,*999)
23253  ENDIF
23254  ELSE
23255  CALL flagerror("Field decomposition is not associated.",err,error,*999)
23256  ENDIF
23257  CASE(field_data_point_based_interpolation)
23258  localerror="Can not add element for component number "// &
23259  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
23260  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
23261  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
23262  CALL flagerror(localerror,err,error,*999)
23263  CASE DEFAULT
23264  localerror="The field component interpolation type of "//trim(numbertovstring(fieldvariable% &
23265  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
23266  & " is invalid for component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
23267  & " of variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
23268  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
23269  CALL flagerror(localerror,err,error,*999)
23270  END SELECT
23271  ELSE
23272  localerror="Component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
23273  & " is invalid for variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
23274  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has "// &
23275  & trim(numbertovstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
23276  CALL flagerror(localerror,err,error,*999)
23277  ENDIF
23278  ELSE
23279  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
23280  & " has not been created on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))
23281  CALL flagerror(localerror,err,error,*999)
23282  ENDIF
23283  ELSE
23284  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
23285  & " is invalid. The field parameter set type must be between 1 and "// &
23286  & trim(numbertovstring(field_number_of_set_types,"*",err,error))
23287  CALL flagerror(localerror,err,error,*999)
23288  ENDIF
23289  ELSE
23290  localerror="The field variable data type of "//trim(numbertovstring(fieldvariable%DATA_TYPE,"*",err,error))// &
23291  & " does not correspond to the double precision data type of the given value."
23292  CALL flagerror(localerror,err,error,*999)
23293  ENDIF
23294  ELSE
23295  localerror="The specified field variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
23296  & " has not been defined on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
23297  CALL flagerror(localerror,err,error,*999)
23298  ENDIF
23299  ELSE
23300  localerror="The specified variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
23301  & " is invalid. The variable type must be between 1 and "// &
23302  & trim(numbertovstring(field_number_of_variable_types,"*",err,error))//"."
23303  CALL flagerror(localerror,err,error,*999)
23304  ENDIF
23305  ELSE
23306  localerror="Field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))// &
23307  & " has not been finished."
23308  CALL flagerror(localerror,err,error,*999)
23309  ENDIF
23310  ELSE
23311  CALL flagerror("Field is not associated.",err,error,*999)
23312  ENDIF
23313 
23314  exits("Field_ParameterSetGetLocalGaussPointDP")
23315  RETURN
23316 999 errorsexits("Field_ParameterSetGetLocalGaussPointDP",err,error)
23317  RETURN 1
23318 
23319  END SUBROUTINE field_parametersetgetlocalgausspointdp
23320 
23321  !
23322  !================================================================================================================================
23323  !
23324 
23326  SUBROUTINE field_parametersetupdateelementdatapointdp(field,variableType,fieldSetType,userElementNumber,dataPointIndex, &
23327  & componentnumber,value,err,error,*)
23328 
23329  !Argument variables
23330  TYPE(field_type), POINTER :: field
23331  INTEGER(INTG), INTENT(IN) :: variabletype
23332  INTEGER(INTG), INTENT(IN) :: fieldsettype
23333  INTEGER(INTG), INTENT(IN) :: userelementnumber
23334  INTEGER(INTG), INTENT(IN) :: datapointindex
23335  INTEGER(INTG), INTENT(IN) :: componentnumber
23336  REAL(DP), INTENT(IN) :: value
23337  INTEGER(INTG), INTENT(OUT) :: err
23338  TYPE(varying_string), INTENT(OUT) :: error
23339  !Local Variables
23340  INTEGER(INTG) :: decompositionlocalelementnumber,datapointlocalnumber,dofidx
23341  LOGICAL :: ghostelement,userelementexists
23342  TYPE(decomposition_type), POINTER :: decomposition
23343  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
23344  TYPE(data_projection_type), POINTER :: dataprojection
23345  TYPE(field_parameter_set_type), POINTER :: parameterset
23346  TYPE(field_variable_type), POINTER :: fieldvariable
23347  TYPE(varying_string) :: localerror
23348 
23349  enters("Field_ParameterSetUpdateElementDataPointDP",err,error,*999)
23350 
23351  IF(ASSOCIATED(field)) THEN
23352  IF(field%FIELD_FINISHED) THEN
23353  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
23354  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
23355  IF(ASSOCIATED(fieldvariable)) THEN
23356  IF(fieldvariable%DATA_TYPE==field_dp_type) THEN
23357  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
23358  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
23359  IF(ASSOCIATED(parameterset)) THEN
23360  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
23361  SELECT CASE(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE)
23362  CASE(field_constant_interpolation)
23363  localerror="Can not update by data point for component number "// &
23364  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
23365  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
23366  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
23367  CALL flagerror(localerror,err,error,*999)
23368  CASE(field_element_based_interpolation)
23369  localerror="Can not update by data point for component number "// &
23370  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
23371  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
23372  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
23373  CALL flagerror(localerror,err,error,*999)
23374  CASE(field_node_based_interpolation)
23375  localerror="Can not update by data point for component number "// &
23376  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
23377  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
23378  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
23379  CALL flagerror(localerror,err,error,*999)
23380  CASE(field_grid_point_based_interpolation)
23381  localerror="Can not update by data point for component number "// &
23382  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
23383  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
23384  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
23385  CALL flagerror(localerror,err,error,*999)
23386  CASE(field_gauss_point_based_interpolation)
23387  localerror="Can not update by gauss point for component number "// &
23388  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
23389  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
23390  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has gauss point based interpolation."
23391  CALL flagerror(localerror,err,error,*999)
23392  CASE(field_data_point_based_interpolation)
23393  decomposition=>field%DECOMPOSITION
23394  IF(ASSOCIATED(decomposition)) THEN
23395  decompositiontopology=>decomposition%TOPOLOGY
23396  IF(ASSOCIATED(decompositiontopology)) THEN
23397  dataprojection=>field%dataProjection
23398  IF(ASSOCIATED(dataprojection)) THEN
23399  ! Use element topology to check if data point is on current computational node
23400  CALL decomposition_topology_element_check_exists(decompositiontopology,userelementnumber, &
23401  & userelementexists,decompositionlocalelementnumber,ghostelement,err,error,*999)
23402  IF(userelementexists) THEN
23403  IF(ghostelement) THEN
23404  localerror="Cannot update by data point for user element "// &
23405  & trim(number_to_vstring(userelementnumber,"*",err,error))//" as it is a ghost element."
23406  CALL flagerror(localerror,err,error,*999)
23407  ELSE
23408  datapointlocalnumber = decompositiontopology%dataPoints% &
23409  & elementdatapoint(decompositionlocalelementnumber)%dataIndices(datapointindex)%localNumber
23410  IF(datapointlocalnumber >= 1 .AND. datapointlocalnumber <= fieldvariable% &
23411  & components(componentnumber)%PARAM_TO_DOF_MAP%DATA_POINT_PARAM2DOF_MAP% &
23412  & number_of_data_point_parameters) THEN
23413  dofidx=fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
23414  & data_point_param2dof_map%DATA_POINTS(datapointlocalnumber)
23415  CALL distributed_vector_values_set(parameterset%PARAMETERS,dofidx,value,err,error,*999)
23416  ELSE
23417  localerror="The specified data point index "// &
23418  & trim(number_to_vstring(datapointlocalnumber,"*",err,error))// &
23419  & " is not within the expected range."
23420  CALL flagerror(localerror,err,error,*999)
23421  ENDIF
23422  ENDIF
23423  ELSE
23424  localerror="The specified user element number of "// &
23425  & trim(number_to_vstring(userelementnumber,"*",err,error))// &
23426  & " does not exist in the decomposition for field component number "// &
23427  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
23428  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
23429  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23430  CALL flagerror(localerror,err,error,*999)
23431  ENDIF
23432  ELSE
23433  CALL flagerror("Data point projection not associated on provided field.",err,error,*999)
23434  ENDIF
23435  ELSE
23436  CALL flagerror("Field decomposition topology is not associated.",err,error,*999)
23437  ENDIF
23438  ELSE
23439  CALL flagerror("Field decomposition is not associated.",err,error,*999)
23440  ENDIF
23441  CASE DEFAULT
23442  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
23443  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
23444  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
23445  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
23446  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23447  CALL flagerror(localerror,err,error,*999)
23448  END SELECT
23449  ELSE
23450  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
23451  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
23452  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
23453  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
23454  CALL flagerror(localerror,err,error,*999)
23455  ENDIF
23456  ELSE
23457  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
23458  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
23459  CALL flagerror(localerror,err,error,*999)
23460  ENDIF
23461  ELSE
23462  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
23463  & " is invalid. The field parameter set type must be between 1 and "// &
23464  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
23465  CALL flagerror(localerror,err,error,*999)
23466  ENDIF
23467  ELSE
23468  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
23469  & " does not correspond to the double precision data type of the given value."
23470  CALL flagerror(localerror,err,error,*999)
23471  ENDIF
23472  ELSE
23473  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
23474  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23475  CALL flagerror(localerror,err,error,*999)
23476  ENDIF
23477  ELSE
23478  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
23479  & " is invalid. The variable type must be between 1 and "// &
23480  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
23481  CALL flagerror(localerror,err,error,*999)
23482  ENDIF
23483  ELSE
23484  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
23485  & " has not been finished."
23486  CALL flagerror(localerror,err,error,*999)
23487  ENDIF
23488  ELSE
23489  CALL flagerror("Field is not associated.",err,error,*999)
23490  ENDIF
23491 
23492  exits("Field_ParameterSetUpdateElementDataPointDP")
23493  RETURN
23494 999 errorsexits("Field_ParameterSetUpdateElementDataPointDP",err,error)
23495  RETURN 1
23496  END SUBROUTINE field_parametersetupdateelementdatapointdp
23497 
23498  !
23499  !================================================================================================================================
23500  !
23501 
23503  SUBROUTINE field_parameter_set_initialise(FIELD_PARAMETER_SET,ERR,ERROR,*)
23504 
23505  !Argument variables
23506  TYPE(field_parameter_set_type), POINTER :: field_parameter_set
23507  INTEGER(INTG), INTENT(OUT) :: err
23508  TYPE(varying_string), INTENT(OUT) :: error
23509  !Local Variables
23510 
23511  enters("FIELD_PARAMETER_SET_INITIALISE",err,error,*999)
23512 
23513  IF(ASSOCIATED(field_parameter_set)) THEN
23514  field_parameter_set%SET_INDEX=0
23515  field_parameter_set%SET_TYPE=0
23516  ELSE
23517  CALL flagerror("Field parameter set is not associated",err,error,*999)
23518  ENDIF
23519 
23520  exits("FIELD_PARAMETER_SET_INITIALISE")
23521  RETURN
23522 999 errorsexits("FIELD_PARAMETER_SET_INITIALISE",err,error)
23523  RETURN 1
23524  END SUBROUTINE field_parameter_set_initialise
23525 
23526  !
23527  !================================================================================================================================
23528  !
23529 
23531  SUBROUTINE field_parameter_set_output(ID,FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,ERR,ERROR,*)
23532 
23533  !Argument variables
23534  INTEGER(INTG), INTENT(IN) :: id
23535  TYPE(field_type), POINTER :: field
23536  INTEGER(INTG), INTENT(IN) :: variable_type
23537  INTEGER(INTG), INTENT(IN) :: field_set_type
23538  INTEGER(INTG), INTENT(OUT) :: err
23539  TYPE(varying_string), INTENT(OUT) :: error
23540  !Local Variables
23541  TYPE(field_parameter_set_type), POINTER :: parameter_set
23542  TYPE(field_variable_type), POINTER :: field_variable
23543  TYPE(varying_string) :: local_error
23544 
23545  enters("FIELD_PARAMETER_SET_OUTPUT",err,error,*999)
23546 
23547  IF(ASSOCIATED(field)) THEN
23548  IF(field%FIELD_FINISHED) THEN
23549  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
23550  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
23551  IF(ASSOCIATED(field_variable)) THEN
23552  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
23553  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
23554  IF(ASSOCIATED(parameter_set)) THEN
23555  CALL distributed_vector_output(id,parameter_set%PARAMETERS,err,error,*999)
23556  ELSE
23557  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
23558  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23559  CALL flagerror(local_error,err,error,*999)
23560  ENDIF
23561  ELSE
23562  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
23563  & " is invalid. The field parameter set type must be between 1 and "// &
23564  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
23565  CALL flagerror(local_error,err,error,*999)
23566  ENDIF
23567  ELSE
23568  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
23569  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23570  CALL flagerror(local_error,err,error,*999)
23571  ENDIF
23572  ELSE
23573  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
23574  & " is invalid. The variable type must be between 1 and "// &
23575  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
23576  CALL flagerror(local_error,err,error,*999)
23577  ENDIF
23578  ELSE
23579  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
23580  & " has not been finished."
23581  CALL flagerror(local_error,err,error,*999)
23582  ENDIF
23583  ELSE
23584  CALL flagerror("Field is not associated.",err,error,*999)
23585  ENDIF
23586 
23587  exits("FIELD_PARAMETER_SET_OUTPUT")
23588  RETURN
23589 999 errorsexits("FIELD_PARAMETER_SET_OUTPUT",err,error)
23590  RETURN 1
23591  END SUBROUTINE field_parameter_set_output
23592 
23593  !
23594  !================================================================================================================================
23595  !
23596 
23598  SUBROUTINE field_parameter_set_update_constant_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
23599 
23600  !Argument variables
23601  TYPE(field_type), POINTER :: field
23602  INTEGER(INTG), INTENT(IN) :: variable_type
23603  INTEGER(INTG), INTENT(IN) :: field_set_type
23604  INTEGER(INTG), INTENT(IN) :: component_number
23605  INTEGER, INTENT(IN) :: VALUE
23606  INTEGER(INTG), INTENT(OUT) :: err
23607  TYPE(varying_string), INTENT(OUT) :: error
23608  !Local Variables
23609  INTEGER(INTG) :: ny
23610  TYPE(field_parameter_set_type), POINTER :: parameter_set
23611  TYPE(field_variable_type), POINTER :: field_variable
23612  TYPE(varying_string) :: local_error
23613 
23614  enters("FIELD_PARAMETER_SET_UPDATE_CONSTANT_INTG",err,error,*999)
23615 
23616  IF(ASSOCIATED(field)) THEN
23617  IF(field%FIELD_FINISHED) THEN
23618  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
23619  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
23620  IF(ASSOCIATED(field_variable)) THEN
23621  IF(field_variable%DATA_TYPE==field_intg_type) THEN
23622  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
23623  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
23624  IF(ASSOCIATED(parameter_set)) THEN
23625  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
23626  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
23627  CASE(field_constant_interpolation)
23628  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
23629  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
23630  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
23631  ELSE
23632  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
23633  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
23634  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
23635  & " does not have any constant parameters."
23636  CALL flagerror(local_error,err,error,*999)
23637  ENDIF
23638  CASE(field_element_based_interpolation)
23639  local_error="Can not update by constant for component number "// &
23640  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23641  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23642  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
23643  CALL flagerror(local_error,err,error,*999)
23644  CASE(field_node_based_interpolation)
23645  local_error="Can not update by constant for component number "// &
23646  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23647  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23648  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
23649  CALL flagerror(local_error,err,error,*999)
23650  CASE(field_grid_point_based_interpolation)
23651  local_error="Can not update by constant for component number "// &
23652  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23653  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23654  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
23655  CALL flagerror(local_error,err,error,*999)
23656  CASE(field_gauss_point_based_interpolation)
23657  local_error="Can not update by constant for component number "// &
23658  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23659  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23660  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
23661  CALL flagerror(local_error,err,error,*999)
23662  CASE(field_data_point_based_interpolation)
23663  local_error="Can not add element for component number "// &
23664  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23665  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23666  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
23667  CALL flagerror(local_error,err,error,*999)
23668  CASE DEFAULT
23669  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
23670  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
23671  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
23672  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
23673  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23674  CALL flagerror(local_error,err,error,*999)
23675  END SELECT
23676  ELSE
23677  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
23678  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
23679  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
23680  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
23681  & " components."
23682  CALL flagerror(local_error,err,error,*999)
23683  ENDIF
23684  ELSE
23685  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
23686  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23687  CALL flagerror(local_error,err,error,*999)
23688  ENDIF
23689  ELSE
23690  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
23691  & " is invalid. The field parameter set type must be between 1 and "// &
23692  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
23693  CALL flagerror(local_error,err,error,*999)
23694  ENDIF
23695  ELSE
23696  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
23697  & " does not correspond to the integer data type of the given value."
23698  CALL flagerror(local_error,err,error,*999)
23699  ENDIF
23700  ELSE
23701  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
23702  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23703  CALL flagerror(local_error,err,error,*999)
23704  ENDIF
23705  ELSE
23706  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
23707  & " is invalid. The variable type must be between 1 and "// &
23708  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
23709  CALL flagerror(local_error,err,error,*999)
23710  ENDIF
23711  ELSE
23712  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
23713  & " has not been finished."
23714  CALL flagerror(local_error,err,error,*999)
23715  ENDIF
23716  ELSE
23717  CALL flagerror("Field is not associated.",err,error,*999)
23718  ENDIF
23719 
23720  exits("FIELD_PARAMETER_SET_UPDATE_CONSTANT_INTG")
23721  RETURN
23722 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_CONSTANT_INTG",err,error)
23723  RETURN 1
23724  END SUBROUTINE field_parameter_set_update_constant_intg
23725 
23726  !
23727  !================================================================================================================================
23728  !
23729 
23731  SUBROUTINE field_parameter_set_update_constant_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
23732 
23733  !Argument variables
23734  TYPE(field_type), POINTER :: field
23735  INTEGER(INTG), INTENT(IN) :: variable_type
23736  INTEGER(INTG), INTENT(IN) :: field_set_type
23737  INTEGER(INTG), INTENT(IN) :: component_number
23738  REAL(SP), INTENT(IN) :: VALUE
23739  INTEGER(INTG), INTENT(OUT) :: err
23740  TYPE(varying_string), INTENT(OUT) :: error
23741  !Local Variables
23742  INTEGER(INTG) :: ny
23743  TYPE(field_parameter_set_type), POINTER :: parameter_set
23744  TYPE(field_variable_type), POINTER :: field_variable
23745  TYPE(varying_string) :: local_error
23746 
23747  enters("FIELD_PARAMETER_SET_UPDATE_CONSTANT_SP",err,error,*999)
23748 
23749  IF(ASSOCIATED(field)) THEN
23750  IF(field%FIELD_FINISHED) THEN
23751  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
23752  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
23753  IF(ASSOCIATED(field_variable)) THEN
23754  IF(field_variable%DATA_TYPE==field_sp_type) THEN
23755  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
23756  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
23757  IF(ASSOCIATED(parameter_set)) THEN
23758  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
23759  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
23760  CASE(field_constant_interpolation)
23761  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
23762  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
23763  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
23764  ELSE
23765  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
23766  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
23767  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
23768  & " does not have any constant parameters."
23769  CALL flagerror(local_error,err,error,*999)
23770  ENDIF
23771  CASE(field_element_based_interpolation)
23772  local_error="Can not update by constant for component number "// &
23773  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23774  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23775  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
23776 
23777  CALL flagerror(local_error,err,error,*999)
23778  CASE(field_node_based_interpolation)
23779  local_error="Can not update by constant for component number "// &
23780  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23781  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23782  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
23783  CALL flagerror(local_error,err,error,*999)
23784  CASE(field_grid_point_based_interpolation)
23785  local_error="Can not update by constant for component number "// &
23786  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23787  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23788  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
23789  CALL flagerror(local_error,err,error,*999)
23790  CASE(field_gauss_point_based_interpolation)
23791  local_error="Can not update by constant for component number "// &
23792  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23793  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23794  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
23795  CALL flagerror(local_error,err,error,*999)
23796  CASE(field_data_point_based_interpolation)
23797  local_error="Can not add element for component number "// &
23798  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23799  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23800  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
23801  CALL flagerror(local_error,err,error,*999)
23802  CASE DEFAULT
23803  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
23804  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
23805  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
23806  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
23807  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23808  CALL flagerror(local_error,err,error,*999)
23809  END SELECT
23810  ELSE
23811  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
23812  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
23813  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
23814  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
23815  & " components."
23816  CALL flagerror(local_error,err,error,*999)
23817  ENDIF
23818  ELSE
23819  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
23820  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23821  CALL flagerror(local_error,err,error,*999)
23822  ENDIF
23823  ELSE
23824  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
23825  & " is invalid. The field parameter set type must be between 1 and "// &
23826  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
23827  CALL flagerror(local_error,err,error,*999)
23828  ENDIF
23829  ELSE
23830  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
23831  & " does not correspond to the single precision data type of the given value."
23832  CALL flagerror(local_error,err,error,*999)
23833  ENDIF
23834  ELSE
23835  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
23836  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23837  CALL flagerror(local_error,err,error,*999)
23838  ENDIF
23839  ELSE
23840  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
23841  & " is invalid. The variable type must be between 1 and "// &
23842  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
23843  CALL flagerror(local_error,err,error,*999)
23844  ENDIF
23845  ELSE
23846  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
23847  & " has not been finished."
23848  CALL flagerror(local_error,err,error,*999)
23849  ENDIF
23850  ELSE
23851  CALL flagerror("Field is not associated.",err,error,*999)
23852  ENDIF
23853 
23854  exits("FIELD_PARAMETER_SET_UPDATE_CONSTANT_SP")
23855  RETURN
23856 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_CONSTANT_SP",err,error)
23857  RETURN 1
23858  END SUBROUTINE field_parameter_set_update_constant_sp
23859 
23860  !
23861  !================================================================================================================================
23862  !
23863 
23865  SUBROUTINE field_parameter_set_update_constant_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
23866 
23867  !Argument variables
23868  TYPE(field_type), POINTER :: field
23869  INTEGER(INTG), INTENT(IN) :: variable_type
23870  INTEGER(INTG), INTENT(IN) :: field_set_type
23871  INTEGER(INTG), INTENT(IN) :: component_number
23872  REAL(DP), INTENT(IN) :: VALUE
23873  INTEGER(INTG), INTENT(OUT) :: err
23874  TYPE(varying_string), INTENT(OUT) :: error
23875  !Local Variables
23876  INTEGER(INTG) :: ny
23877  TYPE(field_parameter_set_type), POINTER :: parameter_set
23878  TYPE(field_variable_type), POINTER :: field_variable
23879  TYPE(varying_string) :: local_error
23880 
23881  enters("FIELD_PARAMETER_SET_UPDATE_CONSTANT_DP",err,error,*999)
23882 
23883  IF(ASSOCIATED(field)) THEN
23884  IF(field%FIELD_FINISHED) THEN
23885  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
23886  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
23887  IF(ASSOCIATED(field_variable)) THEN
23888  IF(field_variable%DATA_TYPE==field_dp_type) THEN
23889  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
23890  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
23891  IF(ASSOCIATED(parameter_set)) THEN
23892  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
23893  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
23894  CASE(field_constant_interpolation)
23895  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
23896  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
23897  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
23898  ELSE
23899  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
23900  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
23901  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
23902  & " does not have any constant parameters."
23903  CALL flagerror(local_error,err,error,*999)
23904  ENDIF
23905  CASE(field_element_based_interpolation)
23906  local_error="Can not update by constant for component number "// &
23907  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23908  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23909  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
23910  CALL flagerror(local_error,err,error,*999)
23911  CASE(field_node_based_interpolation)
23912  local_error="Can not update by constant for component number "// &
23913  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23914  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23915  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
23916  CALL flagerror(local_error,err,error,*999)
23917  CASE(field_grid_point_based_interpolation)
23918  local_error="Can not update by constant for component number "// &
23919  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23920  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23921  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
23922  CALL flagerror(local_error,err,error,*999)
23923  CASE(field_gauss_point_based_interpolation)
23924  local_error="Can not update by constant for component number "// &
23925  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23926  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23927  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
23928  CALL flagerror(local_error,err,error,*999)
23929  CASE(field_data_point_based_interpolation)
23930  local_error="Can not add element for component number "// &
23931  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
23932  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
23933  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
23934  CALL flagerror(local_error,err,error,*999)
23935  CASE DEFAULT
23936  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
23937  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
23938  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
23939  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
23940  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23941  CALL flagerror(local_error,err,error,*999)
23942  END SELECT
23943  ELSE
23944  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
23945  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
23946  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
23947  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
23948  & " components."
23949  CALL flagerror(local_error,err,error,*999)
23950  ENDIF
23951  ELSE
23952  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
23953  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23954  CALL flagerror(local_error,err,error,*999)
23955  ENDIF
23956  ELSE
23957  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
23958  & " is invalid. The field parameter set type must be between 1 and "// &
23959  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
23960  CALL flagerror(local_error,err,error,*999)
23961  ENDIF
23962  ELSE
23963  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
23964  & " does not correspond to the double precision data type of the given value."
23965  CALL flagerror(local_error,err,error,*999)
23966  ENDIF
23967  ELSE
23968  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
23969  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
23970  CALL flagerror(local_error,err,error,*999)
23971  ENDIF
23972  ELSE
23973  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
23974  & " is invalid. The variable type must be between 1 and "// &
23975  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
23976  CALL flagerror(local_error,err,error,*999)
23977  ENDIF
23978  ELSE
23979  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
23980  & " has not been finished."
23981  CALL flagerror(local_error,err,error,*999)
23982  ENDIF
23983  ELSE
23984  CALL flagerror("Field is not associated.",err,error,*999)
23985  ENDIF
23986 
23987  exits("FIELD_PARAMETER_SET_UPDATE_CONSTANT_DP")
23988  RETURN
23989 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_CONSTANT_DP",err,error)
23990  RETURN 1
23991  END SUBROUTINE field_parameter_set_update_constant_dp
23992 
23993  !
23994  !================================================================================================================================
23995  !
23996 
23998  SUBROUTINE field_parameter_set_update_constant_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,COMPONENT_NUMBER,VALUE,ERR,ERROR,*)
23999 
24000  !Argument variables
24001  TYPE(field_type), POINTER :: field
24002  INTEGER(INTG), INTENT(IN) :: variable_type
24003  INTEGER(INTG), INTENT(IN) :: field_set_type
24004  INTEGER(INTG), INTENT(IN) :: component_number
24005  LOGICAL, INTENT(IN) :: VALUE
24006  INTEGER(INTG), INTENT(OUT) :: err
24007  TYPE(varying_string), INTENT(OUT) :: error
24008  !Local Variables
24009  INTEGER(INTG) :: ny
24010  TYPE(field_parameter_set_type), POINTER :: parameter_set
24011  TYPE(field_variable_type), POINTER :: field_variable
24012  TYPE(varying_string) :: local_error
24013 
24014  enters("FIELD_PARAMETER_SET_UPDATE_CONSTANT_L",err,error,*999)
24015 
24016  IF(ASSOCIATED(field)) THEN
24017  IF(field%FIELD_FINISHED) THEN
24018  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
24019  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
24020  IF(ASSOCIATED(field_variable)) THEN
24021  IF(field_variable%DATA_TYPE==field_l_type) THEN
24022  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
24023  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
24024  IF(ASSOCIATED(parameter_set)) THEN
24025  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
24026  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
24027  CASE(field_constant_interpolation)
24028  IF(field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NUMBER_OF_CONSTANT_PARAMETERS>0) THEN
24029  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%CONSTANT_PARAM2DOF_MAP
24030  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
24031  ELSE
24032  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
24033  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
24034  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
24035  & " does not have any constant parameters."
24036  CALL flagerror(local_error,err,error,*999)
24037  ENDIF
24038  CASE(field_element_based_interpolation)
24039  local_error="Can not update by constant for component number "// &
24040  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
24041  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
24042  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
24043  CALL flagerror(local_error,err,error,*999)
24044  CASE(field_node_based_interpolation)
24045  local_error="Can not update by constant for component number "// &
24046  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
24047  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
24048  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
24049  CALL flagerror(local_error,err,error,*999)
24050  CASE(field_grid_point_based_interpolation)
24051  local_error="Can not update by constant for component number "// &
24052  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
24053  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
24054  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
24055  CALL flagerror(local_error,err,error,*999)
24056  CASE(field_gauss_point_based_interpolation)
24057  local_error="Can not update by constant for component number "// &
24058  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
24059  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
24060  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
24061  CALL flagerror(local_error,err,error,*999)
24062  CASE(field_data_point_based_interpolation)
24063  local_error="Can not add element for component number "// &
24064  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
24065  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
24066  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
24067  CALL flagerror(local_error,err,error,*999)
24068  CASE DEFAULT
24069  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
24070  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
24071  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
24072  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
24073  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24074  CALL flagerror(local_error,err,error,*999)
24075  END SELECT
24076  ELSE
24077  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
24078  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
24079  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
24080  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
24081  & " components."
24082  CALL flagerror(local_error,err,error,*999)
24083  ENDIF
24084  ELSE
24085  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
24086  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24087  CALL flagerror(local_error,err,error,*999)
24088  ENDIF
24089  ELSE
24090  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
24091  & " is invalid. The field parameter set type must be between 1 and "// &
24092  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
24093  CALL flagerror(local_error,err,error,*999)
24094  ENDIF
24095  ELSE
24096  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
24097  & " does not correspond to the logical data type of the given value."
24098  CALL flagerror(local_error,err,error,*999)
24099  ENDIF
24100  ELSE
24101  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
24102  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24103  CALL flagerror(local_error,err,error,*999)
24104  ENDIF
24105  ELSE
24106  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
24107  & " is invalid. The variable type must be between 1 and "// &
24108  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
24109  CALL flagerror(local_error,err,error,*999)
24110  ENDIF
24111  ELSE
24112  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
24113  & " has not been finished."
24114  CALL flagerror(local_error,err,error,*999)
24115  ENDIF
24116  ELSE
24117  CALL flagerror("Field is not associated.",err,error,*999)
24118  ENDIF
24119 
24120  exits("FIELD_PARAMETER_SET_UPDATE_CONSTANT_L")
24121  RETURN
24122 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_CONSTANT_L",err,error)
24123  RETURN 1
24124  END SUBROUTINE field_parameter_set_update_constant_l
24125 
24126  !
24127  !================================================================================================================================
24128  !
24129 
24131  SUBROUTINE field_parametersetupdatedatapointintg(field,variableType,fieldSetType,userDataPointNumber,componentNumber,value, &
24132  & err,error,*)
24133 
24134  !Argument variables
24135  TYPE(field_type), POINTER :: field
24136  INTEGER(INTG), INTENT(IN) :: variabletype
24137  INTEGER(INTG), INTENT(IN) :: fieldsettype
24138  INTEGER(INTG), INTENT(IN) :: userdatapointnumber
24139  INTEGER(INTG), INTENT(IN) :: componentnumber
24140  INTEGER(INTG), INTENT(IN) :: value
24141  INTEGER(INTG), INTENT(OUT) :: err
24142  TYPE(varying_string), INTENT(OUT) :: error
24143  !Local Variables
24144  INTEGER(INTG) :: decompositionlocaldatapointnumber,dofidx
24145  LOGICAL :: userdatapointexists,ghostdatapoint
24146  TYPE(decomposition_type), POINTER :: decomposition
24147  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
24148  TYPE(field_parameter_set_type), POINTER :: parameterset
24149  TYPE(field_variable_type), POINTER :: fieldvariable
24150  TYPE(varying_string) :: localerror
24151 
24152  enters("Field_ParameterSetUpdateDataPointIntg",err,error,*999)
24153 
24154  IF(ASSOCIATED(field)) THEN
24155  IF(field%FIELD_FINISHED) THEN
24156  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
24157  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
24158  IF(ASSOCIATED(fieldvariable)) THEN
24159  IF(fieldvariable%DATA_TYPE==field_intg_type) THEN
24160  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
24161  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
24162  IF(ASSOCIATED(parameterset)) THEN
24163  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
24164  SELECT CASE(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE)
24165  CASE(field_constant_interpolation)
24166  localerror="Can not Update by data point for component number "// &
24167  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24168  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24169  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
24170  CALL flagerror(localerror,err,error,*999)
24171  CASE(field_element_based_interpolation)
24172  localerror="Can not Update by data point for component number "// &
24173  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24174  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24175  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
24176  CALL flagerror(localerror,err,error,*999)
24177  CASE(field_node_based_interpolation)
24178  localerror="Can not Update by data point for component number "// &
24179  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24180  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24181  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
24182  CALL flagerror(localerror,err,error,*999)
24183  CASE(field_grid_point_based_interpolation)
24184  localerror="Can not Update by data point for component number "// &
24185  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24186  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24187  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
24188  CALL flagerror(localerror,err,error,*999)
24189  CASE(field_gauss_point_based_interpolation)
24190  localerror="Can not Update by data point for component number "// &
24191  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24192  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24193  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
24194  CALL flagerror(localerror,err,error,*999)
24195  CASE(field_data_point_based_interpolation)
24196  decomposition=>field%DECOMPOSITION
24197  IF(ASSOCIATED(decomposition)) THEN
24198  decompositiontopology=>decomposition%TOPOLOGY
24199  IF(ASSOCIATED(decompositiontopology)) THEN
24200  CALL decompositiontopology_datapointcheckexists(decompositiontopology,userdatapointnumber, &
24201  & userdatapointexists,decompositionlocaldatapointnumber,ghostdatapoint,err,error,*999)
24202  IF(userdatapointexists) THEN
24203  dofidx=fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
24204  & data_point_param2dof_map%DATA_POINTS(decompositionlocaldatapointnumber)
24205  CALL distributed_vector_values_set(parameterset%PARAMETERS,dofidx,value,err,error,*999)
24206  ELSE
24207  localerror="The specified user data point number of "// &
24208  & trim(number_to_vstring(userdatapointnumber,"*",err,error))// &
24209  & " does not exist in the decomposition for field component number "// &
24210  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
24211  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24212  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24213  CALL flagerror(localerror,err,error,*999)
24214  ENDIF
24215  ELSE
24216  CALL flagerror("Field decomposition topology is not associated.",err,error,*999)
24217  ENDIF
24218  ELSE
24219  CALL flagerror("Field decomposition is not associated.",err,error,*999)
24220  ENDIF
24221  CASE DEFAULT
24222  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
24223  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
24224  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
24225  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
24226  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24227  CALL flagerror(localerror,err,error,*999)
24228  END SELECT
24229  ELSE
24230  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
24231  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
24232  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
24233  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
24234  CALL flagerror(localerror,err,error,*999)
24235  ENDIF
24236  ELSE
24237  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
24238  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
24239  CALL flagerror(localerror,err,error,*999)
24240  ENDIF
24241  ELSE
24242  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
24243  & " is invalid. The field parameter set type must be between 1 and "// &
24244  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
24245  CALL flagerror(localerror,err,error,*999)
24246  ENDIF
24247  ELSE
24248  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
24249  & " does not correspond to the integer data type of the given value."
24250  CALL flagerror(localerror,err,error,*999)
24251  ENDIF
24252  ELSE
24253  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
24254  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24255  CALL flagerror(localerror,err,error,*999)
24256  ENDIF
24257  ELSE
24258  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
24259  & " is invalid. The variable type must be between 1 and "// &
24260  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
24261  CALL flagerror(localerror,err,error,*999)
24262  ENDIF
24263  ELSE
24264  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
24265  & " has not been finished."
24266  CALL flagerror(localerror,err,error,*999)
24267  ENDIF
24268  ELSE
24269  CALL flagerror("Field is not associated.",err,error,*999)
24270  ENDIF
24271 
24272  exits("Field_ParameterSetUpdateDataPointIntg")
24273  RETURN
24274 999 errorsexits("Field_ParameterSetUpdateDataPointIntg",err,error)
24275  RETURN 1
24276  END SUBROUTINE field_parametersetupdatedatapointintg
24277 
24278  !
24279  !================================================================================================================================
24280  !
24281 
24283  SUBROUTINE field_parametersetupdatedatapointsp(field,variableType,fieldSetType,userDataPointNumber,componentNumber,value, &
24284  & err,error,*)
24285 
24286  !Argument variables
24287  TYPE(field_type), POINTER :: field
24288  INTEGER(INTG), INTENT(IN) :: variabletype
24289  INTEGER(INTG), INTENT(IN) :: fieldsettype
24290  INTEGER(INTG), INTENT(IN) :: userdatapointnumber
24291  INTEGER(INTG), INTENT(IN) :: componentnumber
24292  REAL(SP), INTENT(IN) :: value
24293  INTEGER(INTG), INTENT(OUT) :: err
24294  TYPE(varying_string), INTENT(OUT) :: error
24295  !Local Variables
24296  INTEGER(INTG) :: decompositionlocaldatapointnumber,dofidx
24297  LOGICAL :: userdatapointexists,ghostdatapoint
24298  TYPE(decomposition_type), POINTER :: decomposition
24299  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
24300  TYPE(field_parameter_set_type), POINTER :: parameterset
24301  TYPE(field_variable_type), POINTER :: fieldvariable
24302  TYPE(varying_string) :: localerror
24303 
24304  enters("Field_ParameterSetUpdateDataPointSP",err,error,*999)
24305 
24306  IF(ASSOCIATED(field)) THEN
24307  IF(field%FIELD_FINISHED) THEN
24308  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
24309  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
24310  IF(ASSOCIATED(fieldvariable)) THEN
24311  IF(fieldvariable%DATA_TYPE==field_sp_type) THEN
24312  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
24313  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
24314  IF(ASSOCIATED(parameterset)) THEN
24315  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
24316  SELECT CASE(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE)
24317  CASE(field_constant_interpolation)
24318  localerror="Can not Update by data point for component number "// &
24319  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24320  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24321  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
24322  CALL flagerror(localerror,err,error,*999)
24323  CASE(field_element_based_interpolation)
24324  localerror="Can not Update by data point for component number "// &
24325  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24326  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24327  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
24328  CALL flagerror(localerror,err,error,*999)
24329  CASE(field_node_based_interpolation)
24330  localerror="Can not Update by data point for component number "// &
24331  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24332  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24333  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
24334  CALL flagerror(localerror,err,error,*999)
24335  CASE(field_grid_point_based_interpolation)
24336  localerror="Can not Update by data point for component number "// &
24337  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24338  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24339  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
24340  CALL flagerror(localerror,err,error,*999)
24341  CASE(field_gauss_point_based_interpolation)
24342  localerror="Can not Update by data point for component number "// &
24343  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24344  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24345  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
24346  CALL flagerror(localerror,err,error,*999)
24347  CASE(field_data_point_based_interpolation)
24348  decomposition=>field%DECOMPOSITION
24349  IF(ASSOCIATED(decomposition)) THEN
24350  decompositiontopology=>decomposition%TOPOLOGY
24351  IF(ASSOCIATED(decompositiontopology)) THEN
24352  CALL decompositiontopology_datapointcheckexists(decompositiontopology,userdatapointnumber, &
24353  & userdatapointexists,decompositionlocaldatapointnumber,ghostdatapoint,err,error,*999)
24354  IF(userdatapointexists) THEN
24355  dofidx=fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
24356  & data_point_param2dof_map%DATA_POINTS(decompositionlocaldatapointnumber)
24357  CALL distributed_vector_values_set(parameterset%PARAMETERS,dofidx,value,err,error,*999)
24358  ELSE
24359  localerror="The specified user data point number of "// &
24360  & trim(number_to_vstring(userdatapointnumber,"*",err,error))// &
24361  & " does not exist in the decomposition for field component number "// &
24362  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
24363  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24364  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24365  CALL flagerror(localerror,err,error,*999)
24366  ENDIF
24367  ELSE
24368  CALL flagerror("Field decomposition topology is not associated.",err,error,*999)
24369  ENDIF
24370  ELSE
24371  CALL flagerror("Field decomposition is not associated.",err,error,*999)
24372  ENDIF
24373  CASE DEFAULT
24374  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
24375  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
24376  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
24377  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
24378  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24379  CALL flagerror(localerror,err,error,*999)
24380  END SELECT
24381  ELSE
24382  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
24383  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
24384  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
24385  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
24386  CALL flagerror(localerror,err,error,*999)
24387  ENDIF
24388  ELSE
24389  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
24390  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
24391  CALL flagerror(localerror,err,error,*999)
24392  ENDIF
24393  ELSE
24394  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
24395  & " is invalid. The field parameter set type must be between 1 and "// &
24396  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
24397  CALL flagerror(localerror,err,error,*999)
24398  ENDIF
24399  ELSE
24400  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
24401  & " does not correspond to the single precision data type of the given value."
24402  CALL flagerror(localerror,err,error,*999)
24403  ENDIF
24404  ELSE
24405  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
24406  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24407  CALL flagerror(localerror,err,error,*999)
24408  ENDIF
24409  ELSE
24410  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
24411  & " is invalid. The variable type must be between 1 and "// &
24412  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
24413  CALL flagerror(localerror,err,error,*999)
24414  ENDIF
24415  ELSE
24416  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
24417  & " has not been finished."
24418  CALL flagerror(localerror,err,error,*999)
24419  ENDIF
24420  ELSE
24421  CALL flagerror("Field is not associated.",err,error,*999)
24422  ENDIF
24423 
24424  exits("Field_ParameterSetUpdateDataPointSP")
24425  RETURN
24426 999 errorsexits("Field_ParameterSetUpdateDataPointSP",err,error)
24427  RETURN 1
24428  END SUBROUTINE field_parametersetupdatedatapointsp
24429 
24430  !
24431  !================================================================================================================================
24432  !
24433 
24435  SUBROUTINE field_parametersetupdatedatapointdp(field,variableType,fieldSetType,userDataPointNumber,componentNumber,value, &
24436  & err,error,*)
24437 
24438  !Argument variables
24439  TYPE(field_type), POINTER :: field
24440  INTEGER(INTG), INTENT(IN) :: variabletype
24441  INTEGER(INTG), INTENT(IN) :: fieldsettype
24442  INTEGER(INTG), INTENT(IN) :: userdatapointnumber
24443  INTEGER(INTG), INTENT(IN) :: componentnumber
24444  REAL(DP), INTENT(IN) :: value
24445  INTEGER(INTG), INTENT(OUT) :: err
24446  TYPE(varying_string), INTENT(OUT) :: error
24447  !Local Variables
24448  INTEGER(INTG) :: decompositionlocaldatapointnumber,dofidx
24449  LOGICAL :: userdatapointexists,ghostdatapoint
24450  TYPE(decomposition_type), POINTER :: decomposition
24451  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
24452  TYPE(field_parameter_set_type), POINTER :: parameterset
24453  TYPE(field_variable_type), POINTER :: fieldvariable
24454  TYPE(varying_string) :: localerror
24455 
24456  enters("Field_ParameterSetUpdateDataPointDP",err,error,*999)
24457 
24458  IF(ASSOCIATED(field)) THEN
24459  IF(field%FIELD_FINISHED) THEN
24460  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
24461  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
24462  IF(ASSOCIATED(fieldvariable)) THEN
24463  IF(fieldvariable%DATA_TYPE==field_dp_type) THEN
24464  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
24465  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
24466  IF(ASSOCIATED(parameterset)) THEN
24467  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
24468  SELECT CASE(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE)
24469  CASE(field_constant_interpolation)
24470  localerror="Can not Update by data point for component number "// &
24471  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24472  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24473  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
24474  CALL flagerror(localerror,err,error,*999)
24475  CASE(field_element_based_interpolation)
24476  localerror="Can not Update by data point for component number "// &
24477  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24478  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24479  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
24480  CALL flagerror(localerror,err,error,*999)
24481  CASE(field_node_based_interpolation)
24482  localerror="Can not Update by data point for component number "// &
24483  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24484  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24485  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
24486  CALL flagerror(localerror,err,error,*999)
24487  CASE(field_grid_point_based_interpolation)
24488  localerror="Can not Update by data point for component number "// &
24489  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24490  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24491  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
24492  CALL flagerror(localerror,err,error,*999)
24493  CASE(field_gauss_point_based_interpolation)
24494  localerror="Can not Update by data point for component number "// &
24495  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24496  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24497  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
24498  CALL flagerror(localerror,err,error,*999)
24499  CASE(field_data_point_based_interpolation)
24500  decomposition=>field%DECOMPOSITION
24501  IF(ASSOCIATED(decomposition)) THEN
24502  decompositiontopology=>decomposition%TOPOLOGY
24503  IF(ASSOCIATED(decompositiontopology)) THEN
24504  CALL decompositiontopology_datapointcheckexists(decompositiontopology,userdatapointnumber, &
24505  & userdatapointexists,decompositionlocaldatapointnumber,ghostdatapoint,err,error,*999)
24506  IF(userdatapointexists) THEN
24507  dofidx=fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
24508  & data_point_param2dof_map%DATA_POINTS(decompositionlocaldatapointnumber)
24509  CALL distributed_vector_values_set(parameterset%PARAMETERS,dofidx,value,err,error,*999)
24510  ELSE
24511  localerror="The specified user data point number of "// &
24512  & trim(number_to_vstring(userdatapointnumber,"*",err,error))// &
24513  & " does not exist in the decomposition for field component number "// &
24514  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
24515  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24516  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24517  CALL flagerror(localerror,err,error,*999)
24518  ENDIF
24519  ELSE
24520  CALL flagerror("Field decomposition topology is not associated.",err,error,*999)
24521  ENDIF
24522  ELSE
24523  CALL flagerror("Field decomposition is not associated.",err,error,*999)
24524  ENDIF
24525  CASE DEFAULT
24526  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
24527  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
24528  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
24529  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
24530  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24531  CALL flagerror(localerror,err,error,*999)
24532  END SELECT
24533  ELSE
24534  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
24535  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
24536  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
24537  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
24538  CALL flagerror(localerror,err,error,*999)
24539  ENDIF
24540  ELSE
24541  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
24542  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
24543  CALL flagerror(localerror,err,error,*999)
24544  ENDIF
24545  ELSE
24546  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
24547  & " is invalid. The field parameter set type must be between 1 and "// &
24548  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
24549  CALL flagerror(localerror,err,error,*999)
24550  ENDIF
24551  ELSE
24552  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
24553  & " does not correspond to the double precision data type of the given value."
24554  CALL flagerror(localerror,err,error,*999)
24555  ENDIF
24556  ELSE
24557  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
24558  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24559  CALL flagerror(localerror,err,error,*999)
24560  ENDIF
24561  ELSE
24562  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
24563  & " is invalid. The variable type must be between 1 and "// &
24564  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
24565  CALL flagerror(localerror,err,error,*999)
24566  ENDIF
24567  ELSE
24568  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
24569  & " has not been finished."
24570  CALL flagerror(localerror,err,error,*999)
24571  ENDIF
24572  ELSE
24573  CALL flagerror("Field is not associated.",err,error,*999)
24574  ENDIF
24575 
24576  exits("Field_ParameterSetUpdateDataPointDP")
24577  RETURN
24578 999 errorsexits("Field_ParameterSetUpdateDataPointDP",err,error)
24579  RETURN 1
24580  END SUBROUTINE field_parametersetupdatedatapointdp
24581 
24582  !
24583  !================================================================================================================================
24584  !
24585 
24587  SUBROUTINE field_parametersetupdatedatapointl(field,variableType,fieldSetType,userDataPointNumber,componentNumber,value, &
24588  & err,error,*)
24589 
24590  !Argument variables
24591  TYPE(field_type), POINTER :: field
24592  INTEGER(INTG), INTENT(IN) :: variabletype
24593  INTEGER(INTG), INTENT(IN) :: fieldsettype
24594  INTEGER(INTG), INTENT(IN) :: userdatapointnumber
24595  INTEGER(INTG), INTENT(IN) :: componentnumber
24596  LOGICAL, INTENT(IN) :: value
24597  INTEGER(INTG), INTENT(OUT) :: err
24598  TYPE(varying_string), INTENT(OUT) :: error
24599  !Local Variables
24600  INTEGER(INTG) :: decompositionlocaldatapointnumber,dofidx
24601  LOGICAL :: userdatapointexists,ghostdatapoint
24602  TYPE(decomposition_type), POINTER :: decomposition
24603  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
24604  TYPE(field_parameter_set_type), POINTER :: parameterset
24605  TYPE(field_variable_type), POINTER :: fieldvariable
24606  TYPE(varying_string) :: localerror
24607 
24608  enters("Field_ParameterSetUpdateDataPointL",err,error,*999)
24609 
24610  IF(ASSOCIATED(field)) THEN
24611  IF(field%FIELD_FINISHED) THEN
24612  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
24613  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
24614  IF(ASSOCIATED(fieldvariable)) THEN
24615  IF(fieldvariable%DATA_TYPE==field_l_type) THEN
24616  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
24617  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
24618  IF(ASSOCIATED(parameterset)) THEN
24619  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
24620  SELECT CASE(fieldvariable%COMPONENTS(componentnumber)%INTERPOLATION_TYPE)
24621  CASE(field_constant_interpolation)
24622  localerror="Can not Update by data point for component number "// &
24623  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24624  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24625  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
24626  CALL flagerror(localerror,err,error,*999)
24627  CASE(field_element_based_interpolation)
24628  localerror="Can not Update by data point for component number "// &
24629  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24630  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24631  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
24632  CALL flagerror(localerror,err,error,*999)
24633  CASE(field_node_based_interpolation)
24634  localerror="Can not Update by data point for component number "// &
24635  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24636  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24637  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
24638  CALL flagerror(localerror,err,error,*999)
24639  CASE(field_grid_point_based_interpolation)
24640  localerror="Can not Update by data point for component number "// &
24641  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24642  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24643  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
24644  CALL flagerror(localerror,err,error,*999)
24645  CASE(field_gauss_point_based_interpolation)
24646  localerror="Can not Update by data point for component number "// &
24647  & trim(number_to_vstring(componentnumber,"*",err,error))//" of variable type "// &
24648  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24649  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
24650  CALL flagerror(localerror,err,error,*999)
24651  CASE(field_data_point_based_interpolation)
24652  decomposition=>field%DECOMPOSITION
24653  IF(ASSOCIATED(decomposition)) THEN
24654  decompositiontopology=>decomposition%TOPOLOGY
24655  IF(ASSOCIATED(decompositiontopology)) THEN
24656  CALL decompositiontopology_datapointcheckexists(decompositiontopology,userdatapointnumber, &
24657  & userdatapointexists,decompositionlocaldatapointnumber,ghostdatapoint,err,error,*999)
24658  IF(userdatapointexists) THEN
24659  dofidx=fieldvariable%COMPONENTS(componentnumber)%PARAM_TO_DOF_MAP% &
24660  & data_point_param2dof_map%DATA_POINTS(decompositionlocaldatapointnumber)
24661  CALL distributed_vector_values_set(parameterset%PARAMETERS,dofidx,value,err,error,*999)
24662  ELSE
24663  localerror="The specified user data point number of "// &
24664  & trim(number_to_vstring(userdatapointnumber,"*",err,error))// &
24665  & " does not exist in the decomposition for field component number "// &
24666  & trim(number_to_vstring(componentnumber,"*",err,error))//" of field variable type "// &
24667  & trim(number_to_vstring(variabletype,"*",err,error))//" of field number "// &
24668  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24669  CALL flagerror(localerror,err,error,*999)
24670  ENDIF
24671  ELSE
24672  CALL flagerror("Field decomposition topology is not associated.",err,error,*999)
24673  ENDIF
24674  ELSE
24675  CALL flagerror("Field decomposition is not associated.",err,error,*999)
24676  ENDIF
24677  CASE DEFAULT
24678  localerror="The field component interpolation type of "//trim(number_to_vstring(fieldvariable% &
24679  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
24680  & " is invalid for component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
24681  & " of variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
24682  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24683  CALL flagerror(localerror,err,error,*999)
24684  END SELECT
24685  ELSE
24686  localerror="Component number "//trim(number_to_vstring(componentnumber,"*",err,error))// &
24687  & " is invalid for variable type "//trim(number_to_vstring(variabletype,"*",err,error))// &
24688  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
24689  & trim(number_to_vstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
24690  CALL flagerror(localerror,err,error,*999)
24691  ENDIF
24692  ELSE
24693  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
24694  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
24695  CALL flagerror(localerror,err,error,*999)
24696  ENDIF
24697  ELSE
24698  localerror="The field parameter set type of "//trim(number_to_vstring(fieldsettype,"*",err,error))// &
24699  & " is invalid. The field parameter set type must be between 1 and "// &
24700  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
24701  CALL flagerror(localerror,err,error,*999)
24702  ENDIF
24703  ELSE
24704  localerror="The field variable data type of "//trim(number_to_vstring(fieldvariable%DATA_TYPE,"*",err,error))// &
24705  & " does not correspond to the logical data type of the given value."
24706  CALL flagerror(localerror,err,error,*999)
24707  ENDIF
24708  ELSE
24709  localerror="The specified field variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
24710  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24711  CALL flagerror(localerror,err,error,*999)
24712  ENDIF
24713  ELSE
24714  localerror="The specified variable type of "//trim(number_to_vstring(variabletype,"*",err,error))// &
24715  & " is invalid. The variable type must be between 1 and "// &
24716  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
24717  CALL flagerror(localerror,err,error,*999)
24718  ENDIF
24719  ELSE
24720  localerror="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
24721  & " has not been finished."
24722  CALL flagerror(localerror,err,error,*999)
24723  ENDIF
24724  ELSE
24725  CALL flagerror("Field is not associated.",err,error,*999)
24726  ENDIF
24727 
24728  exits("Field_ParameterSetUpdateDataPointL")
24729  RETURN
24730 999 errorsexits("Field_ParameterSetUpdateDataPointL",err,error)
24731  RETURN 1
24732  END SUBROUTINE field_parametersetupdatedatapointl
24733 
24734  !
24735  !================================================================================================================================
24736  !
24737 
24739  SUBROUTINE field_parameter_set_update_local_dof_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
24740 
24741  !Argument variables
24742  TYPE(field_type), POINTER :: field
24743  INTEGER(INTG), INTENT(IN) :: variable_type
24744  INTEGER(INTG), INTENT(IN) :: field_set_type
24745  INTEGER(INTG), INTENT(IN) :: dof_number
24746  INTEGER(INTG), INTENT(IN) :: VALUE
24747  INTEGER(INTG), INTENT(OUT) :: err
24748  TYPE(varying_string), INTENT(OUT) :: error
24749  !Local Variables
24750  TYPE(field_parameter_set_type), POINTER :: parameter_set
24751  TYPE(field_variable_type), POINTER :: field_variable
24752  TYPE(varying_string) :: local_error
24753 
24754  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_INTG",err,error,*999)
24755 
24756 !!TODO: Allow multiple dof number and values updates.
24757  IF(ASSOCIATED(field)) THEN
24758  IF(field%FIELD_FINISHED) THEN
24759  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
24760  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
24761  IF(ASSOCIATED(field_variable)) THEN
24762  IF(field_variable%DATA_TYPE==field_intg_type) THEN
24763  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
24764  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
24765  IF(ASSOCIATED(parameter_set)) THEN
24766 !!TODO: Allow to specify a global number and then have it all update accordingly???
24767  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL) THEN
24768  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
24769  ELSE
24770  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
24771  & " is invalid. It must be >0 and <="// &
24772  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL,"*",err,error))// &
24773  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24774  CALL flagerror(local_error,err,error,*999)
24775  ENDIF
24776  ELSE
24777  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
24778  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24779  CALL flagerror(local_error,err,error,*999)
24780  ENDIF
24781  ELSE
24782  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
24783  & " is invalid. The field parameter set type must be between 1 and "// &
24784  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
24785  CALL flagerror(local_error,err,error,*999)
24786  ENDIF
24787  ELSE
24788  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
24789  & " does not correspond to the integer data type of the given value."
24790  CALL flagerror(local_error,err,error,*999)
24791  ENDIF
24792  ELSE
24793  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
24794  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24795  CALL flagerror(local_error,err,error,*999)
24796  ENDIF
24797  ELSE
24798  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
24799  & " is invalid. The variable type must be between 1 and "// &
24800  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
24801  CALL flagerror(local_error,err,error,*999)
24802  ENDIF
24803  ELSE
24804  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
24805  & " has not been finished."
24806  CALL flagerror(local_error,err,error,*999)
24807  ENDIF
24808  ELSE
24809  CALL flagerror("Field is not associated.",err,error,*999)
24810  ENDIF
24811 
24812  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_INTG")
24813  RETURN
24814 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_INTG",err,error)
24815  RETURN 1
24816  END SUBROUTINE field_parameter_set_update_local_dof_intg
24817 
24818  !
24819  !================================================================================================================================
24820  !
24821 
24823  SUBROUTINE field_parameter_set_update_local_dof_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
24824 
24825  !Argument variables
24826  TYPE(field_type), POINTER :: field
24827  INTEGER(INTG), INTENT(IN) :: variable_type
24828  INTEGER(INTG), INTENT(IN) :: field_set_type
24829  INTEGER(INTG), INTENT(IN) :: dof_number
24830  REAL(SP), INTENT(IN) :: VALUE
24831  INTEGER(INTG), INTENT(OUT) :: err
24832  TYPE(varying_string), INTENT(OUT) :: error
24833  !Local Variables
24834  TYPE(field_parameter_set_type), POINTER :: parameter_set
24835  TYPE(field_variable_type), POINTER :: field_variable
24836  TYPE(varying_string) :: local_error
24837 
24838  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_SP",err,error,*999)
24839 
24840 !!TODO: Allow multiple dof number and values updates.
24841  IF(ASSOCIATED(field)) THEN
24842  IF(field%FIELD_FINISHED) THEN
24843  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
24844  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
24845  IF(ASSOCIATED(field_variable)) THEN
24846  IF(field_variable%DATA_TYPE==field_sp_type) THEN
24847  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
24848  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
24849  IF(ASSOCIATED(parameter_set)) THEN
24850 !!TODO: Allow to specify a global number and then have it all update accordingly???
24851  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL) THEN
24852  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
24853  ELSE
24854  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
24855  & " is invalid. It must be >0 and <="// &
24856  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL,"*",err,error))// &
24857  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24858  CALL flagerror(local_error,err,error,*999)
24859  ENDIF
24860  ELSE
24861  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
24862  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24863  CALL flagerror(local_error,err,error,*999)
24864  ENDIF
24865  ELSE
24866  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
24867  & " is invalid. The field parameter set type must be between 1 and "// &
24868  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
24869  CALL flagerror(local_error,err,error,*999)
24870  ENDIF
24871  ELSE
24872  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
24873  & " does not correspond to the single precision data type of the given value."
24874  CALL flagerror(local_error,err,error,*999)
24875  ENDIF
24876  ELSE
24877  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
24878  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24879  CALL flagerror(local_error,err,error,*999)
24880  ENDIF
24881  ELSE
24882  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
24883  & " is invalid. The variable type must be between 1 and "// &
24884  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
24885  CALL flagerror(local_error,err,error,*999)
24886  ENDIF
24887  ELSE
24888  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
24889  & " has not been finished."
24890  CALL flagerror(local_error,err,error,*999)
24891  ENDIF
24892  ELSE
24893  CALL flagerror("Field is not associated.",err,error,*999)
24894  ENDIF
24895 
24896  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_SP")
24897  RETURN
24898 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_SP",err,error)
24899  RETURN 1
24900  END SUBROUTINE field_parameter_set_update_local_dof_sp
24901 
24902  !
24903  !================================================================================================================================
24904  !
24905 
24907  SUBROUTINE field_parameter_set_update_local_dof_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
24908 
24909  !Argument variables
24910  TYPE(field_type), POINTER :: field
24911  INTEGER(INTG), INTENT(IN) :: variable_type
24912  INTEGER(INTG), INTENT(IN) :: field_set_type
24913  INTEGER(INTG), INTENT(IN) :: dof_number
24914  REAL(DP), INTENT(IN) :: VALUE
24915  INTEGER(INTG), INTENT(OUT) :: err
24916  TYPE(varying_string), INTENT(OUT) :: error
24917  !Local Variables
24918  TYPE(field_parameter_set_type), POINTER :: parameter_set
24919  TYPE(field_variable_type), POINTER :: field_variable
24920  TYPE(varying_string) :: local_error
24921 
24922  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_DP",err,error,*999)
24923 
24924 !!TODO: Allow multiple dof number and values updates.
24925  IF(ASSOCIATED(field)) THEN
24926  IF(field%FIELD_FINISHED) THEN
24927  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
24928  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
24929  IF(ASSOCIATED(field_variable)) THEN
24930  IF(field_variable%DATA_TYPE==field_dp_type) THEN
24931  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
24932  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
24933  IF(ASSOCIATED(parameter_set)) THEN
24934 !!TODO: Allow to specify a global number and then have it all update accordingly???
24935  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL) THEN
24936  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
24937  ELSE
24938  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
24939  & " is invalid. It must be >0 and <="// &
24940  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL,"*",err,error))// &
24941  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24942  CALL flagerror(local_error,err,error,*999)
24943  ENDIF
24944  ELSE
24945  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
24946  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24947  CALL flagerror(local_error,err,error,*999)
24948  ENDIF
24949  ELSE
24950  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
24951  & " is invalid. The field parameter set type must be between 1 and "// &
24952  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
24953  CALL flagerror(local_error,err,error,*999)
24954  ENDIF
24955  ELSE
24956  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
24957  & " does not correspond to the double precision data type of the given value."
24958  CALL flagerror(local_error,err,error,*999)
24959  ENDIF
24960  ELSE
24961  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
24962  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
24963  CALL flagerror(local_error,err,error,*999)
24964  ENDIF
24965  ELSE
24966  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
24967  & " is invalid. The variable type must be between 1 and "// &
24968  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
24969  CALL flagerror(local_error,err,error,*999)
24970  ENDIF
24971  ELSE
24972  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
24973  & " has not been finished."
24974  CALL flagerror(local_error,err,error,*999)
24975  ENDIF
24976  ELSE
24977  CALL flagerror("Field is not associated.",err,error,*999)
24978  ENDIF
24979 
24980  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_DP")
24981  RETURN
24982 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_DP",err,error)
24983  RETURN 1
24984  END SUBROUTINE field_parameter_set_update_local_dof_dp
24985 
24986  !
24987  !================================================================================================================================
24988  !
24989 
24991  SUBROUTINE field_parameter_set_update_local_dof_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DOF_NUMBER,VALUE,ERR,ERROR,*)
24992 
24993  !Argument variables
24994  TYPE(field_type), POINTER :: field
24995  INTEGER(INTG), INTENT(IN) :: variable_type
24996  INTEGER(INTG), INTENT(IN) :: field_set_type
24997  INTEGER(INTG), INTENT(IN) :: dof_number
24998  LOGICAL, INTENT(IN) :: VALUE
24999  INTEGER(INTG), INTENT(OUT) :: err
25000  TYPE(varying_string), INTENT(OUT) :: error
25001  !Local Variables
25002  TYPE(field_parameter_set_type), POINTER :: parameter_set
25003  TYPE(field_variable_type), POINTER :: field_variable
25004  TYPE(varying_string) :: local_error
25005 
25006  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_L",err,error,*999)
25007 
25008 !!TODO: Allow multiple dof number and values updates.
25009  IF(ASSOCIATED(field)) THEN
25010  IF(field%FIELD_FINISHED) THEN
25011  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
25012  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
25013  IF(ASSOCIATED(field_variable)) THEN
25014  IF(field_variable%DATA_TYPE==field_l_type) THEN
25015  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
25016  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
25017  IF(ASSOCIATED(parameter_set)) THEN
25018 !!TODO: Allow to specify a global number and then have it all update accordingly???
25019  IF(dof_number>0.AND.dof_number<=field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL) THEN
25020  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_number,VALUE,err,error,*999)
25021  ELSE
25022  local_error="The field dof number of "//trim(number_to_vstring(dof_number,"*",err,error))// &
25023  & " is invalid. It must be >0 and <="// &
25024  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL,"*",err,error))// &
25025  & " for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25026  CALL flagerror(local_error,err,error,*999)
25027  ENDIF
25028  ELSE
25029  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25030  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25031  CALL flagerror(local_error,err,error,*999)
25032  ENDIF
25033  ELSE
25034  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25035  & " is invalid. The field parameter set type must be between 1 and "// &
25036  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
25037  CALL flagerror(local_error,err,error,*999)
25038  ENDIF
25039  ELSE
25040  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
25041  & " does not correspond to the logical data type of the given value."
25042  CALL flagerror(local_error,err,error,*999)
25043  ENDIF
25044  ELSE
25045  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25046  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25047  CALL flagerror(local_error,err,error,*999)
25048  ENDIF
25049  ELSE
25050  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25051  & " is invalid. The variable type must be between 1 and "// &
25052  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
25053  CALL flagerror(local_error,err,error,*999)
25054  ENDIF
25055  ELSE
25056  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
25057  & " has not been finished."
25058  CALL flagerror(local_error,err,error,*999)
25059  ENDIF
25060  ELSE
25061  CALL flagerror("Field is not associated.",err,error,*999)
25062  ENDIF
25063 
25064  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_L")
25065  RETURN
25066 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_L",err,error)
25067  RETURN 1
25068  END SUBROUTINE field_parameter_set_update_local_dof_l
25069 
25070  !
25071  !================================================================================================================================
25072  !
25073 
25075  SUBROUTINE field_parameter_set_update_local_dofs_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VALUES,ERR,ERROR,*)
25076 
25077  !Argument variables
25078  TYPE(field_type), POINTER :: field
25079  INTEGER(INTG), INTENT(IN) :: variable_type
25080  INTEGER(INTG), INTENT(IN) :: field_set_type
25081  REAL(DP), INTENT(IN) :: values(:)
25082  INTEGER(INTG), INTENT(OUT) :: err
25083  TYPE(varying_string), INTENT(OUT) :: error
25084  !Local Variables
25085  INTEGER(INTG) :: dof
25086  TYPE(field_parameter_set_type), POINTER :: parameter_set
25087  TYPE(field_variable_type), POINTER :: field_variable
25088  TYPE(varying_string) :: local_error
25089 
25090  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOFS_DP",err,error,*999)
25091 
25092  IF(ASSOCIATED(field)) THEN
25093  IF(field%FIELD_FINISHED) THEN
25094  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
25095  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
25096  IF(ASSOCIATED(field_variable)) THEN
25097  IF(field_variable%DATA_TYPE==field_dp_type) THEN
25098  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
25099  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
25100  IF(ASSOCIATED(parameter_set)) THEN
25101  !\todo: Allow to specify a global number and then have it all update accordingly???
25102  IF(SIZE(values)==field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL) THEN
25103  !\todo: set the vector values directly without looping
25104  DO dof=1,field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL
25105  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof,values(dof),err,error,*999)
25106  ENDDO
25107  ELSE
25108  local_error="The size of the parameter vector ("//trim(number_to_vstring(SIZE(values),"*",err,error))// &
25109  & ") does not match the number of dofs for this field ("// &
25110  & trim(number_to_vstring(field_variable%DOMAIN_MAPPING%NUMBER_OF_LOCAL,"*",err,error))// &
25111  & ".)"
25112  CALL flagerror(local_error,err,error,*999)
25113  ENDIF
25114  ELSE
25115  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25116  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25117  CALL flagerror(local_error,err,error,*999)
25118  ENDIF
25119  ELSE
25120  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25121  & " is invalid. The field parameter set type must be between 1 and "// &
25122  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
25123  CALL flagerror(local_error,err,error,*999)
25124  ENDIF
25125  ELSE
25126  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
25127  & " does not correspond to the double precision data type of the given value."
25128  CALL flagerror(local_error,err,error,*999)
25129  ENDIF
25130  ELSE
25131  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25132  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25133  CALL flagerror(local_error,err,error,*999)
25134  ENDIF
25135  ELSE
25136  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25137  & " is invalid. The variable type must be between 1 and "// &
25138  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
25139  CALL flagerror(local_error,err,error,*999)
25140  ENDIF
25141  ELSE
25142  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
25143  & " has not been finished."
25144  CALL flagerror(local_error,err,error,*999)
25145  ENDIF
25146  ELSE
25147  CALL flagerror("Field is not associated.",err,error,*999)
25148  ENDIF
25149 
25150  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_DP")
25151  RETURN
25152 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_DOF_DP",err,error)
25153  RETURN 1
25154  END SUBROUTINE field_parameter_set_update_local_dofs_dp
25155 
25156  !
25157  !================================================================================================================================
25158  !
25159 
25161  SUBROUTINE field_parameter_set_update_element_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
25162  & VALUE,err,error,*)
25163 
25164  !Argument variables
25165  TYPE(field_type), POINTER :: field
25166  INTEGER(INTG), INTENT(IN) :: variable_type
25167  INTEGER(INTG), INTENT(IN) :: field_set_type
25168  INTEGER(INTG), INTENT(IN) :: user_element_number
25169  INTEGER(INTG), INTENT(IN) :: component_number
25170  INTEGER(INTG), INTENT(IN) :: VALUE
25171  INTEGER(INTG), INTENT(OUT) :: err
25172  TYPE(varying_string), INTENT(OUT) :: error
25173  !Local Variables
25174  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
25175  LOGICAL :: ghost_element,user_element_exists
25176  TYPE(decomposition_type), POINTER :: decomposition
25177  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
25178  TYPE(field_parameter_set_type), POINTER :: parameter_set
25179  TYPE(field_variable_type), POINTER :: field_variable
25180  TYPE(varying_string) :: local_error
25181 
25182  enters("FIELD_PARAMETER_SET_UPDATE_ELEMENT_INTG",err,error,*999)
25183 
25184  IF(ASSOCIATED(field)) THEN
25185  IF(field%FIELD_FINISHED) THEN
25186  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
25187  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
25188  IF(ASSOCIATED(field_variable)) THEN
25189  IF(field_variable%DATA_TYPE==field_intg_type) THEN
25190  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
25191  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
25192  IF(ASSOCIATED(parameter_set)) THEN
25193  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
25194  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
25195  CASE(field_constant_interpolation)
25196  local_error="Can not update by element for component number "// &
25197  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25198  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25199  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
25200  CALL flagerror(local_error,err,error,*999)
25201  CASE(field_element_based_interpolation)
25202  decomposition=>field%DECOMPOSITION
25203  IF(ASSOCIATED(decomposition)) THEN
25204  decomposition_topology=>decomposition%TOPOLOGY
25205  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
25206  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
25207  IF(user_element_exists) THEN
25208  IF(ghost_element) THEN
25209  local_error="Cannot update by element for user element "// &
25210  & trim(number_to_vstring(user_element_number,"*",err,error))//" as it is a ghost element."
25211  CALL flagerror(local_error,err,error,*999)
25212  ELSE
25213  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
25214  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
25215  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
25216  ENDIF
25217  ELSE
25218  local_error="The specified user element number of "// &
25219  & trim(number_to_vstring(user_element_number,"*",err,error))// &
25220  & " does not exist in the decomposition for field component number "// &
25221  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
25222  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25223  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25224  CALL flagerror(local_error,err,error,*999)
25225  ENDIF
25226  ELSE
25227  CALL flagerror("Field decomposition is not associated.",err,error,*999)
25228  ENDIF
25229  CASE(field_node_based_interpolation)
25230  local_error="Can not update by element for component number "// &
25231  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25232  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25233  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
25234  CALL flagerror(local_error,err,error,*999)
25235  CASE(field_grid_point_based_interpolation)
25236  local_error="Can not update by element for component number "// &
25237  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25238  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25239 
25240  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
25241  CALL flagerror(local_error,err,error,*999)
25242  CASE(field_gauss_point_based_interpolation)
25243  local_error="Can not update by element for component number "// &
25244  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25245  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25246  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
25247  CALL flagerror(local_error,err,error,*999)
25248  CASE(field_data_point_based_interpolation)
25249  local_error="Can not add element for component number "// &
25250  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25251  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25252  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
25253  CALL flagerror(local_error,err,error,*999)
25254  CASE DEFAULT
25255  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
25256  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
25257  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25258  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25259  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25260  CALL flagerror(local_error,err,error,*999)
25261  END SELECT
25262  ELSE
25263  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25264  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25265  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
25266  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
25267  CALL flagerror(local_error,err,error,*999)
25268  ENDIF
25269  ELSE
25270  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25271  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
25272  CALL flagerror(local_error,err,error,*999)
25273  ENDIF
25274  ELSE
25275  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25276  & " is invalid. The field parameter set type must be between 1 and "// &
25277  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
25278  CALL flagerror(local_error,err,error,*999)
25279  ENDIF
25280  ELSE
25281  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
25282  & " does not correspond to the integer data type of the given value."
25283  CALL flagerror(local_error,err,error,*999)
25284  ENDIF
25285  ELSE
25286  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25287  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25288  CALL flagerror(local_error,err,error,*999)
25289  ENDIF
25290  ELSE
25291  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25292  & " is invalid. The variable type must be between 1 and "// &
25293  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
25294  CALL flagerror(local_error,err,error,*999)
25295  ENDIF
25296  ELSE
25297  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
25298  & " has not been finished."
25299  CALL flagerror(local_error,err,error,*999)
25300  ENDIF
25301  ELSE
25302  CALL flagerror("Field is not associated.",err,error,*999)
25303  ENDIF
25304 
25305  exits("FIELD_PARAMETER_SET_UPDATE_ELEMENT_INTG")
25306  RETURN
25307 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_ELEMENT_INTG",err,error)
25308  RETURN 1
25309  END SUBROUTINE field_parameter_set_update_element_intg
25310 
25311  !
25312  !================================================================================================================================
25313  !
25314 
25316  SUBROUTINE field_parameter_set_update_element_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
25317  & VALUE,err,error,*)
25318 
25319  !Argument variables
25320  TYPE(field_type), POINTER :: field
25321  INTEGER(INTG), INTENT(IN) :: variable_type
25322  INTEGER(INTG), INTENT(IN) :: field_set_type
25323  INTEGER(INTG), INTENT(IN) :: user_element_number
25324  INTEGER(INTG), INTENT(IN) :: component_number
25325  REAL(SP), INTENT(IN) :: VALUE
25326  INTEGER(INTG), INTENT(OUT) :: err
25327  TYPE(varying_string), INTENT(OUT) :: error
25328  !Local Variables
25329  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
25330  LOGICAL :: ghost_element,user_element_exists
25331  TYPE(decomposition_type), POINTER :: decomposition
25332  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
25333  TYPE(field_parameter_set_type), POINTER :: parameter_set
25334  TYPE(field_variable_type), POINTER :: field_variable
25335  TYPE(varying_string) :: local_error
25336 
25337  enters("FIELD_PARAMETER_SET_UPDATE_ELEMENT_SP",err,error,*999)
25338 
25339  IF(ASSOCIATED(field)) THEN
25340  IF(field%FIELD_FINISHED) THEN
25341  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
25342  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
25343  IF(ASSOCIATED(field_variable)) THEN
25344  IF(field_variable%DATA_TYPE==field_sp_type) THEN
25345  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
25346  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
25347  IF(ASSOCIATED(parameter_set)) THEN
25348  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
25349  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
25350  CASE(field_constant_interpolation)
25351  local_error="Can not update by element for component number "// &
25352  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25353  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25354  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
25355  CALL flagerror(local_error,err,error,*999)
25356  CASE(field_element_based_interpolation)
25357  decomposition=>field%DECOMPOSITION
25358  IF(ASSOCIATED(decomposition)) THEN
25359  decomposition_topology=>decomposition%TOPOLOGY
25360  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
25361  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
25362  IF(user_element_exists) THEN
25363  IF(ghost_element) THEN
25364  local_error="Cannot update by element for user element "// &
25365  & trim(number_to_vstring(user_element_number,"*",err,error))//" as it is a ghost element."
25366  CALL flagerror(local_error,err,error,*999)
25367  ELSE
25368  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
25369  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
25370  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
25371  ENDIF
25372  ELSE
25373  local_error="The specified user element number of "// &
25374  & trim(number_to_vstring(user_element_number,"*",err,error))// &
25375  & " does not exist in the decomposition for field component number "// &
25376  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
25377  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25378  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25379  CALL flagerror(local_error,err,error,*999)
25380  ENDIF
25381  ELSE
25382  CALL flagerror("Field decomposition is not associated.",err,error,*999)
25383  ENDIF
25384  CASE(field_node_based_interpolation)
25385  local_error="Can not update by element for component number "// &
25386  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25387  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25388  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
25389  CALL flagerror(local_error,err,error,*999)
25390  CASE(field_grid_point_based_interpolation)
25391  local_error="Can not update by element for component number "// &
25392  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25393  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25394  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
25395  CALL flagerror(local_error,err,error,*999)
25396  CASE(field_gauss_point_based_interpolation)
25397  local_error="Can not update by element for component number "// &
25398  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25399  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25400  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
25401  CALL flagerror(local_error,err,error,*999)
25402  CASE(field_data_point_based_interpolation)
25403  local_error="Can not add element for component number "// &
25404  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25405  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25406  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
25407  CALL flagerror(local_error,err,error,*999)
25408  CASE DEFAULT
25409  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
25410  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
25411  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25412  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25413  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25414  CALL flagerror(local_error,err,error,*999)
25415  END SELECT
25416  ELSE
25417  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25418  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25419  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
25420  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
25421  CALL flagerror(local_error,err,error,*999)
25422  ENDIF
25423  ELSE
25424  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25425  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
25426  CALL flagerror(local_error,err,error,*999)
25427  ENDIF
25428  ELSE
25429  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25430  & " is invalid. The field parameter set type must be between 1 and "// &
25431  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
25432  CALL flagerror(local_error,err,error,*999)
25433  ENDIF
25434  ELSE
25435  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
25436  & " does not correspond to the single precision data type of the given value."
25437  CALL flagerror(local_error,err,error,*999)
25438  ENDIF
25439  ELSE
25440  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25441  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25442  CALL flagerror(local_error,err,error,*999)
25443  ENDIF
25444  ELSE
25445  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25446  & " is invalid. The variable type must be between 1 and "// &
25447  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
25448  CALL flagerror(local_error,err,error,*999)
25449  ENDIF
25450  ELSE
25451  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
25452  & " has not been finished."
25453  CALL flagerror(local_error,err,error,*999)
25454  ENDIF
25455  ELSE
25456  CALL flagerror("Field is not associated.",err,error,*999)
25457  ENDIF
25458 
25459  exits("FIELD_PARAMETER_SET_UPDATE_ELEMENT_SP")
25460  RETURN
25461 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_ELEMENT_SP",err,error)
25462  RETURN 1
25463  END SUBROUTINE field_parameter_set_update_element_sp
25464 
25465  !
25466  !================================================================================================================================
25467  !
25468 
25470  SUBROUTINE field_parameter_set_update_element_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
25471  & VALUE,err,error,*)
25472 
25473  !Argument variables
25474  TYPE(field_type), POINTER :: field
25475  INTEGER(INTG), INTENT(IN) :: variable_type
25476  INTEGER(INTG), INTENT(IN) :: field_set_type
25477  INTEGER(INTG), INTENT(IN) :: user_element_number
25478  INTEGER(INTG), INTENT(IN) :: component_number
25479  REAL(DP), INTENT(IN) :: VALUE
25480  INTEGER(INTG), INTENT(OUT) :: err
25481  TYPE(varying_string), INTENT(OUT) :: error
25482  !Local Variables
25483  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
25484  LOGICAL :: ghost_element,user_element_exists
25485  TYPE(decomposition_type), POINTER :: decomposition
25486  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
25487  TYPE(field_parameter_set_type), POINTER :: parameter_set
25488  TYPE(field_variable_type), POINTER :: field_variable
25489  TYPE(varying_string) :: local_error
25490 
25491  enters("FIELD_PARAMETER_SET_UPDATE_ELEMENT_DP",err,error,*999)
25492 
25493  IF(ASSOCIATED(field)) THEN
25494  IF(field%FIELD_FINISHED) THEN
25495  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
25496  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
25497  IF(ASSOCIATED(field_variable)) THEN
25498  IF(field_variable%DATA_TYPE==field_dp_type) THEN
25499  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
25500  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
25501  IF(ASSOCIATED(parameter_set)) THEN
25502  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
25503  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
25504  CASE(field_constant_interpolation)
25505  local_error="Can not update by element for component number "// &
25506  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25507  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25508  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
25509  CALL flagerror(local_error,err,error,*999)
25510  CASE(field_element_based_interpolation)
25511  decomposition=>field%DECOMPOSITION
25512  IF(ASSOCIATED(decomposition)) THEN
25513  decomposition_topology=>decomposition%TOPOLOGY
25514  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
25515  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
25516  IF(user_element_exists) THEN
25517  IF(ghost_element) THEN
25518  local_error="Cannot update by element for user element "// &
25519  & trim(number_to_vstring(user_element_number,"*",err,error))//" as it is a ghost element."
25520  CALL flagerror(local_error,err,error,*999)
25521  ELSE
25522  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
25523  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
25524  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
25525  ENDIF
25526  ELSE
25527  local_error="The specified user element number of "// &
25528  & trim(number_to_vstring(user_element_number,"*",err,error))// &
25529  & " does not exist in the decomposition for field component number "// &
25530  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
25531  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25532  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25533  CALL flagerror(local_error,err,error,*999)
25534  ENDIF
25535  ELSE
25536  CALL flagerror("Field decomposition is not associated.",err,error,*999)
25537  ENDIF
25538  CASE(field_node_based_interpolation)
25539  local_error="Can not update by element for component number "// &
25540  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25541  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25542  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
25543  CALL flagerror(local_error,err,error,*999)
25544  CASE(field_grid_point_based_interpolation)
25545  local_error="Can not update by element for component number "// &
25546  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25547  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25548  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
25549  CALL flagerror(local_error,err,error,*999)
25550  CASE(field_gauss_point_based_interpolation)
25551  local_error="Can not update by element for component number "// &
25552  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25553  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25554  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
25555  CALL flagerror(local_error,err,error,*999)
25556  CASE(field_data_point_based_interpolation)
25557  local_error="Can not add element for component number "// &
25558  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25559  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25560  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
25561  CALL flagerror(local_error,err,error,*999)
25562  CASE DEFAULT
25563  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
25564  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
25565  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25566  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25567  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25568  CALL flagerror(local_error,err,error,*999)
25569  END SELECT
25570  ELSE
25571  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25572  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25573  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
25574  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
25575  CALL flagerror(local_error,err,error,*999)
25576  ENDIF
25577  ELSE
25578  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25579  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
25580  CALL flagerror(local_error,err,error,*999)
25581  ENDIF
25582  ELSE
25583  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25584  & " is invalid. The field parameter set type must be between 1 and "// &
25585  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
25586  CALL flagerror(local_error,err,error,*999)
25587  ENDIF
25588  ELSE
25589  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
25590  & " does not correspond to the double precision data type of the given value."
25591  CALL flagerror(local_error,err,error,*999)
25592  ENDIF
25593  ELSE
25594  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25595  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25596  CALL flagerror(local_error,err,error,*999)
25597  ENDIF
25598  ELSE
25599  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25600  & " is invalid. The variable type must be between 1 and "// &
25601  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
25602  CALL flagerror(local_error,err,error,*999)
25603  ENDIF
25604  ELSE
25605  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
25606  & " has not been finished."
25607  CALL flagerror(local_error,err,error,*999)
25608  ENDIF
25609  ELSE
25610  CALL flagerror("Field is not associated.",err,error,*999)
25611  ENDIF
25612 
25613  exits("FIELD_PARAMETER_SET_UPDATE_ELEMENT_DP")
25614  RETURN
25615 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_ELEMENT_DP",err,error)
25616  RETURN 1
25617  END SUBROUTINE field_parameter_set_update_element_dp
25618 
25619  !
25620  !================================================================================================================================
25621  !
25622 
25624  SUBROUTINE field_parameter_set_update_element_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,USER_ELEMENT_NUMBER,COMPONENT_NUMBER, &
25625  & VALUE,err,error,*)
25626 
25627  !Argument variables
25628  TYPE(field_type), POINTER :: field
25629  INTEGER(INTG), INTENT(IN) :: variable_type
25630  INTEGER(INTG), INTENT(IN) :: field_set_type
25631  INTEGER(INTG), INTENT(IN) :: user_element_number
25632  INTEGER(INTG), INTENT(IN) :: component_number
25633  LOGICAL, INTENT(IN) :: VALUE
25634  INTEGER(INTG), INTENT(OUT) :: err
25635  TYPE(varying_string), INTENT(OUT) :: error
25636  !Local Variables
25637  INTEGER(INTG) :: decomposition_local_element_number,dof_idx
25638  LOGICAL :: ghost_element,user_element_exists
25639  TYPE(decomposition_type), POINTER :: decomposition
25640  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
25641  TYPE(field_parameter_set_type), POINTER :: parameter_set
25642  TYPE(field_variable_type), POINTER :: field_variable
25643  TYPE(varying_string) :: local_error
25644 
25645  enters("FIELD_PARAMETER_SET_UPDATE_ELEMENT_L",err,error,*999)
25646 
25647  IF(ASSOCIATED(field)) THEN
25648  IF(field%FIELD_FINISHED) THEN
25649  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
25650  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
25651  IF(ASSOCIATED(field_variable)) THEN
25652  IF(field_variable%DATA_TYPE==field_l_type) THEN
25653  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
25654  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
25655  IF(ASSOCIATED(parameter_set)) THEN
25656  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
25657  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
25658  CASE(field_constant_interpolation)
25659  local_error="Can not update by element for component number "// &
25660  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25661  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25662  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
25663  CALL flagerror(local_error,err,error,*999)
25664  CASE(field_element_based_interpolation)
25665  decomposition=>field%DECOMPOSITION
25666  IF(ASSOCIATED(decomposition)) THEN
25667  decomposition_topology=>decomposition%TOPOLOGY
25668  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
25669  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
25670  IF(user_element_exists) THEN
25671  IF(ghost_element) THEN
25672  local_error="Cannot update by element for user element "// &
25673  & trim(number_to_vstring(user_element_number,"*",err,error))//" as it is a ghost element."
25674  CALL flagerror(local_error,err,error,*999)
25675  ELSE
25676  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
25677  & element_param2dof_map%ELEMENTS(decomposition_local_element_number)
25678  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
25679  ENDIF
25680  ELSE
25681  local_error="The specified user element number of "// &
25682  & trim(number_to_vstring(user_element_number,"*",err,error))// &
25683  & " does not exist in the decomposition for field component number "// &
25684  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
25685  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25686  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25687  CALL flagerror(local_error,err,error,*999)
25688  ENDIF
25689  ELSE
25690  CALL flagerror("Field decomposition is not associated.",err,error,*999)
25691  ENDIF
25692  CASE(field_node_based_interpolation)
25693  local_error="Can not update by element for component number "// &
25694  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25695  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25696  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
25697  CALL flagerror(local_error,err,error,*999)
25698  CASE(field_grid_point_based_interpolation)
25699  local_error="Can not update by element for component number "// &
25700  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25701  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25702  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
25703  CALL flagerror(local_error,err,error,*999)
25704  CASE(field_gauss_point_based_interpolation)
25705  local_error="Can not update by element for component number "// &
25706  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25707  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25708  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
25709  CALL flagerror(local_error,err,error,*999)
25710  CASE(field_data_point_based_interpolation)
25711  local_error="Can not add element for component number "// &
25712  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25713  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25714  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
25715  CALL flagerror(local_error,err,error,*999)
25716  CASE DEFAULT
25717  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
25718  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
25719  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25720  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25721  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25722  CALL flagerror(local_error,err,error,*999)
25723  END SELECT
25724  ELSE
25725  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25726  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25727  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
25728  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
25729  CALL flagerror(local_error,err,error,*999)
25730  ENDIF
25731  ELSE
25732  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25733  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
25734  CALL flagerror(local_error,err,error,*999)
25735  ENDIF
25736  ELSE
25737  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25738  & " is invalid. The field parameter set type must be between 1 and "// &
25739  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
25740  CALL flagerror(local_error,err,error,*999)
25741  ENDIF
25742  ELSE
25743  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
25744  & " does not correspond to the logical data type of the given value."
25745  CALL flagerror(local_error,err,error,*999)
25746  ENDIF
25747  ELSE
25748  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25749  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25750  CALL flagerror(local_error,err,error,*999)
25751  ENDIF
25752  ELSE
25753  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25754  & " is invalid. The variable type must be between 1 and "// &
25755  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
25756  CALL flagerror(local_error,err,error,*999)
25757  ENDIF
25758  ELSE
25759  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
25760  & " has not been finished."
25761  CALL flagerror(local_error,err,error,*999)
25762  ENDIF
25763  ELSE
25764  CALL flagerror("Field is not associated.",err,error,*999)
25765  ENDIF
25766 
25767  exits("FIELD_PARAMETER_SET_UPDATE_ELEMENT_L")
25768  RETURN
25769 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_ELEMENT_L",err,error)
25770  RETURN 1
25771  END SUBROUTINE field_parameter_set_update_element_l
25772 
25773  !
25774  !================================================================================================================================
25775  !
25776 
25778  SUBROUTINE field_parametersetupdatelocalelementintg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,LOCAL_ELEMENT_NUMBER, &
25779  & component_number,VALUE,err,error,*)
25780 
25781  !Argument variables
25782  TYPE(field_type), POINTER :: field
25783  INTEGER(INTG), INTENT(IN) :: variable_type
25784  INTEGER(INTG), INTENT(IN) :: field_set_type
25785  INTEGER(INTG), INTENT(IN) :: local_element_number
25786  INTEGER(INTG), INTENT(IN) :: component_number
25787  INTEGER(INTG), INTENT(IN) :: VALUE
25788  INTEGER(INTG), INTENT(OUT) :: err
25789  TYPE(varying_string), INTENT(OUT) :: error
25790  !Local Variables
25791  INTEGER(INTG) :: ny
25792  TYPE(field_parameter_set_type), POINTER :: parameter_set
25793  TYPE(field_variable_type), POINTER :: field_variable
25794  TYPE(varying_string) :: local_error
25795 
25796  enters("Field_ParameterSetUpdateLocalElementIntg",err,error,*999)
25797 
25798  IF(ASSOCIATED(field)) THEN
25799  IF(field%FIELD_FINISHED) THEN
25800  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
25801  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
25802  IF(ASSOCIATED(field_variable)) THEN
25803  IF(field_variable%DATA_TYPE==field_intg_type) THEN
25804  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
25805  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
25806  IF(ASSOCIATED(parameter_set)) THEN
25807  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
25808  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
25809  CASE(field_constant_interpolation)
25810  local_error="Can not update by element for component number "// &
25811  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25812  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25813  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
25814  CALL flagerror(local_error,err,error,*999)
25815  CASE(field_element_based_interpolation)
25816  IF(local_element_number>0.AND.local_element_number<=field_variable%COMPONENTS(component_number)% &
25817  & param_to_dof_map%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS) THEN
25818  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS( &
25819  & local_element_number)
25820  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
25821  ELSE
25822  local_error="Local element number "//trim(number_to_vstring(local_element_number,"*",err,error))// &
25823  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25824  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25825  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
25826  & " which has "//trim(number_to_vstring(field_variable%COMPONENTS(component_number)% &
25827  & param_to_dof_map%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" elements."
25828  CALL flagerror(local_error,err,error,*999)
25829  ENDIF
25830  CASE(field_node_based_interpolation)
25831  local_error="Can not update by element for component number "// &
25832  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25833  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25834  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
25835  CALL flagerror(local_error,err,error,*999)
25836  CASE(field_grid_point_based_interpolation)
25837  local_error="Can not update by element for component number "// &
25838  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25839  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25840  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
25841 
25842  CALL flagerror(local_error,err,error,*999)
25843  CASE(field_gauss_point_based_interpolation)
25844  local_error="Can not update by element for component number "// &
25845  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25846  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25847  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
25848  CALL flagerror(local_error,err,error,*999)
25849  CASE(field_data_point_based_interpolation)
25850  local_error="Can not add element for component number "// &
25851  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25852  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25853  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
25854  CALL flagerror(local_error,err,error,*999)
25855  CASE DEFAULT
25856  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
25857  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
25858  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25859  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25860  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25861  CALL flagerror(local_error,err,error,*999)
25862  END SELECT
25863  ELSE
25864  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25865  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25866  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
25867  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
25868  CALL flagerror(local_error,err,error,*999)
25869  ENDIF
25870  ELSE
25871  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25872  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
25873  CALL flagerror(local_error,err,error,*999)
25874  ENDIF
25875  ELSE
25876  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
25877  & " is invalid. The field parameter set type must be between 1 and "// &
25878  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
25879  CALL flagerror(local_error,err,error,*999)
25880  ENDIF
25881  ELSE
25882  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
25883  & " does not correspond to the integer data type of the given value."
25884  CALL flagerror(local_error,err,error,*999)
25885  ENDIF
25886  ELSE
25887  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25888  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
25889  CALL flagerror(local_error,err,error,*999)
25890  ENDIF
25891  ELSE
25892  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
25893  & " is invalid. The variable type must be between 1 and "// &
25894  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
25895  CALL flagerror(local_error,err,error,*999)
25896  ENDIF
25897  ELSE
25898  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
25899  & " has not been finished."
25900  CALL flagerror(local_error,err,error,*999)
25901  ENDIF
25902  ELSE
25903  CALL flagerror("Field is not associated.",err,error,*999)
25904  ENDIF
25905 
25906  exits("Field_ParameterSetUpdateLocalElementIntg")
25907  RETURN
25908 999 errorsexits("Field_ParameterSetUpdateLocalElementIntg",err,error)
25909  RETURN 1
25910 
25911  END SUBROUTINE field_parametersetupdatelocalelementintg
25912 
25913  !
25914  !================================================================================================================================
25915  !
25916 
25918  SUBROUTINE field_parameter_set_update_local_element_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,LOCAL_ELEMENT_NUMBER,COMPONENT_NUMBER, &
25919  & VALUE,err,error,*)
25920 
25921  !Argument variables
25922  TYPE(field_type), POINTER :: field
25923  INTEGER(INTG), INTENT(IN) :: variable_type
25924  INTEGER(INTG), INTENT(IN) :: field_set_type
25925  INTEGER(INTG), INTENT(IN) :: local_element_number
25926  INTEGER(INTG), INTENT(IN) :: component_number
25927  REAL(SP), INTENT(IN) :: VALUE
25928  INTEGER(INTG), INTENT(OUT) :: err
25929  TYPE(varying_string), INTENT(OUT) :: error
25930  !Local Variables
25931  INTEGER(INTG) :: ny
25932  TYPE(field_parameter_set_type), POINTER :: parameter_set
25933  TYPE(field_variable_type), POINTER :: field_variable
25934  TYPE(varying_string) :: local_error
25935 
25936  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_ELEMENT_SP",err,error,*999)
25937 
25938  IF(ASSOCIATED(field)) THEN
25939  IF(field%FIELD_FINISHED) THEN
25940  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
25941  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
25942  IF(ASSOCIATED(field_variable)) THEN
25943  IF(field_variable%DATA_TYPE==field_sp_type) THEN
25944  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
25945  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
25946  IF(ASSOCIATED(parameter_set)) THEN
25947  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
25948  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
25949  CASE(field_constant_interpolation)
25950  local_error="Can not update by element for component number "// &
25951  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25952  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25953  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
25954  CALL flagerror(local_error,err,error,*999)
25955  CASE(field_element_based_interpolation)
25956  IF(local_element_number>0.AND.local_element_number<=field_variable%COMPONENTS(component_number)% &
25957  & param_to_dof_map%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS) THEN
25958  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS( &
25959  & local_element_number)
25960  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
25961  ELSE
25962  local_error="Local element number "//trim(number_to_vstring(local_element_number,"*",err,error))// &
25963  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25964  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25965  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
25966  & " which has "//trim(number_to_vstring(field_variable%COMPONENTS(component_number)% &
25967  & param_to_dof_map%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" elements."
25968  CALL flagerror(local_error,err,error,*999)
25969  ENDIF
25970  CASE(field_node_based_interpolation)
25971  local_error="Can not update by element for component number "// &
25972  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25973  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25974  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
25975  CALL flagerror(local_error,err,error,*999)
25976  CASE(field_grid_point_based_interpolation)
25977  local_error="Can not update by element for component number "// &
25978  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25979  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25980  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
25981  CALL flagerror(local_error,err,error,*999)
25982  CASE(field_gauss_point_based_interpolation)
25983  local_error="Can not update by element for component number "// &
25984  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25985  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25986  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
25987  CALL flagerror(local_error,err,error,*999)
25988  CASE(field_data_point_based_interpolation)
25989  local_error="Can not add element for component number "// &
25990  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
25991  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
25992  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
25993  CALL flagerror(local_error,err,error,*999)
25994  CASE DEFAULT
25995  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
25996  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
25997  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
25998  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
25999  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26000  CALL flagerror(local_error,err,error,*999)
26001  END SELECT
26002  ELSE
26003  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26004  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26005  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
26006  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
26007  CALL flagerror(local_error,err,error,*999)
26008  ENDIF
26009  ELSE
26010  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26011  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
26012  CALL flagerror(local_error,err,error,*999)
26013  ENDIF
26014  ELSE
26015  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26016  & " is invalid. The field parameter set type must be between 1 and "// &
26017  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
26018  CALL flagerror(local_error,err,error,*999)
26019  ENDIF
26020  ELSE
26021  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
26022  & " does not correspond to the single precision data type of the given value."
26023  CALL flagerror(local_error,err,error,*999)
26024  ENDIF
26025  ELSE
26026  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26027  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26028  CALL flagerror(local_error,err,error,*999)
26029  ENDIF
26030  ELSE
26031  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26032  & " is invalid. The variable type must be between 1 and "// &
26033  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
26034  CALL flagerror(local_error,err,error,*999)
26035  ENDIF
26036  ELSE
26037  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
26038  & " has not been finished."
26039  CALL flagerror(local_error,err,error,*999)
26040  ENDIF
26041  ELSE
26042  CALL flagerror("Field is not associated.",err,error,*999)
26043  ENDIF
26044 
26045  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_ELEMENT_SP")
26046  RETURN
26047 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_ELEMENT_SP",err,error)
26048  RETURN 1
26049  END SUBROUTINE field_parameter_set_update_local_element_sp
26050 
26051  !
26052  !================================================================================================================================
26053  !
26054 
26056  SUBROUTINE field_parameter_set_update_local_element_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,LOCAL_ELEMENT_NUMBER,COMPONENT_NUMBER, &
26057  & VALUE,err,error,*)
26058 
26059  !Argument variables
26060  TYPE(field_type), POINTER :: field
26061  INTEGER(INTG), INTENT(IN) :: variable_type
26062  INTEGER(INTG), INTENT(IN) :: field_set_type
26063  INTEGER(INTG), INTENT(IN) :: local_element_number
26064  INTEGER(INTG), INTENT(IN) :: component_number
26065  REAL(DP), INTENT(IN) :: VALUE
26066  INTEGER(INTG), INTENT(OUT) :: err
26067  TYPE(varying_string), INTENT(OUT) :: error
26068  !Local Variables
26069  INTEGER(INTG) :: ny
26070  TYPE(field_parameter_set_type), POINTER :: parameter_set
26071  TYPE(field_variable_type), POINTER :: field_variable
26072  TYPE(varying_string) :: local_error
26073 
26074  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_ELEMENT_DP",err,error,*999)
26075 
26076  IF(ASSOCIATED(field)) THEN
26077  IF(field%FIELD_FINISHED) THEN
26078  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
26079  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
26080  IF(ASSOCIATED(field_variable)) THEN
26081  IF(field_variable%DATA_TYPE==field_dp_type) THEN
26082  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
26083  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
26084  IF(ASSOCIATED(parameter_set)) THEN
26085  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
26086  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
26087  CASE(field_constant_interpolation)
26088  local_error="Can not update by element for component number "// &
26089  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26090  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26091  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
26092  CALL flagerror(local_error,err,error,*999)
26093  CASE(field_element_based_interpolation)
26094  IF(local_element_number>0.AND.local_element_number<=field_variable%COMPONENTS(component_number)% &
26095  & param_to_dof_map%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS) THEN
26096  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS( &
26097  & local_element_number)
26098  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
26099  ELSE
26100  local_error="Local element number "//trim(number_to_vstring(local_element_number,"*",err,error))// &
26101  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26102  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26103  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
26104  & " which has "//trim(number_to_vstring(field_variable%COMPONENTS(component_number)% &
26105  & param_to_dof_map%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" elements."
26106  CALL flagerror(local_error,err,error,*999)
26107  ENDIF
26108  CASE(field_node_based_interpolation)
26109  local_error="Can not update by element for component number "// &
26110  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26111  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26112  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
26113  CALL flagerror(local_error,err,error,*999)
26114  CASE(field_grid_point_based_interpolation)
26115  local_error="Can not update by element for component number "// &
26116  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26117  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26118  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
26119  CALL flagerror(local_error,err,error,*999)
26120  CASE(field_gauss_point_based_interpolation)
26121  local_error="Can not update by element for component number "// &
26122  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26123  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26124  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
26125  CALL flagerror(local_error,err,error,*999)
26126  CASE(field_data_point_based_interpolation)
26127  local_error="Can not add element for component number "// &
26128  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26129  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26130  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
26131  CALL flagerror(local_error,err,error,*999)
26132  CASE DEFAULT
26133  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
26134  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
26135  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26136  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26137  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26138  CALL flagerror(local_error,err,error,*999)
26139  END SELECT
26140  ELSE
26141  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26142  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26143  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
26144  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
26145  CALL flagerror(local_error,err,error,*999)
26146  ENDIF
26147  ELSE
26148  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26149  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
26150  CALL flagerror(local_error,err,error,*999)
26151  ENDIF
26152  ELSE
26153  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26154  & " is invalid. The field parameter set type must be between 1 and "// &
26155  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
26156  CALL flagerror(local_error,err,error,*999)
26157  ENDIF
26158  ELSE
26159  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
26160  & " does not correspond to the double precision data type of the given value."
26161  CALL flagerror(local_error,err,error,*999)
26162  ENDIF
26163  ELSE
26164  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26165  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26166  CALL flagerror(local_error,err,error,*999)
26167  ENDIF
26168  ELSE
26169  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26170  & " is invalid. The variable type must be between 1 and "// &
26171  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
26172  CALL flagerror(local_error,err,error,*999)
26173  ENDIF
26174  ELSE
26175  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
26176  & " has not been finished."
26177  CALL flagerror(local_error,err,error,*999)
26178  ENDIF
26179  ELSE
26180  CALL flagerror("Field is not associated.",err,error,*999)
26181  ENDIF
26182 
26183  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_ELEMENT_DP")
26184  RETURN
26185 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_ELEMENT_DP",err,error)
26186  RETURN 1
26187  END SUBROUTINE field_parameter_set_update_local_element_dp
26188 
26189  !
26190  !================================================================================================================================
26191  !
26192 
26194  SUBROUTINE field_parameter_set_update_local_element_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,LOCAL_ELEMENT_NUMBER,COMPONENT_NUMBER, &
26195  & VALUE,err,error,*)
26196 
26197  !Argument variables
26198  TYPE(field_type), POINTER :: field
26199  INTEGER(INTG), INTENT(IN) :: variable_type
26200  INTEGER(INTG), INTENT(IN) :: field_set_type
26201  INTEGER(INTG), INTENT(IN) :: local_element_number
26202  INTEGER(INTG), INTENT(IN) :: component_number
26203  LOGICAL, INTENT(IN) :: VALUE
26204  INTEGER(INTG), INTENT(OUT) :: err
26205  TYPE(varying_string), INTENT(OUT) :: error
26206  !Local Variables
26207  INTEGER(INTG) :: ny
26208  TYPE(field_parameter_set_type), POINTER :: parameter_set
26209  TYPE(field_variable_type), POINTER :: field_variable
26210  TYPE(varying_string) :: local_error
26211 
26212  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_ELEMENT_L",err,error,*999)
26213 
26214  IF(ASSOCIATED(field)) THEN
26215  IF(field%FIELD_FINISHED) THEN
26216  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
26217  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
26218  IF(ASSOCIATED(field_variable)) THEN
26219  IF(field_variable%DATA_TYPE==field_l_type) THEN
26220  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
26221  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
26222  IF(ASSOCIATED(parameter_set)) THEN
26223  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
26224  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
26225  CASE(field_constant_interpolation)
26226  local_error="Can not update by element for component number "// &
26227  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26228  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26229  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
26230  CALL flagerror(local_error,err,error,*999)
26231  CASE(field_element_based_interpolation)
26232  IF(local_element_number>0.AND.local_element_number<=field_variable%COMPONENTS(component_number)% &
26233  & param_to_dof_map%ELEMENT_PARAM2DOF_MAP%NUMBER_OF_ELEMENT_PARAMETERS) THEN
26234  ny=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%ELEMENT_PARAM2DOF_MAP%ELEMENTS( &
26235  & local_element_number)
26236  CALL distributed_vector_values_set(parameter_set%PARAMETERS,ny,VALUE,err,error,*999)
26237  ELSE
26238  local_error="Local element number "//trim(number_to_vstring(local_element_number,"*",err,error))// &
26239  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26240  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26241  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
26242  & " which has "//trim(number_to_vstring(field_variable%COMPONENTS(component_number)% &
26243  & param_to_dof_map%NODE_PARAM2DOF_MAP%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" elements."
26244  CALL flagerror(local_error,err,error,*999)
26245  ENDIF
26246  CASE(field_node_based_interpolation)
26247  local_error="Can not update by element for component number "// &
26248  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26249  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26250  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
26251  CALL flagerror(local_error,err,error,*999)
26252  CASE(field_grid_point_based_interpolation)
26253  local_error="Can not update by element for component number "// &
26254  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26255  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26256  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
26257  CALL flagerror(local_error,err,error,*999)
26258  CASE(field_gauss_point_based_interpolation)
26259  local_error="Can not update by element for component number "// &
26260  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26261  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26262  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
26263  CALL flagerror(local_error,err,error,*999)
26264  CASE(field_data_point_based_interpolation)
26265  local_error="Can not add element for component number "// &
26266  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26267  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26268  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
26269  CALL flagerror(local_error,err,error,*999)
26270  CASE DEFAULT
26271  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
26272  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
26273  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26274  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26275  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26276  CALL flagerror(local_error,err,error,*999)
26277  END SELECT
26278  ELSE
26279  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26280  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26281  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
26282  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
26283  CALL flagerror(local_error,err,error,*999)
26284  ENDIF
26285  ELSE
26286  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26287  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))
26288  CALL flagerror(local_error,err,error,*999)
26289  ENDIF
26290  ELSE
26291  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26292  & " is invalid. The field parameter set type must be between 1 and "// &
26293  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))
26294  CALL flagerror(local_error,err,error,*999)
26295  ENDIF
26296  ELSE
26297  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
26298  & " does not correspond to the logical data type of the given value."
26299  CALL flagerror(local_error,err,error,*999)
26300  ENDIF
26301  ELSE
26302  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26303  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26304  CALL flagerror(local_error,err,error,*999)
26305  ENDIF
26306  ELSE
26307  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26308  & " is invalid. The variable type must be between 1 and "// &
26309  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
26310  CALL flagerror(local_error,err,error,*999)
26311  ENDIF
26312  ELSE
26313  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
26314  & " has not been finished."
26315  CALL flagerror(local_error,err,error,*999)
26316  ENDIF
26317  ELSE
26318  CALL flagerror("Field is not associated.",err,error,*999)
26319  ENDIF
26320 
26321  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_ELEMENT_L")
26322  RETURN
26323 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_ELEMENT_L",err,error)
26324  RETURN 1
26325  END SUBROUTINE field_parameter_set_update_local_element_l
26326 
26327  !
26328  !================================================================================================================================
26329  !
26330 
26332  SUBROUTINE field_parameter_set_update_finish(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,ERR,ERROR,*)
26333 
26334  !Argument variables
26335  TYPE(field_type), POINTER :: field
26336  INTEGER(INTG), INTENT(IN) :: variable_type
26337  INTEGER(INTG), INTENT(IN) :: field_set_type
26338  INTEGER(INTG), INTENT(OUT) :: err
26339  TYPE(varying_string), INTENT(OUT) :: error
26340  !Local Variables
26341  TYPE(field_parameter_set_type), POINTER :: parameter_set
26342  TYPE(field_variable_type), POINTER :: field_variable
26343  TYPE(varying_string) :: local_error
26344 
26345  enters("FIELD_PARAMETER_SET_UPDATE_FINISH",err,error,*999)
26346 
26347  IF(ASSOCIATED(field)) THEN
26348  IF(field%FIELD_FINISHED) THEN
26349  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
26350  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
26351  IF(ASSOCIATED(field_variable)) THEN
26352  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
26353  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
26354  IF(ASSOCIATED(parameter_set)) THEN
26355  CALL distributed_vector_update_finish(parameter_set%PARAMETERS,err,error,*999)
26356  IF(field%TYPE==field_geometric_type.AND.field_set_type==field_values_set_type) THEN
26357  !Geometric field values have changed so update the geometric parameters (e.g., lines etc.)
26358  CALL field_geometric_parameters_calculate(field,err,error,*999)
26359  ENDIF
26360  ELSE
26361  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26362  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26363  CALL flagerror(local_error,err,error,*999)
26364  ENDIF
26365  ELSE
26366  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26367  & " is invalid. The field parameter set type must be between 1 and "// &
26368  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
26369  CALL flagerror(local_error,err,error,*999)
26370  ENDIF
26371  ELSE
26372  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26373  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26374  CALL flagerror(local_error,err,error,*999)
26375  ENDIF
26376  ELSE
26377  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26378  & " is invalid. The variable type must be between 1 and "// &
26379  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
26380  CALL flagerror(local_error,err,error,*999)
26381  ENDIF
26382  ELSE
26383  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
26384  & " has not been finished."
26385  CALL flagerror(local_error,err,error,*999)
26386  ENDIF
26387  ELSE
26388  CALL flagerror("Field is not associated.",err,error,*999)
26389  ENDIF
26390 
26391  exits("FIELD_PARAMETER_SET_UPDATE_FINISH")
26392  RETURN
26393 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_FINISH",err,error)
26394  RETURN 1
26395  END SUBROUTINE field_parameter_set_update_finish
26396 
26397  !
26398  !================================================================================================================================
26399  !
26400 
26402  SUBROUTINE field_parameter_set_update_node_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
26403  & user_node_number,component_number,VALUE,err,error,*)
26404 
26405  !Argument variables
26406  TYPE(field_type), POINTER :: field
26407  INTEGER(INTG), INTENT(IN) :: variable_type
26408  INTEGER(INTG), INTENT(IN) :: field_set_type
26409  INTEGER(INTG), INTENT(IN) :: version_number
26410  INTEGER(INTG), INTENT(IN) :: derivative_number
26411  INTEGER(INTG), INTENT(IN) :: user_node_number
26412  INTEGER(INTG), INTENT(IN) :: component_number
26413  INTEGER(INTG), INTENT(IN) :: VALUE
26414  INTEGER(INTG), INTENT(OUT) :: err
26415  TYPE(varying_string), INTENT(OUT) :: error
26416  !Local Variables
26417  INTEGER(INTG) :: domain_local_node_number,dof_idx
26418  LOGICAL :: ghost_node,user_node_exists
26419  TYPE(domain_type), POINTER :: domain
26420  TYPE(domain_nodes_type), POINTER :: domain_nodes
26421  TYPE(domain_topology_type), POINTER :: domain_topology
26422  TYPE(field_parameter_set_type), POINTER :: parameter_set
26423  TYPE(field_variable_type), POINTER :: field_variable
26424  TYPE(varying_string) :: local_error
26425 
26426  enters("FIELD_PARAMETER_SET_UPDATE_NODE_INTG",err,error,*999)
26427 
26428  IF(ASSOCIATED(field)) THEN
26429  IF(field%FIELD_FINISHED) THEN
26430  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
26431  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
26432  IF(ASSOCIATED(field_variable)) THEN
26433  IF(field_variable%DATA_TYPE==field_intg_type) THEN
26434  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
26435  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
26436  IF(ASSOCIATED(parameter_set)) THEN
26437  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
26438  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
26439  CASE(field_constant_interpolation)
26440  local_error="Can not update by node for component number "// &
26441  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26442  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26443  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
26444  CALL flagerror(local_error,err,error,*999)
26445  CASE(field_element_based_interpolation)
26446  local_error="Can not update by node for component number "// &
26447  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26448  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26449  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
26450  CALL flagerror(local_error,err,error,*999)
26451  CASE(field_node_based_interpolation)
26452  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
26453  IF(ASSOCIATED(domain)) THEN
26454  domain_topology=>domain%TOPOLOGY
26455  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
26456  & domain_local_node_number,ghost_node,err,error,*999)
26457  IF(user_node_exists) THEN
26458  IF(ghost_node) THEN
26459  local_error="Cannot update by node for user node "// &
26460  & trim(number_to_vstring(user_node_number,"*",err,error))//" as it is a ghost node."
26461  CALL flagerror(local_error,err,error,*999)
26462  ELSE
26463  domain_nodes=>domain_topology%NODES
26464  IF(ASSOCIATED(domain_nodes)) THEN
26465  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
26466  & number_of_derivatives) THEN
26467  IF(version_number>0.AND.version_number<= &
26468  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
26469  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
26470  & number_of_versions) THEN
26471  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
26472  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
26473  & versions(version_number)
26474  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
26475  ELSE
26476  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
26477  & " is invalid for derivative number "// &
26478  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
26479  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
26480  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26481  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26482  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
26483  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
26484  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
26485  & "(note version numbers are indexed directly from the value the user specifies during "// &
26486  & "element creation and no record is kept of the total number of versions the user sets."// &
26487  & "The maximum version number the user sets defines the total number of versions allocated)."
26488  CALL flagerror(local_error,err,error,*999)
26489  ENDIF
26490  ELSE
26491  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
26492  & " is invalid for user node number "// &
26493  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
26494  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26495  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26496  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
26497  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
26498  & number_of_derivatives,"*",err,error))//" derivatives."
26499  CALL flagerror(local_error,err,error,*999)
26500  ENDIF
26501  ENDIF
26502  ENDIF
26503  ELSE
26504  local_error="The specified user node number of "// &
26505  & trim(number_to_vstring(user_node_number,"*",err,error))// &
26506  & " does not exist in the domain for field component number "// &
26507  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
26508  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26509  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26510  CALL flagerror(local_error,err,error,*999)
26511  ENDIF
26512  ELSE
26513  CALL flagerror("Domain is not associated.",err,error,*999)
26514  ENDIF
26515  CASE(field_grid_point_based_interpolation)
26516  local_error="Can not update by node for component number "// &
26517  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26518  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26519  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
26520  CALL flagerror(local_error,err,error,*999)
26521  CASE(field_gauss_point_based_interpolation)
26522  local_error="Can not update by node for component number "// &
26523  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26524  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26525  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
26526  CALL flagerror(local_error,err,error,*999)
26527  CASE(field_data_point_based_interpolation)
26528  local_error="Can not add element for component number "// &
26529  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26530  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26531  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
26532  CALL flagerror(local_error,err,error,*999)
26533  CASE DEFAULT
26534  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
26535  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
26536  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26537  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26538  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26539  CALL flagerror(local_error,err,error,*999)
26540  END SELECT
26541  ELSE
26542  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26543  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26544  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
26545  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
26546  & " components."
26547  CALL flagerror(local_error,err,error,*999)
26548  ENDIF
26549  ELSE
26550  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26551  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26552  CALL flagerror(local_error,err,error,*999)
26553  ENDIF
26554  ELSE
26555  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26556  & " is invalid. The field parameter set type must be between 1 and "// &
26557  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
26558  CALL flagerror(local_error,err,error,*999)
26559  ENDIF
26560  ELSE
26561  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
26562  & " does not correspond to the integer data type of the given value."
26563  CALL flagerror(local_error,err,error,*999)
26564  ENDIF
26565  ELSE
26566  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26567  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26568  CALL flagerror(local_error,err,error,*999)
26569  ENDIF
26570  ELSE
26571  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26572  & " is invalid. The variable type must be between 1 and "// &
26573  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
26574  CALL flagerror(local_error,err,error,*999)
26575  ENDIF
26576  ELSE
26577  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
26578  & " has not been finished."
26579  CALL flagerror(local_error,err,error,*999)
26580  ENDIF
26581  ELSE
26582  CALL flagerror("Field is not associated.",err,error,*999)
26583  ENDIF
26584 
26585  exits("FIELD_PARAMETER_SET_UPDATE_NODE_INTG")
26586  RETURN
26587 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_NODE_INTG",err,error)
26588  RETURN 1
26589  END SUBROUTINE field_parameter_set_update_node_intg
26590 
26591  !
26592  !================================================================================================================================
26593  !
26594 
26596  SUBROUTINE field_parameter_set_update_node_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
26597  & user_node_number,component_number,VALUE,err,error,*)
26598 
26599  !Argument variables
26600  TYPE(field_type), POINTER :: field
26601  INTEGER(INTG), INTENT(IN) :: variable_type
26602  INTEGER(INTG), INTENT(IN) :: field_set_type
26603  INTEGER(INTG), INTENT(IN) :: version_number
26604  INTEGER(INTG), INTENT(IN) :: derivative_number
26605  INTEGER(INTG), INTENT(IN) :: user_node_number
26606  INTEGER(INTG), INTENT(IN) :: component_number
26607  REAL(SP), INTENT(IN) :: VALUE
26608  INTEGER(INTG), INTENT(OUT) :: err
26609  TYPE(varying_string), INTENT(OUT) :: error
26610  !Local Variables
26611  INTEGER(INTG) :: domain_local_node_number,dof_idx
26612  LOGICAL :: ghost_node,user_node_exists
26613  TYPE(domain_type), POINTER :: domain
26614  TYPE(domain_nodes_type), POINTER :: domain_nodes
26615  TYPE(domain_topology_type), POINTER :: domain_topology
26616  TYPE(field_parameter_set_type), POINTER :: parameter_set
26617  TYPE(field_variable_type), POINTER :: field_variable
26618  TYPE(varying_string) :: local_error
26619 
26620  enters("FIELD_PARAMETER_SET_UPDATE_NODE_SP",err,error,*999)
26621 
26622  IF(ASSOCIATED(field)) THEN
26623  IF(field%FIELD_FINISHED) THEN
26624  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
26625  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
26626  IF(ASSOCIATED(field_variable)) THEN
26627  IF(field_variable%DATA_TYPE==field_sp_type) THEN
26628  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
26629  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
26630  IF(ASSOCIATED(parameter_set)) THEN
26631  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
26632  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
26633  CASE(field_constant_interpolation)
26634  local_error="Can not update by node for component number "// &
26635  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26636  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26637  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
26638  CALL flagerror(local_error,err,error,*999)
26639  CASE(field_element_based_interpolation)
26640  local_error="Can not update by node for component number "// &
26641  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26642  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26643  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
26644  CALL flagerror(local_error,err,error,*999)
26645  CASE(field_node_based_interpolation)
26646  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
26647  IF(ASSOCIATED(domain)) THEN
26648  domain_topology=>domain%TOPOLOGY
26649  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
26650  & domain_local_node_number,ghost_node,err,error,*999)
26651  IF(user_node_exists) THEN
26652  IF(ghost_node) THEN
26653  local_error="Cannot update by node for user node "// &
26654  & trim(number_to_vstring(user_node_number,"*",err,error))//" as it is a ghost node."
26655  CALL flagerror(local_error,err,error,*999)
26656  ELSE
26657  domain_nodes=>domain_topology%NODES
26658  IF(ASSOCIATED(domain_nodes)) THEN
26659  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
26660  & number_of_derivatives) THEN
26661  IF(version_number>0.AND.version_number<= &
26662  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
26663  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
26664  & number_of_versions) THEN
26665  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
26666  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
26667  & versions(version_number)
26668  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
26669  ELSE
26670  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
26671  & " is invalid for derivative number "// &
26672  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
26673  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
26674  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26675  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26676  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
26677  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
26678  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
26679  & "(note version numbers are indexed directly from the value the user specifies during "// &
26680  & "element creation and no record is kept of the total number of versions the user sets."// &
26681  & "The maximum version number the user sets defines the total number of versions allocated)."
26682  CALL flagerror(local_error,err,error,*999)
26683  ENDIF
26684  ELSE
26685  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
26686  & " is invalid for user node number "// &
26687  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
26688  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26689  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26690  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
26691  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
26692  & number_of_derivatives,"*",err,error))//" derivatives."
26693  CALL flagerror(local_error,err,error,*999)
26694  ENDIF
26695  ENDIF
26696  ENDIF
26697  ELSE
26698  local_error="The specified user node number of "// &
26699  & trim(number_to_vstring(user_node_number,"*",err,error))// &
26700  & " does not exist in the domain for field component number "// &
26701  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
26702  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26703  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26704  CALL flagerror(local_error,err,error,*999)
26705  ENDIF
26706  ELSE
26707  CALL flagerror("Domain is not associated.",err,error,*999)
26708  ENDIF
26709  CASE(field_grid_point_based_interpolation)
26710  local_error="Can not update by node for component number "// &
26711  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26712  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26713  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
26714  CALL flagerror(local_error,err,error,*999)
26715  CASE(field_gauss_point_based_interpolation)
26716  local_error="Can not update by node for component number "// &
26717  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26718  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26719  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
26720  CALL flagerror(local_error,err,error,*999)
26721  CASE(field_data_point_based_interpolation)
26722  local_error="Can not add element for component number "// &
26723  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26724  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26725  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
26726  CALL flagerror(local_error,err,error,*999)
26727  CASE DEFAULT
26728  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
26729  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
26730  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26731  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26732  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26733  CALL flagerror(local_error,err,error,*999)
26734  END SELECT
26735  ELSE
26736  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26737  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26738  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
26739  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
26740  & " components."
26741  CALL flagerror(local_error,err,error,*999)
26742  ENDIF
26743  ELSE
26744  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26745  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26746  CALL flagerror(local_error,err,error,*999)
26747  ENDIF
26748  ELSE
26749  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26750  & " is invalid. The field parameter set type must be between 1 and "// &
26751  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
26752  CALL flagerror(local_error,err,error,*999)
26753  ENDIF
26754  ELSE
26755  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
26756  & " does not correspond to the single precision data type of the given value."
26757  CALL flagerror(local_error,err,error,*999)
26758  ENDIF
26759  ELSE
26760  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26761  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26762  CALL flagerror(local_error,err,error,*999)
26763  ENDIF
26764  ELSE
26765  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26766  & " is invalid. The variable type must be between 1 and "// &
26767  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
26768  CALL flagerror(local_error,err,error,*999)
26769  ENDIF
26770  ELSE
26771  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
26772  & " has not been finished."
26773  CALL flagerror(local_error,err,error,*999)
26774  ENDIF
26775  ELSE
26776  CALL flagerror("Field is not associated.",err,error,*999)
26777  ENDIF
26778 
26779  exits("FIELD_PARAMETER_SET_UPDATE_NODE_SP")
26780  RETURN
26781 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_NODE_SP",err,error)
26782  RETURN 1
26783  END SUBROUTINE field_parameter_set_update_node_sp
26784 
26785  !
26786  !================================================================================================================================
26787  !
26788 
26790  SUBROUTINE field_parameter_set_update_node_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
26791  & user_node_number,component_number,VALUE,err,error,*)
26792 
26793  !Argument variables
26794  TYPE(field_type), POINTER :: field
26795  INTEGER(INTG), INTENT(IN) :: variable_type
26796  INTEGER(INTG), INTENT(IN) :: field_set_type
26797  INTEGER(INTG), INTENT(IN) :: version_number
26798  INTEGER(INTG), INTENT(IN) :: derivative_number
26799  INTEGER(INTG), INTENT(IN) :: user_node_number
26800  INTEGER(INTG), INTENT(IN) :: component_number
26801  REAL(DP), INTENT(IN) :: VALUE
26802  INTEGER(INTG), INTENT(OUT) :: err
26803  TYPE(varying_string), INTENT(OUT) :: error
26804  !Local Variables
26805  INTEGER(INTG) :: domain_local_node_number,dof_idx
26806  LOGICAL :: ghost_node,user_node_exists
26807  TYPE(domain_type), POINTER :: domain
26808  TYPE(domain_nodes_type), POINTER :: domain_nodes
26809  TYPE(domain_topology_type), POINTER :: domain_topology
26810  TYPE(field_parameter_set_type), POINTER :: parameter_set
26811  TYPE(field_variable_type), POINTER :: field_variable
26812  TYPE(varying_string) :: local_error
26813 
26814  enters("FIELD_PARAMETER_SET_UPDATE_NODE_DP",err,error,*999)
26815 
26816  IF(ASSOCIATED(field)) THEN
26817  IF(field%FIELD_FINISHED) THEN
26818  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
26819  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
26820  IF(ASSOCIATED(field_variable)) THEN
26821  IF(field_variable%DATA_TYPE==field_dp_type) THEN
26822  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
26823  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
26824  IF(ASSOCIATED(parameter_set)) THEN
26825  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
26826  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
26827  CASE(field_constant_interpolation)
26828  local_error="Can not update by node for component number "// &
26829  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26830  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26831  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
26832  CALL flagerror(local_error,err,error,*999)
26833  CASE(field_element_based_interpolation)
26834  local_error="Can not update by node for component number "// &
26835  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26836  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26837  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
26838  CALL flagerror(local_error,err,error,*999)
26839  CASE(field_node_based_interpolation)
26840  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
26841  IF(ASSOCIATED(domain)) THEN
26842  domain_topology=>domain%TOPOLOGY
26843  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
26844  & domain_local_node_number,ghost_node,err,error,*999)
26845  IF(user_node_exists) THEN
26846  IF(ghost_node) THEN
26847  local_error="Cannot update by node for user node "// &
26848  & trim(number_to_vstring(user_node_number,"*",err,error))//" as it is a ghost node."
26849  CALL flagerror(local_error,err,error,*999)
26850  ELSE
26851  domain_nodes=>domain_topology%NODES
26852  IF(ASSOCIATED(domain_nodes)) THEN
26853  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
26854  & number_of_derivatives) THEN
26855  IF(version_number>0.AND.version_number<= &
26856  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
26857  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
26858  & number_of_versions) THEN
26859  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
26860  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
26861  & versions(version_number)
26862  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
26863  ELSE
26864  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
26865  & " is invalid for derivative number "// &
26866  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
26867  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
26868  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26869  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26870  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
26871  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
26872  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
26873  & "(note version numbers are indexed directly from the value the user specifies during "// &
26874  & "element creation and no record is kept of the total number of versions the user sets."// &
26875  & "The maximum version number the user sets defines the total number of versions allocated)."
26876  CALL flagerror(local_error,err,error,*999)
26877  ENDIF
26878  ELSE
26879  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
26880  & " is invalid for user node number "// &
26881  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
26882  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26883  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26884  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
26885  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
26886  & number_of_derivatives,"*",err,error))//" derivatives."
26887  CALL flagerror(local_error,err,error,*999)
26888  ENDIF
26889  ENDIF
26890  ENDIF
26891  ELSE
26892  local_error="The specified user node number of "// &
26893  & trim(number_to_vstring(user_node_number,"*",err,error))// &
26894  & " does not exist in the domain for field component number "// &
26895  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
26896  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26897  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26898  CALL flagerror(local_error,err,error,*999)
26899  ENDIF
26900  ELSE
26901  CALL flagerror("Domain is not associated.",err,error,*999)
26902  ENDIF
26903  CASE(field_grid_point_based_interpolation)
26904  local_error="Can not update by node for component number "// &
26905  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26906  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26907  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
26908  CALL flagerror(local_error,err,error,*999)
26909  CASE(field_gauss_point_based_interpolation)
26910  local_error="Can not update by node for component number "// &
26911  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26912  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26913  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
26914  CALL flagerror(local_error,err,error,*999)
26915  CASE(field_data_point_based_interpolation)
26916  local_error="Can not add element for component number "// &
26917  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
26918  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
26919  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
26920  CALL flagerror(local_error,err,error,*999)
26921  CASE DEFAULT
26922  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
26923  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
26924  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26925  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26926  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26927  CALL flagerror(local_error,err,error,*999)
26928  END SELECT
26929  ELSE
26930  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
26931  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
26932  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
26933  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
26934  & " components."
26935  CALL flagerror(local_error,err,error,*999)
26936  ENDIF
26937  ELSE
26938  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26939  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26940  CALL flagerror(local_error,err,error,*999)
26941  ENDIF
26942  ELSE
26943  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
26944  & " is invalid. The field parameter set type must be between 1 and "// &
26945  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
26946  CALL flagerror(local_error,err,error,*999)
26947  ENDIF
26948  ELSE
26949  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
26950  & " does not correspond to the double precision data type of the given value."
26951  CALL flagerror(local_error,err,error,*999)
26952  ENDIF
26953  ELSE
26954  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26955  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
26956  CALL flagerror(local_error,err,error,*999)
26957  ENDIF
26958  ELSE
26959  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
26960  & " is invalid. The variable type must be between 1 and "// &
26961  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
26962  CALL flagerror(local_error,err,error,*999)
26963  ENDIF
26964  ELSE
26965  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
26966  & " has not been finished."
26967  CALL flagerror(local_error,err,error,*999)
26968  ENDIF
26969  ELSE
26970  CALL flagerror("Field is not associated.",err,error,*999)
26971  ENDIF
26972 
26973  exits("FIELD_PARAMETER_SET_UPDATE_NODE_DP")
26974  RETURN
26975 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_NODE_DP",err,error)
26976  RETURN 1
26977  END SUBROUTINE field_parameter_set_update_node_dp
26978 
26979  !
26980  !================================================================================================================================
26981  !
26982 
26984  SUBROUTINE field_parameter_set_update_node_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
26985  & user_node_number,component_number,VALUE,err,error,*)
26986 
26987  !Argument variables
26988  TYPE(field_type), POINTER :: field
26989  INTEGER(INTG), INTENT(IN) :: variable_type
26990  INTEGER(INTG), INTENT(IN) :: field_set_type
26991  INTEGER(INTG), INTENT(IN) :: version_number
26992  INTEGER(INTG), INTENT(IN) :: derivative_number
26993  INTEGER(INTG), INTENT(IN) :: user_node_number
26994  INTEGER(INTG), INTENT(IN) :: component_number
26995  LOGICAL, INTENT(IN) :: VALUE
26996  INTEGER(INTG), INTENT(OUT) :: err
26997  TYPE(varying_string), INTENT(OUT) :: error
26998  !Local Variables
26999  INTEGER(INTG) :: domain_local_node_number,dof_idx
27000  LOGICAL :: ghost_node,user_node_exists
27001  TYPE(domain_type), POINTER :: domain
27002  TYPE(domain_nodes_type), POINTER :: domain_nodes
27003  TYPE(domain_topology_type), POINTER :: domain_topology
27004  TYPE(field_parameter_set_type), POINTER :: parameter_set
27005  TYPE(field_variable_type), POINTER :: field_variable
27006  TYPE(varying_string) :: local_error
27007 
27008  enters("FIELD_PARAMETER_SET_UPDATE_NODE_L",err,error,*999)
27009 
27010  IF(ASSOCIATED(field)) THEN
27011  IF(field%FIELD_FINISHED) THEN
27012  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
27013  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
27014  IF(ASSOCIATED(field_variable)) THEN
27015  IF(field_variable%DATA_TYPE==field_l_type) THEN
27016  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
27017  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
27018  IF(ASSOCIATED(parameter_set)) THEN
27019  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
27020  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
27021  CASE(field_constant_interpolation)
27022  local_error="Can not update by node for component number "// &
27023  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27024  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27025  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
27026  CALL flagerror(local_error,err,error,*999)
27027  CASE(field_element_based_interpolation)
27028  local_error="Can not update by node for component number "// &
27029  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27030  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27031  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
27032  CALL flagerror(local_error,err,error,*999)
27033  CASE(field_node_based_interpolation)
27034  domain=>field_variable%COMPONENTS(component_number)%DOMAIN
27035  IF(ASSOCIATED(domain)) THEN
27036  domain_topology=>domain%TOPOLOGY
27037  CALL domain_topology_node_check_exists(domain_topology,user_node_number,user_node_exists, &
27038  & domain_local_node_number,ghost_node,err,error,*999)
27039  IF(user_node_exists) THEN
27040  IF(ghost_node) THEN
27041  local_error="Cannot update by node for user node "// &
27042  & trim(number_to_vstring(user_node_number,"*",err,error))//" as it is a ghost node."
27043  CALL flagerror(local_error,err,error,*999)
27044  ELSE
27045  domain_nodes=>domain_topology%NODES
27046  IF(ASSOCIATED(domain_nodes)) THEN
27047  IF(derivative_number>0.AND.derivative_number<=domain_nodes%NODES(domain_local_node_number)% &
27048  & number_of_derivatives) THEN
27049  IF(version_number>0.AND.version_number<= &
27050  & field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
27051  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
27052  & number_of_versions) THEN
27053  dof_idx=field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP% &
27054  & node_param2dof_map%NODES(domain_local_node_number)%DERIVATIVES(derivative_number)% &
27055  & versions(version_number)
27056  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
27057  ELSE
27058  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
27059  & " is invalid for derivative number "// &
27060  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
27061  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
27062  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27063  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27064  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
27065  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
27066  & derivatives(derivative_number)%numberOfVersions,"*",err,error))//" versions "// &
27067  & "(note version numbers are indexed directly from the value the user specifies during "// &
27068  & "element creation and no record is kept of the total number of versions the user sets."// &
27069  & "The maximum version number the user sets defines the total number of versions allocated)."
27070  CALL flagerror(local_error,err,error,*999)
27071  ENDIF
27072  ELSE
27073  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
27074  & " is invalid for user node number "// &
27075  & trim(number_to_vstring(user_node_number,"*",err,error))//" of component number "// &
27076  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27077  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27078  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27079  & trim(number_to_vstring(domain_nodes%NODES(domain_local_node_number)% &
27080  & number_of_derivatives,"*",err,error))//" derivatives."
27081  CALL flagerror(local_error,err,error,*999)
27082  ENDIF
27083  ENDIF
27084  ENDIF
27085  ELSE
27086  local_error="The specified user node number of "// &
27087  & trim(number_to_vstring(user_node_number,"*",err,error))// &
27088  & " does not exist in the domain for field component number "// &
27089  & trim(number_to_vstring(component_number,"*",err,error))//" of field variable type "// &
27090  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27091  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27092  CALL flagerror(local_error,err,error,*999)
27093  ENDIF
27094  ELSE
27095  CALL flagerror("Domain is not associated.",err,error,*999)
27096  ENDIF
27097  CASE(field_grid_point_based_interpolation)
27098  local_error="Can not update by node for component number "// &
27099  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27100  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27101  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
27102  CALL flagerror(local_error,err,error,*999)
27103  CASE(field_gauss_point_based_interpolation)
27104  local_error="Can not update by node for component number "// &
27105  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27106  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27107  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
27108  CALL flagerror(local_error,err,error,*999)
27109  CASE(field_data_point_based_interpolation)
27110  local_error="Can not add element for component number "// &
27111  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27112  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27113  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
27114  CALL flagerror(local_error,err,error,*999)
27115  CASE DEFAULT
27116  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
27117  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
27118  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27119  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27120  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27121  CALL flagerror(local_error,err,error,*999)
27122  END SELECT
27123  ELSE
27124  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27125  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27126  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27127  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
27128  & " components."
27129  CALL flagerror(local_error,err,error,*999)
27130  ENDIF
27131  ELSE
27132  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
27133  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27134  CALL flagerror(local_error,err,error,*999)
27135  ENDIF
27136  ELSE
27137  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
27138  & " is invalid. The field parameter set type must be between 1 and "// &
27139  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
27140  CALL flagerror(local_error,err,error,*999)
27141  ENDIF
27142  ELSE
27143  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
27144  & " does not correspond to the double precision data type of the given value."
27145  CALL flagerror(local_error,err,error,*999)
27146  ENDIF
27147  ELSE
27148  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
27149  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27150  CALL flagerror(local_error,err,error,*999)
27151  ENDIF
27152  ELSE
27153  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
27154  & " is invalid. The variable type must be between 1 and "// &
27155  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
27156  CALL flagerror(local_error,err,error,*999)
27157  ENDIF
27158  ELSE
27159  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
27160  & " has not been finished."
27161  CALL flagerror(local_error,err,error,*999)
27162  ENDIF
27163  ELSE
27164  CALL flagerror("Field is not associated.",err,error,*999)
27165  ENDIF
27166 
27167  exits("FIELD_PARAMETER_SET_UPDATE_NODE_L")
27168  RETURN
27169 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_NODE_L",err,error)
27170  RETURN 1
27171  END SUBROUTINE field_parameter_set_update_node_l
27172 
27173  !
27174  !================================================================================================================================
27175  !
27176 
27178  SUBROUTINE field_parameter_set_update_local_node_intg(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
27179  & local_node_number,component_number,VALUE,err,error,*)
27180 
27181  !Argument variables
27182  TYPE(field_type), POINTER :: field
27183  INTEGER(INTG), INTENT(IN) :: variable_type
27184  INTEGER(INTG), INTENT(IN) :: field_set_type
27185  INTEGER(INTG), INTENT(IN) :: version_number
27186  INTEGER(INTG), INTENT(IN) :: derivative_number
27187  INTEGER(INTG), INTENT(IN) :: local_node_number
27188  INTEGER(INTG), INTENT(IN) :: component_number
27189  INTEGER(INTG), INTENT(IN) :: VALUE
27190  INTEGER(INTG), INTENT(OUT) :: err
27191  TYPE(varying_string), INTENT(OUT) :: error
27192  !Local Variables
27193  INTEGER(INTG) :: dof_idx
27194  TYPE(field_parameter_set_type), POINTER :: parameter_set
27195  TYPE(field_variable_type), POINTER :: field_variable
27196  TYPE(field_node_param_to_dof_map_type), POINTER :: field_nodes
27197  TYPE(varying_string) :: local_error
27198 
27199  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_INTG",err,error,*999)
27200 
27201  IF(ASSOCIATED(field)) THEN
27202  IF(field%FIELD_FINISHED) THEN
27203  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
27204  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
27205  IF(ASSOCIATED(field_variable)) THEN
27206  IF(field_variable%DATA_TYPE==field_intg_type) THEN
27207  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
27208  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
27209  IF(ASSOCIATED(parameter_set)) THEN
27210  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
27211  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
27212  CASE(field_constant_interpolation)
27213  local_error="Can not update by node for component number "// &
27214  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27215  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27216  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
27217  CALL flagerror(local_error,err,error,*999)
27218  CASE(field_element_based_interpolation)
27219  local_error="Can not update by node for component number "// &
27220  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27221  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27222  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
27223  CALL flagerror(local_error,err,error,*999)
27224  CASE(field_node_based_interpolation)
27225  field_nodes=>field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP
27226  IF(local_node_number>0.AND.local_node_number<=field_nodes%NUMBER_OF_NODE_PARAMETERS) THEN
27227  IF(derivative_number>0.AND.derivative_number<=field_nodes%NODES(local_node_number)% &
27228  & number_of_derivatives) THEN
27229  IF(version_number>0.AND.version_number<= &
27230  & field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)%NUMBER_OF_VERSIONS) THEN
27231  dof_idx=field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)% &
27232  & versions(version_number)
27233  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
27234  ELSE
27235  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
27236  & " is invalid for derivative number "// &
27237  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
27238  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
27239  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27240  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27241  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
27242  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
27243  & derivatives(derivative_number)%NUMBER_OF_VERSIONS,"*",err,error))//" versions "// &
27244  & "(note version numbers are indexed directly from the value the user specifies during "// &
27245  & "element creation and no record is kept of the total number of versions the user sets."// &
27246  & "The maximum version number the user sets defines the total number of versions allocated)."
27247  CALL flagerror(local_error,err,error,*999)
27248  ENDIF
27249  ELSE
27250  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
27251  & " is invalid for user node number "// &
27252  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
27253  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27254  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27255  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27256  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
27257  & number_of_derivatives,"*",err,error))//" derivatives."
27258  CALL flagerror(local_error,err,error,*999)
27259  ENDIF
27260  ELSE
27261  local_error="Local node number "//trim(number_to_vstring(local_node_number,"*",err,error))// &
27262  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27263  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27264  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
27265  & " which has "//trim(number_to_vstring(field_nodes%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" nodes."
27266  CALL flagerror(local_error,err,error,*999)
27267  ENDIF
27268  CASE(field_grid_point_based_interpolation)
27269  local_error="Can not update by node for component number "// &
27270  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27271  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27272  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
27273  CALL flagerror(local_error,err,error,*999)
27274  CASE(field_gauss_point_based_interpolation)
27275  local_error="Can not update by node for component number "// &
27276  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27277  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27278  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
27279  CALL flagerror(local_error,err,error,*999)
27280  CASE(field_data_point_based_interpolation)
27281  local_error="Can not update by node for component number "// &
27282  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27283  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27284  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
27285  CALL flagerror(local_error,err,error,*999)
27286  CASE DEFAULT
27287  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
27288  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
27289  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27290  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27291  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27292  CALL flagerror(local_error,err,error,*999)
27293  END SELECT
27294  ELSE
27295  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27296  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27297  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27298  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
27299  & " components."
27300  CALL flagerror(local_error,err,error,*999)
27301  ENDIF
27302  ELSE
27303  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
27304  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27305  CALL flagerror(local_error,err,error,*999)
27306  ENDIF
27307  ELSE
27308  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
27309  & " is invalid. The field parameter set type must be between 1 and "// &
27310  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
27311  CALL flagerror(local_error,err,error,*999)
27312  ENDIF
27313  ELSE
27314  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
27315  & " does not correspond to the integer data type of the given value."
27316  CALL flagerror(local_error,err,error,*999)
27317  ENDIF
27318  ELSE
27319  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
27320  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27321  CALL flagerror(local_error,err,error,*999)
27322  ENDIF
27323  ELSE
27324  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
27325  & " is invalid. The variable type must be between 1 and "// &
27326  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
27327  CALL flagerror(local_error,err,error,*999)
27328  ENDIF
27329  ELSE
27330  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
27331  & " has not been finished."
27332  CALL flagerror(local_error,err,error,*999)
27333  ENDIF
27334  ELSE
27335  CALL flagerror("Field is not associated.",err,error,*999)
27336  ENDIF
27337 
27338  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_INTG")
27339  RETURN
27340 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_INTG",err,error)
27341  RETURN 1
27342  END SUBROUTINE field_parameter_set_update_local_node_intg
27343 
27344  !
27345  !================================================================================================================================
27346  !
27347 
27349  SUBROUTINE field_parameter_set_update_local_node_sp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
27350  & local_node_number,component_number,VALUE,err,error,*)
27351 
27352  !Argument variables
27353  TYPE(field_type), POINTER :: field
27354  INTEGER(INTG), INTENT(IN) :: variable_type
27355  INTEGER(INTG), INTENT(IN) :: field_set_type
27356  INTEGER(INTG), INTENT(IN) :: version_number
27357  INTEGER(INTG), INTENT(IN) :: derivative_number
27358  INTEGER(INTG), INTENT(IN) :: local_node_number
27359  INTEGER(INTG), INTENT(IN) :: component_number
27360  REAL(SP), INTENT(IN) :: VALUE
27361  INTEGER(INTG), INTENT(OUT) :: err
27362  TYPE(varying_string), INTENT(OUT) :: error
27363  !Local Variables
27364  INTEGER(INTG) :: dof_idx
27365  TYPE(field_parameter_set_type), POINTER :: parameter_set
27366  TYPE(field_variable_type), POINTER :: field_variable
27367  TYPE(field_node_param_to_dof_map_type), POINTER :: field_nodes
27368  TYPE(varying_string) :: local_error
27369 
27370  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_SP",err,error,*999)
27371 
27372  IF(ASSOCIATED(field)) THEN
27373  IF(field%FIELD_FINISHED) THEN
27374  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
27375  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
27376  IF(ASSOCIATED(field_variable)) THEN
27377  IF(field_variable%DATA_TYPE==field_sp_type) THEN
27378  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
27379  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
27380  IF(ASSOCIATED(parameter_set)) THEN
27381  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
27382  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
27383  CASE(field_constant_interpolation)
27384  local_error="Can not update by node for component number "// &
27385  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27386  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27387  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
27388  CALL flagerror(local_error,err,error,*999)
27389  CASE(field_element_based_interpolation)
27390  local_error="Can not update by node for component number "// &
27391  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27392  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27393  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
27394  CALL flagerror(local_error,err,error,*999)
27395  CASE(field_node_based_interpolation)
27396  field_nodes=>field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP
27397  IF(local_node_number>0.AND.local_node_number<=field_nodes%NUMBER_OF_NODE_PARAMETERS) THEN
27398  IF(derivative_number>0.AND.derivative_number<=field_nodes%NODES(local_node_number)% &
27399  & number_of_derivatives) THEN
27400  IF(version_number>0.AND.version_number<= &
27401  & field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)%NUMBER_OF_VERSIONS) THEN
27402  dof_idx=field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)% &
27403  & versions(version_number)
27404  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
27405  ELSE
27406  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
27407  & " is invalid for derivative number "// &
27408  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
27409  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
27410  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27411  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27412  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
27413  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
27414  & derivatives(derivative_number)%NUMBER_OF_VERSIONS,"*",err,error))//" versions "// &
27415  & "(note version numbers are indexed directly from the value the user specifies during "// &
27416  & "element creation and no record is kept of the total number of versions the user sets."// &
27417  & "The maximum version number the user sets defines the total number of versions allocated)."
27418  CALL flagerror(local_error,err,error,*999)
27419  ENDIF
27420  ELSE
27421  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
27422  & " is invalid for user node number "// &
27423  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
27424  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27425  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27426  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27427  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
27428  & number_of_derivatives,"*",err,error))//" derivatives."
27429  CALL flagerror(local_error,err,error,*999)
27430  ENDIF
27431  ELSE
27432  local_error="Local node number "//trim(number_to_vstring(local_node_number,"*",err,error))// &
27433  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27434  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27435  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
27436  & " which has "//trim(number_to_vstring(field_nodes%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" nodes."
27437  CALL flagerror(local_error,err,error,*999)
27438  ENDIF
27439  CASE(field_grid_point_based_interpolation)
27440  local_error="Can not update by node for component number "// &
27441  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27442  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27443  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
27444  CALL flagerror(local_error,err,error,*999)
27445  CASE(field_gauss_point_based_interpolation)
27446  local_error="Can not update by node for component number "// &
27447  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27448  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27449  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
27450  CALL flagerror(local_error,err,error,*999)
27451  CASE(field_data_point_based_interpolation)
27452  local_error="Can not update by node for component number "// &
27453  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27454  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27455  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
27456  CALL flagerror(local_error,err,error,*999)
27457  CASE DEFAULT
27458  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
27459  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
27460  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27461  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27462  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27463  CALL flagerror(local_error,err,error,*999)
27464  END SELECT
27465  ELSE
27466  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27467  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27468  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27469  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
27470  & " components."
27471  CALL flagerror(local_error,err,error,*999)
27472  ENDIF
27473  ELSE
27474  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
27475  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27476  CALL flagerror(local_error,err,error,*999)
27477  ENDIF
27478  ELSE
27479  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
27480  & " is invalid. The field parameter set type must be between 1 and "// &
27481  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
27482  CALL flagerror(local_error,err,error,*999)
27483  ENDIF
27484  ELSE
27485  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
27486  & " does not correspond to the single precision data type of the given value."
27487  CALL flagerror(local_error,err,error,*999)
27488  ENDIF
27489  ELSE
27490  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
27491  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27492  CALL flagerror(local_error,err,error,*999)
27493  ENDIF
27494  ELSE
27495  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
27496  & " is invalid. The variable type must be between 1 and "// &
27497  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
27498  CALL flagerror(local_error,err,error,*999)
27499  ENDIF
27500  ELSE
27501  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
27502  & " has not been finished."
27503  CALL flagerror(local_error,err,error,*999)
27504  ENDIF
27505  ELSE
27506  CALL flagerror("Field is not associated.",err,error,*999)
27507  ENDIF
27508 
27509  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_SP")
27510  RETURN
27511 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_SP",err,error)
27512  RETURN 1
27513  END SUBROUTINE field_parameter_set_update_local_node_sp
27514 
27515  !
27516  !================================================================================================================================
27517  !
27518 
27520  SUBROUTINE field_parameter_set_update_local_node_dp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
27521  & local_node_number,component_number,VALUE,err,error,*)
27522 
27523  !Argument variables
27524  TYPE(field_type), POINTER :: field
27525  INTEGER(INTG), INTENT(IN) :: variable_type
27526  INTEGER(INTG), INTENT(IN) :: field_set_type
27527  INTEGER(INTG), INTENT(IN) :: version_number
27528  INTEGER(INTG), INTENT(IN) :: derivative_number
27529  INTEGER(INTG), INTENT(IN) :: local_node_number
27530  INTEGER(INTG), INTENT(IN) :: component_number
27531  REAL(DP), INTENT(IN) :: VALUE
27532  INTEGER(INTG), INTENT(OUT) :: err
27533  TYPE(varying_string), INTENT(OUT) :: error
27534  !Local Variables
27535  INTEGER(INTG) :: dof_idx
27536  TYPE(field_parameter_set_type), POINTER :: parameter_set
27537  TYPE(field_variable_type), POINTER :: field_variable
27538  TYPE(field_node_param_to_dof_map_type), POINTER :: field_nodes
27539  TYPE(varying_string) :: local_error
27540 
27541  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_DP",err,error,*999)
27542 
27543  IF(ASSOCIATED(field)) THEN
27544  IF(field%FIELD_FINISHED) THEN
27545  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
27546  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
27547  IF(ASSOCIATED(field_variable)) THEN
27548  IF(field_variable%DATA_TYPE==field_dp_type) THEN
27549  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
27550  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
27551  IF(ASSOCIATED(parameter_set)) THEN
27552  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
27553  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
27554  CASE(field_constant_interpolation)
27555  local_error="Can not update by node for component number "// &
27556  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27557  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27558  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
27559  CALL flagerror(local_error,err,error,*999)
27560  CASE(field_element_based_interpolation)
27561  local_error="Can not update by node for component number "// &
27562  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27563  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27564  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
27565  CALL flagerror(local_error,err,error,*999)
27566  CASE(field_node_based_interpolation)
27567  field_nodes=>field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP
27568  IF(local_node_number>0.AND.local_node_number<=field_nodes%NUMBER_OF_NODE_PARAMETERS) THEN
27569  IF(derivative_number>0.AND.derivative_number<=field_nodes%NODES(local_node_number)% &
27570  & number_of_derivatives) THEN
27571  IF(version_number>0.AND.version_number<= &
27572  & field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)%NUMBER_OF_VERSIONS) THEN
27573  dof_idx=field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)% &
27574  & versions(version_number)
27575  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
27576  ELSE
27577  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
27578  & " is invalid for derivative number "// &
27579  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
27580  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
27581  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27582  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27583  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
27584  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
27585  & derivatives(derivative_number)%NUMBER_OF_VERSIONS,"*",err,error))//" versions "// &
27586  & "(note version numbers are indexed directly from the value the user specifies during "// &
27587  & "element creation and no record is kept of the total number of versions the user sets."// &
27588  & "The maximum version number the user sets defines the total number of versions allocated)."
27589  CALL flagerror(local_error,err,error,*999)
27590  ENDIF
27591  ELSE
27592  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
27593  & " is invalid for user node number "// &
27594  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
27595  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27596  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27597  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27598  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
27599  & number_of_derivatives,"*",err,error))//" derivatives."
27600  CALL flagerror(local_error,err,error,*999)
27601  ENDIF
27602  ELSE
27603  local_error="Local node number "//trim(number_to_vstring(local_node_number,"*",err,error))// &
27604  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27605  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27606  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
27607  & " which has "//trim(number_to_vstring(field_nodes%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" nodes."
27608  CALL flagerror(local_error,err,error,*999)
27609  ENDIF
27610  CASE(field_grid_point_based_interpolation)
27611  local_error="Can not update by node for component number "// &
27612  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27613  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27614  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
27615  CALL flagerror(local_error,err,error,*999)
27616  CASE(field_gauss_point_based_interpolation)
27617  local_error="Can not update by node for component number "// &
27618  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27619  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27620  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
27621  CALL flagerror(local_error,err,error,*999)
27622  CASE(field_data_point_based_interpolation)
27623  local_error="Can not update by node for component number "// &
27624  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27625  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27626  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
27627  CALL flagerror(local_error,err,error,*999)
27628  CASE DEFAULT
27629  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
27630  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
27631  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27632  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27633  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27634  CALL flagerror(local_error,err,error,*999)
27635  END SELECT
27636  ELSE
27637  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27638  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27639  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27640  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
27641  & " components."
27642  CALL flagerror(local_error,err,error,*999)
27643  ENDIF
27644  ELSE
27645  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
27646  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27647  CALL flagerror(local_error,err,error,*999)
27648  ENDIF
27649  ELSE
27650  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
27651  & " is invalid. The field parameter set type must be between 1 and "// &
27652  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
27653  CALL flagerror(local_error,err,error,*999)
27654  ENDIF
27655  ELSE
27656  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
27657  & " does not correspond to the double precision data type of the given value."
27658  CALL flagerror(local_error,err,error,*999)
27659  ENDIF
27660  ELSE
27661  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
27662  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27663  CALL flagerror(local_error,err,error,*999)
27664  ENDIF
27665  ELSE
27666  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
27667  & " is invalid. The variable type must be between 1 and "// &
27668  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
27669  CALL flagerror(local_error,err,error,*999)
27670  ENDIF
27671  ELSE
27672  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
27673  & " has not been finished."
27674  CALL flagerror(local_error,err,error,*999)
27675  ENDIF
27676  ELSE
27677  CALL flagerror("Field is not associated.",err,error,*999)
27678  ENDIF
27679 
27680  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_DP")
27681  RETURN
27682 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_DP",err,error)
27683  RETURN 1
27684  END SUBROUTINE field_parameter_set_update_local_node_dp
27685 
27686  !
27687  !================================================================================================================================
27688  !
27689 
27691  SUBROUTINE field_parameter_set_update_local_node_l(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,VERSION_NUMBER,DERIVATIVE_NUMBER, &
27692  & local_node_number,component_number,VALUE,err,error,*)
27693 
27694  !Argument variables
27695  TYPE(field_type), POINTER :: field
27696  INTEGER(INTG), INTENT(IN) :: variable_type
27697  INTEGER(INTG), INTENT(IN) :: field_set_type
27698  INTEGER(INTG), INTENT(IN) :: version_number
27699  INTEGER(INTG), INTENT(IN) :: derivative_number
27700  INTEGER(INTG), INTENT(IN) :: local_node_number
27701  INTEGER(INTG), INTENT(IN) :: component_number
27702  LOGICAL, INTENT(IN) :: VALUE
27703  INTEGER(INTG), INTENT(OUT) :: err
27704  TYPE(varying_string), INTENT(OUT) :: error
27705  !Local Variables
27706  INTEGER(INTG) :: dof_idx
27707  TYPE(field_parameter_set_type), POINTER :: parameter_set
27708  TYPE(field_variable_type), POINTER :: field_variable
27709  TYPE(field_node_param_to_dof_map_type), POINTER :: field_nodes
27710  TYPE(varying_string) :: local_error
27711 
27712  enters("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_L",err,error,*999)
27713 
27714  IF(ASSOCIATED(field)) THEN
27715  IF(field%FIELD_FINISHED) THEN
27716  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
27717  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
27718  IF(ASSOCIATED(field_variable)) THEN
27719  IF(field_variable%DATA_TYPE==field_l_type) THEN
27720  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
27721  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
27722  IF(ASSOCIATED(parameter_set)) THEN
27723  IF(component_number>=1.AND.component_number<=field_variable%NUMBER_OF_COMPONENTS) THEN
27724  SELECT CASE(field_variable%COMPONENTS(component_number)%INTERPOLATION_TYPE)
27725  CASE(field_constant_interpolation)
27726  local_error="Can not update by node for component number "// &
27727  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27728  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27729  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
27730  CALL flagerror(local_error,err,error,*999)
27731  CASE(field_element_based_interpolation)
27732  local_error="Can not update by node for component number "// &
27733  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27734  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27735  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
27736  CALL flagerror(local_error,err,error,*999)
27737  CASE(field_node_based_interpolation)
27738  field_nodes=>field_variable%COMPONENTS(component_number)%PARAM_TO_DOF_MAP%NODE_PARAM2DOF_MAP
27739  IF(local_node_number>0.AND.local_node_number<=field_nodes%NUMBER_OF_NODE_PARAMETERS) THEN
27740  IF(derivative_number>0.AND.derivative_number<=field_nodes%NODES(local_node_number)% &
27741  & number_of_derivatives) THEN
27742  IF(version_number>0.AND.version_number<= &
27743  & field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)%NUMBER_OF_VERSIONS) THEN
27744  dof_idx=field_nodes%NODES(local_node_number)%DERIVATIVES(derivative_number)% &
27745  & versions(version_number)
27746  CALL distributed_vector_values_set(parameter_set%PARAMETERS,dof_idx,VALUE,err,error,*999)
27747  ELSE
27748  local_error="Version number "//trim(number_to_vstring(version_number,"*",err,error))// &
27749  & " is invalid for derivative number "// &
27750  & trim(number_to_vstring(derivative_number,"*",err,error))//" of node number "// &
27751  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
27752  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27753  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27754  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has a maximum of "// &
27755  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
27756  & derivatives(derivative_number)%NUMBER_OF_VERSIONS,"*",err,error))//" versions "// &
27757  & "(note version numbers are indexed directly from the value the user specifies during "// &
27758  & "element creation and no record is kept of the total number of versions the user sets."// &
27759  & "The maximum version number the user sets defines the total number of versions allocated)."
27760  CALL flagerror(local_error,err,error,*999)
27761  ENDIF
27762  ELSE
27763  local_error="Derivative number "//trim(number_to_vstring(derivative_number,"*",err,error))// &
27764  & " is invalid for user node number "// &
27765  & trim(number_to_vstring(local_node_number,"*",err,error))//" of component number "// &
27766  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27767  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27768  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27769  & trim(number_to_vstring(field_nodes%NODES(local_node_number)% &
27770  & number_of_derivatives,"*",err,error))//" derivatives."
27771  CALL flagerror(local_error,err,error,*999)
27772  ENDIF
27773  ELSE
27774  local_error="Local node number "//trim(number_to_vstring(local_node_number,"*",err,error))// &
27775  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27776  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27777  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
27778  & " which has "//trim(number_to_vstring(field_nodes%NUMBER_OF_NODE_PARAMETERS,"*",err,error))//" nodes."
27779  CALL flagerror(local_error,err,error,*999)
27780  ENDIF
27781  CASE(field_grid_point_based_interpolation)
27782  local_error="Can not update by node for component number "// &
27783  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27784  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27785  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
27786  CALL flagerror(local_error,err,error,*999)
27787  CASE(field_gauss_point_based_interpolation)
27788  local_error="Can not update by node for component number "// &
27789  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27790  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27791  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has Gauss point based interpolation."
27792  CALL flagerror(local_error,err,error,*999)
27793  CASE(field_data_point_based_interpolation)
27794  local_error="Can not update by node for component number "// &
27795  & trim(number_to_vstring(component_number,"*",err,error))//" of variable type "// &
27796  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
27797  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
27798  CALL flagerror(local_error,err,error,*999)
27799  CASE DEFAULT
27800  local_error="The field component interpolation type of "//trim(number_to_vstring(field_variable% &
27801  & components(component_number)%INTERPOLATION_TYPE,"*",err,error))// &
27802  & " is invalid for component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27803  & " of variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27804  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27805  CALL flagerror(local_error,err,error,*999)
27806  END SELECT
27807  ELSE
27808  local_error="Component number "//trim(number_to_vstring(component_number,"*",err,error))// &
27809  & " is invalid for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
27810  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27811  & trim(number_to_vstring(field_variable%NUMBER_OF_COMPONENTS,"*",err,error))// &
27812  & " components."
27813  CALL flagerror(local_error,err,error,*999)
27814  ENDIF
27815  ELSE
27816  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
27817  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27818  CALL flagerror(local_error,err,error,*999)
27819  ENDIF
27820  ELSE
27821  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
27822  & " is invalid. The field parameter set type must be between 1 and "// &
27823  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
27824  CALL flagerror(local_error,err,error,*999)
27825  ENDIF
27826  ELSE
27827  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
27828  & " does not correspond to the logical data type of the given value."
27829  CALL flagerror(local_error,err,error,*999)
27830  ENDIF
27831  ELSE
27832  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
27833  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
27834  CALL flagerror(local_error,err,error,*999)
27835  ENDIF
27836  ELSE
27837  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
27838  & " is invalid. The variable type must be between 1 and "// &
27839  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
27840  CALL flagerror(local_error,err,error,*999)
27841  ENDIF
27842  ELSE
27843  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
27844  & " has not been finished."
27845  CALL flagerror(local_error,err,error,*999)
27846  ENDIF
27847  ELSE
27848  CALL flagerror("Field is not associated.",err,error,*999)
27849  ENDIF
27850 
27851  exits("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_L")
27852  RETURN
27853 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_LOCAL_NODE_L",err,error)
27854  RETURN 1
27855  END SUBROUTINE field_parameter_set_update_local_node_l
27856 
27857  !
27858  !================================================================================================================================
27859  !
27860 
27861 !!\todo Should also think about quadrature schemes?
27862 
27864  SUBROUTINE field_parametersetupdategausspointintg(field,variableType,fieldSetType,gaussPointNumber,userElementNumber, &
27865  & componentnumber,value,err,error,*)
27866 
27867  !Argument variables
27868  TYPE(field_type), POINTER :: field
27869  INTEGER(INTG), INTENT(IN) :: variabletype
27870  INTEGER(INTG), INTENT(IN) :: fieldsettype
27871  INTEGER(INTG), INTENT(IN) :: gausspointnumber
27872  INTEGER(INTG), INTENT(IN) :: userelementnumber
27873  INTEGER(INTG), INTENT(IN) :: componentnumber
27874  INTEGER, INTENT(IN) :: value
27875  INTEGER(INTG), INTENT(OUT) :: err
27876  TYPE(varying_string), INTENT(OUT) :: error
27877  !Local Variables
27878  INTEGER(INTG) :: dofidx,localelementnumber
27879  LOGICAL :: ghostelement,userelementexists
27880  TYPE(decomposition_type), POINTER :: decomposition
27881  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
27882  TYPE(field_parameter_set_type), POINTER :: parameterset
27883  TYPE(field_variable_type), POINTER :: fieldvariable
27884  TYPE(varying_string) :: localerror
27885 
27886  enters("Field_ParameterSetUpdateGaussPointIntg",err,error,*999)
27887 
27888  IF(ASSOCIATED(field)) THEN
27889  IF(field%FIELD_FINISHED) THEN
27890  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
27891  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
27892  IF(ASSOCIATED(fieldvariable)) THEN
27893  IF(fieldvariable%DATA_TYPE==field_intg_type) THEN
27894  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
27895  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
27896  IF(ASSOCIATED(parameterset)) THEN
27897  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
27898  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
27899  CASE(field_constant_interpolation)
27900  localerror="Can not update by Gauss point for component number "// &
27901  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
27902  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
27903  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
27904  CALL flagerror(localerror,err,error,*999)
27905  CASE(field_element_based_interpolation)
27906  localerror="Can not update by Gauss point for component number "// &
27907  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
27908  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
27909  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
27910  CALL flagerror(localerror,err,error,*999)
27911  CASE(field_node_based_interpolation)
27912  localerror="Can not update by Gauss point for component number "// &
27913  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
27914  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
27915  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
27916  CALL flagerror(localerror,err,error,*999)
27917  CASE(field_grid_point_based_interpolation)
27918  localerror="Can not update by Gauss point for component number "// &
27919  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
27920  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
27921  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
27922  CALL flagerror(localerror,err,error,*999)
27923  CASE(field_gauss_point_based_interpolation)
27924  decomposition=>field%decomposition
27925  IF(ASSOCIATED(decomposition)) THEN
27926  decompositiontopology=>decomposition%topology
27927  CALL decomposition_topology_element_check_exists(decompositiontopology,userelementnumber, &
27928  & userelementexists,localelementnumber,ghostelement,err,error,*999)
27929  IF(userelementexists) THEN
27930  IF(ghostelement) THEN
27931  localerror="Cannot update by Gauss point for user element "// &
27932  & trim(numbertovstring(userelementnumber,"*",err,error))//" as it is a ghost element."
27933  CALL flagerror(localerror,err,error,*999)
27934  ELSE
27935  ! TODO: could check for actual # of gp
27936  IF(gausspointnumber>=1.AND.gausspointnumber<= SIZE(fieldvariable% &
27937  & components(componentnumber)%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)) THEN
27938  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
27939  & gauss_point_param2dof_map%GAUSS_POINTS(gausspointnumber,localelementnumber)
27940  CALL distributed_vector_values_set(parameterset%parameters,dofidx,value,err,error,*999)
27941  ELSE
27942  localerror="The specified Gauss point number "// &
27943  & trim(numbertovstring(gausspointnumber,"*",err,error))// &
27944  & " is not within the expected range."
27945  CALL flagerror(localerror,err,error,*999)
27946  ENDIF
27947  ENDIF
27948  ELSE
27949  localerror="The specified user element number of "// &
27950  & trim(numbertovstring(userelementnumber,"*",err,error))// &
27951  & " does not exist in the decomposition for field component number "// &
27952  & trim(numbertovstring(componentnumber,"*",err,error))//" of field variable type "// &
27953  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
27954  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
27955  CALL flagerror(localerror,err,error,*999)
27956  ENDIF
27957  ELSE
27958  CALL flagerror("Field decomposition is not associated.",err,error,*999)
27959  ENDIF
27960  CASE(field_data_point_based_interpolation)
27961  localerror="Can not update by Gauss point for component number "// &
27962  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
27963  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
27964  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
27965  CALL flagerror(localerror,err,error,*999)
27966  CASE DEFAULT
27967  localerror="The field component interpolation type of "//trim(numbertovstring(fieldvariable% &
27968  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
27969  & " is invalid for component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
27970  & " of variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
27971  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
27972  CALL flagerror(localerror,err,error,*999)
27973  END SELECT
27974  ELSE
27975  localerror="Component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
27976  & " is invalid for variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
27977  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has "// &
27978  & trim(numbertovstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
27979  CALL flagerror(localerror,err,error,*999)
27980  ENDIF
27981  ELSE
27982  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
27983  & " has not been created on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))
27984  CALL flagerror(localerror,err,error,*999)
27985  ENDIF
27986  ELSE
27987  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
27988  & " is invalid. The field parameter set type must be between 1 and "// &
27989  & trim(numbertovstring(field_number_of_set_types,"*",err,error))//"."
27990  CALL flagerror(localerror,err,error,*999)
27991  ENDIF
27992  ELSE
27993  localerror="The field variable data type of "//trim(numbertovstring(fieldvariable%DATA_TYPE,"*",err,error))// &
27994  & " does not correspond to the integer data type of the given value."
27995  CALL flagerror(localerror,err,error,*999)
27996  ENDIF
27997  ELSE
27998  localerror="The specified field variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
27999  & " has not been defined on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28000  CALL flagerror(localerror,err,error,*999)
28001  ENDIF
28002  ELSE
28003  localerror="The specified variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
28004  & " is invalid. The variable type must be between 1 and "// &
28005  & trim(numbertovstring(field_number_of_variable_types,"*",err,error))//"."
28006  CALL flagerror(localerror,err,error,*999)
28007  ENDIF
28008  ELSE
28009  localerror="Field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
28010  CALL flagerror(localerror,err,error,*999)
28011  ENDIF
28012  ELSE
28013  CALL flagerror("Field is not associated.",err,error,*999)
28014  ENDIF
28015 
28016  exits("Field_ParameterSetUpdateGaussPointIntg")
28017  RETURN
28018 999 errorsexits("Field_ParameterSetUpdateGaussPointIntg",err,error)
28019  RETURN 1
28020 
28021  END SUBROUTINE field_parametersetupdategausspointintg
28022 
28023  !
28024  !================================================================================================================================
28025  !
28026 
28027 !!\todo Should also think about quadrature schemes?
28028 
28030  SUBROUTINE field_parametersetupdategausspointsp(field,variableType,fieldSetType,gaussPointNumber,userElementNumber, &
28031  & componentnumber,value,err,error,*)
28032 
28033  !Argument variables
28034  TYPE(field_type), POINTER :: field
28035  INTEGER(INTG), INTENT(IN) :: variabletype
28036  INTEGER(INTG), INTENT(IN) :: fieldsettype
28037  INTEGER(INTG), INTENT(IN) :: gausspointnumber
28038  INTEGER(INTG), INTENT(IN) :: userelementnumber
28039  INTEGER(INTG), INTENT(IN) :: componentnumber
28040  REAL(SP), INTENT(IN) :: value
28041  INTEGER(INTG), INTENT(OUT) :: err
28042  TYPE(varying_string), INTENT(OUT) :: error
28043  !Local Variables
28044  INTEGER(INTG) :: dofidx,localelementnumber
28045  LOGICAL :: ghostelement,userelementexists
28046  TYPE(decomposition_type), POINTER :: decomposition
28047  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
28048  TYPE(field_parameter_set_type), POINTER :: parameterset
28049  TYPE(field_variable_type), POINTER :: fieldvariable
28050  TYPE(varying_string) :: localerror
28051 
28052  enters("Field_ParameterSetUpdateGaussPointSP",err,error,*999)
28053 
28054  IF(ASSOCIATED(field)) THEN
28055  IF(field%FIELD_FINISHED) THEN
28056  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
28057  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
28058  IF(ASSOCIATED(fieldvariable)) THEN
28059  IF(fieldvariable%DATA_TYPE==field_sp_type) THEN
28060  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
28061  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
28062  IF(ASSOCIATED(parameterset)) THEN
28063  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
28064  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
28065  CASE(field_constant_interpolation)
28066  localerror="Can not update by Gauss point for component number "// &
28067  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28068  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28069  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
28070  CALL flagerror(localerror,err,error,*999)
28071  CASE(field_element_based_interpolation)
28072  localerror="Can not update by Gauss point for component number "// &
28073  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28074  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28075  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
28076  CALL flagerror(localerror,err,error,*999)
28077  CASE(field_node_based_interpolation)
28078  localerror="Can not update by Gauss point for component number "// &
28079  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28080  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28081  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
28082  CALL flagerror(localerror,err,error,*999)
28083  CASE(field_grid_point_based_interpolation)
28084  localerror="Can not update by Gauss point for component number "// &
28085  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28086  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28087  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
28088  CALL flagerror(localerror,err,error,*999)
28089  CASE(field_gauss_point_based_interpolation)
28090  decomposition=>field%decomposition
28091  IF(ASSOCIATED(decomposition)) THEN
28092  decompositiontopology=>decomposition%topology
28093  CALL decomposition_topology_element_check_exists(decompositiontopology,userelementnumber, &
28094  & userelementexists,localelementnumber,ghostelement,err,error,*999)
28095  IF(userelementexists) THEN
28096  IF(ghostelement) THEN
28097  localerror="Cannot update by Gauss point for user element "// &
28098  & trim(numbertovstring(userelementnumber,"*",err,error))//" as it is a ghost element."
28099  CALL flagerror(localerror,err,error,*999)
28100  ELSE
28101  ! TODO: could check for actual # of gp
28102  IF(gausspointnumber>=1.AND.gausspointnumber<= SIZE(fieldvariable% &
28103  & components(componentnumber)%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)) THEN
28104  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
28105  & gauss_point_param2dof_map%GAUSS_POINTS(gausspointnumber,localelementnumber)
28106  CALL distributed_vector_values_set(parameterset%parameters,dofidx,value,err,error,*999)
28107  ELSE
28108  localerror="The specified Gauss point number "// &
28109  & trim(numbertovstring(gausspointnumber,"*",err,error))// &
28110  & " is not within the expected range."
28111  CALL flagerror(localerror,err,error,*999)
28112  ENDIF
28113  ENDIF
28114  ELSE
28115  localerror="The specified user element number of "// &
28116  & trim(numbertovstring(userelementnumber,"*",err,error))// &
28117  & " does not exist in the decomposition for field component number "// &
28118  & trim(numbertovstring(componentnumber,"*",err,error))//" of field variable type "// &
28119  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28120  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28121  CALL flagerror(localerror,err,error,*999)
28122  ENDIF
28123  ELSE
28124  CALL flagerror("Field decomposition is not associated.",err,error,*999)
28125  ENDIF
28126  CASE(field_data_point_based_interpolation)
28127  localerror="Can not update by Gauss point for component number "// &
28128  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28129  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28130  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
28131  CALL flagerror(localerror,err,error,*999)
28132  CASE DEFAULT
28133  localerror="The field component interpolation type of "//trim(numbertovstring(fieldvariable% &
28134  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
28135  & " is invalid for component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
28136  & " of variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
28137  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28138  CALL flagerror(localerror,err,error,*999)
28139  END SELECT
28140  ELSE
28141  localerror="Component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
28142  & " is invalid for variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
28143  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has "// &
28144  & trim(numbertovstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
28145  CALL flagerror(localerror,err,error,*999)
28146  ENDIF
28147  ELSE
28148  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
28149  & " has not been created on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))
28150  CALL flagerror(localerror,err,error,*999)
28151  ENDIF
28152  ELSE
28153  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
28154  & " is invalid. The field parameter set type must be between 1 and "// &
28155  & trim(numbertovstring(field_number_of_set_types,"*",err,error))//"."
28156  CALL flagerror(localerror,err,error,*999)
28157  ENDIF
28158  ELSE
28159  localerror="The field variable data type of "//trim(numbertovstring(fieldvariable%DATA_TYPE,"*",err,error))// &
28160  & " does not correspond to the single precision data type of the given value."
28161  CALL flagerror(localerror,err,error,*999)
28162  ENDIF
28163  ELSE
28164  localerror="The specified field variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
28165  & " has not been defined on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28166  CALL flagerror(localerror,err,error,*999)
28167  ENDIF
28168  ELSE
28169  localerror="The specified variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
28170  & " is invalid. The variable type must be between 1 and "// &
28171  & trim(numbertovstring(field_number_of_variable_types,"*",err,error))//"."
28172  CALL flagerror(localerror,err,error,*999)
28173  ENDIF
28174  ELSE
28175  localerror="Field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
28176  CALL flagerror(localerror,err,error,*999)
28177  ENDIF
28178  ELSE
28179  CALL flagerror("Field is not associated.",err,error,*999)
28180  ENDIF
28181 
28182  exits("Field_ParameterSetUpdateGaussPointSP")
28183  RETURN
28184 999 errorsexits("Field_ParameterSetUpdateGaussPointSP",err,error)
28185  RETURN 1
28186 
28187  END SUBROUTINE field_parametersetupdategausspointsp
28188 
28189  !
28190  !================================================================================================================================
28191  !
28192 
28193 !!\todo Should also think about quadrature schemes?
28194 
28196  SUBROUTINE field_parametersetupdategausspointdp(field,variableType,fieldSetType,gaussPointNumber,userElementNumber, &
28197  & componentnumber,value,err,error,*)
28198 
28199  !Argument variables
28200  TYPE(field_type), POINTER :: field
28201  INTEGER(INTG), INTENT(IN) :: variabletype
28202  INTEGER(INTG), INTENT(IN) :: fieldsettype
28203  INTEGER(INTG), INTENT(IN) :: gausspointnumber
28204  INTEGER(INTG), INTENT(IN) :: userelementnumber
28205  INTEGER(INTG), INTENT(IN) :: componentnumber
28206  REAL(DP), INTENT(IN) :: value
28207  INTEGER(INTG), INTENT(OUT) :: err
28208  TYPE(varying_string), INTENT(OUT) :: error
28209  !Local Variables
28210  INTEGER(INTG) :: dofidx,localelementnumber
28211  LOGICAL :: ghostelement,userelementexists
28212  TYPE(decomposition_type), POINTER :: decomposition
28213  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
28214  TYPE(field_parameter_set_type), POINTER :: parameterset
28215  TYPE(field_variable_type), POINTER :: fieldvariable
28216  TYPE(varying_string) :: localerror
28217 
28218  enters("Field_ParameterSetUpdateGaussPointDP",err,error,*999)
28219 
28220  IF(ASSOCIATED(field)) THEN
28221  IF(field%FIELD_FINISHED) THEN
28222  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
28223  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
28224  IF(ASSOCIATED(fieldvariable)) THEN
28225  IF(fieldvariable%DATA_TYPE==field_dp_type) THEN
28226  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
28227  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
28228  IF(ASSOCIATED(parameterset)) THEN
28229  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
28230  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
28231  CASE(field_constant_interpolation)
28232  localerror="Can not update by Gauss point for component number "// &
28233  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28234  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28235  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
28236  CALL flagerror(localerror,err,error,*999)
28237  CASE(field_element_based_interpolation)
28238  localerror="Can not update by Gauss point for component number "// &
28239  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28240  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28241  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
28242  CALL flagerror(localerror,err,error,*999)
28243  CASE(field_node_based_interpolation)
28244  localerror="Can not update by Gauss point for component number "// &
28245  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28246  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28247  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
28248  CALL flagerror(localerror,err,error,*999)
28249  CASE(field_grid_point_based_interpolation)
28250  localerror="Can not update by Gauss point for component number "// &
28251  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28252  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28253  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
28254  CALL flagerror(localerror,err,error,*999)
28255  CASE(field_gauss_point_based_interpolation)
28256  decomposition=>field%decomposition
28257  IF(ASSOCIATED(decomposition)) THEN
28258  decompositiontopology=>decomposition%topology
28259  CALL decomposition_topology_element_check_exists(decompositiontopology,userelementnumber, &
28260  & userelementexists,localelementnumber,ghostelement,err,error,*999)
28261  IF(userelementexists) THEN
28262  IF(ghostelement) THEN
28263  localerror="Cannot update by Gauss point for user element "// &
28264  & trim(numbertovstring(userelementnumber,"*",err,error))//" as it is a ghost element."
28265  CALL flagerror(localerror,err,error,*999)
28266  ELSE
28267  ! TODO: could check for actual # of gp
28268  IF(gausspointnumber>=1.AND.gausspointnumber<= SIZE(fieldvariable% &
28269  & components(componentnumber)%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)) THEN
28270  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
28271  & gauss_point_param2dof_map%GAUSS_POINTS(gausspointnumber,localelementnumber)
28272  CALL distributed_vector_values_set(parameterset%parameters,dofidx,value,err,error,*999)
28273  ELSE
28274  localerror="The specified Gauss point number "// &
28275  & trim(numbertovstring(gausspointnumber,"*",err,error))// &
28276  & " is not within the expected range."
28277  CALL flagerror(localerror,err,error,*999)
28278  ENDIF
28279  ENDIF
28280  ELSE
28281  localerror="The specified user element number of "// &
28282  & trim(numbertovstring(userelementnumber,"*",err,error))// &
28283  & " does not exist in the decomposition for field component number "// &
28284  & trim(numbertovstring(componentnumber,"*",err,error))//" of field variable type "// &
28285  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28286  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28287  CALL flagerror(localerror,err,error,*999)
28288  ENDIF
28289  ELSE
28290  CALL flagerror("Field decomposition is not associated.",err,error,*999)
28291  ENDIF
28292  CASE(field_data_point_based_interpolation)
28293  localerror="Can not update by Gauss point for component number "// &
28294  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28295  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28296  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
28297  CALL flagerror(localerror,err,error,*999)
28298  CASE DEFAULT
28299  localerror="The field component interpolation type of "//trim(numbertovstring(fieldvariable% &
28300  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
28301  & " is invalid for component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
28302  & " of variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
28303  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28304  CALL flagerror(localerror,err,error,*999)
28305  END SELECT
28306  ELSE
28307  localerror="Component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
28308  & " is invalid for variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
28309  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has "// &
28310  & trim(numbertovstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
28311  CALL flagerror(localerror,err,error,*999)
28312  ENDIF
28313  ELSE
28314  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
28315  & " has not been created on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))
28316  CALL flagerror(localerror,err,error,*999)
28317  ENDIF
28318  ELSE
28319  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
28320  & " is invalid. The field parameter set type must be between 1 and "// &
28321  & trim(numbertovstring(field_number_of_set_types,"*",err,error))//"."
28322  CALL flagerror(localerror,err,error,*999)
28323  ENDIF
28324  ELSE
28325  localerror="The field variable data type of "//trim(numbertovstring(fieldvariable%DATA_TYPE,"*",err,error))// &
28326  & " does not correspond to the double precision data type of the given value."
28327  CALL flagerror(localerror,err,error,*999)
28328  ENDIF
28329  ELSE
28330  localerror="The specified field variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
28331  & " has not been defined on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28332  CALL flagerror(localerror,err,error,*999)
28333  ENDIF
28334  ELSE
28335  localerror="The specified variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
28336  & " is invalid. The variable type must be between 1 and "// &
28337  & trim(numbertovstring(field_number_of_variable_types,"*",err,error))//"."
28338  CALL flagerror(localerror,err,error,*999)
28339  ENDIF
28340  ELSE
28341  localerror="Field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
28342  CALL flagerror(localerror,err,error,*999)
28343  ENDIF
28344  ELSE
28345  CALL flagerror("Field is not associated.",err,error,*999)
28346  ENDIF
28347 
28348  exits("Field_ParameterSetUpdateGaussPointDP")
28349  RETURN
28350 999 errorsexits("Field_ParameterSetUpdateGaussPointDP",err,error)
28351  RETURN 1
28352 
28353  END SUBROUTINE field_parametersetupdategausspointdp
28354 
28355  !
28356  !================================================================================================================================
28357  !
28358 
28359 !!\todo Should also think about quadrature schemes?
28360 
28362  SUBROUTINE field_parametersetupdategausspointl(field,variableType,fieldSetType,gaussPointNumber,userElementNumber, &
28363  & componentnumber,value,err,error,*)
28364 
28365  !Argument variables
28366  TYPE(field_type), POINTER :: field
28367  INTEGER(INTG), INTENT(IN) :: variabletype
28368  INTEGER(INTG), INTENT(IN) :: fieldsettype
28369  INTEGER(INTG), INTENT(IN) :: gausspointnumber
28370  INTEGER(INTG), INTENT(IN) :: userelementnumber
28371  INTEGER(INTG), INTENT(IN) :: componentnumber
28372  LOGICAL, INTENT(IN) :: value
28373  INTEGER(INTG), INTENT(OUT) :: err
28374  TYPE(varying_string), INTENT(OUT) :: error
28375  !Local Variables
28376  INTEGER(INTG) :: dofidx,localelementnumber
28377  LOGICAL :: ghostelement,userelementexists
28378  TYPE(decomposition_type), POINTER :: decomposition
28379  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
28380  TYPE(field_parameter_set_type), POINTER :: parameterset
28381  TYPE(field_variable_type), POINTER :: fieldvariable
28382  TYPE(varying_string) :: localerror
28383 
28384  enters("Field_ParameterSetUpdateGaussPointDP",err,error,*999)
28385 
28386  IF(ASSOCIATED(field)) THEN
28387  IF(field%FIELD_FINISHED) THEN
28388  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
28389  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
28390  IF(ASSOCIATED(fieldvariable)) THEN
28391  IF(fieldvariable%DATA_TYPE==field_l_type) THEN
28392  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
28393  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
28394  IF(ASSOCIATED(parameterset)) THEN
28395  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
28396  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
28397  CASE(field_constant_interpolation)
28398  localerror="Can not update by Gauss point for component number "// &
28399  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28400  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28401  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
28402  CALL flagerror(localerror,err,error,*999)
28403  CASE(field_element_based_interpolation)
28404  localerror="Can not update by Gauss point for component number "// &
28405  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28406  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28407  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
28408  CALL flagerror(localerror,err,error,*999)
28409  CASE(field_node_based_interpolation)
28410  localerror="Can not update by Gauss point for component number "// &
28411  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28412  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28413  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
28414  CALL flagerror(localerror,err,error,*999)
28415  CASE(field_grid_point_based_interpolation)
28416  localerror="Can not update by Gauss point for component number "// &
28417  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28418  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28419  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
28420  CALL flagerror(localerror,err,error,*999)
28421  CASE(field_gauss_point_based_interpolation)
28422  decomposition=>field%decomposition
28423  IF(ASSOCIATED(decomposition)) THEN
28424  decompositiontopology=>decomposition%topology
28425  CALL decomposition_topology_element_check_exists(decompositiontopology,userelementnumber, &
28426  & userelementexists,localelementnumber,ghostelement,err,error,*999)
28427  IF(userelementexists) THEN
28428  IF(ghostelement) THEN
28429  localerror="Cannot update by Gauss point for user element "// &
28430  & trim(numbertovstring(userelementnumber,"*",err,error))//" as it is a ghost element."
28431  CALL flagerror(localerror,err,error,*999)
28432  ELSE
28433  ! TODO: could check for actual # of gp
28434  IF(gausspointnumber>=1.AND.gausspointnumber<= SIZE(fieldvariable% &
28435  & components(componentnumber)%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)) THEN
28436  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
28437  & gauss_point_param2dof_map%GAUSS_POINTS(gausspointnumber,localelementnumber)
28438  CALL distributed_vector_values_set(parameterset%parameters,dofidx,value,err,error,*999)
28439  ELSE
28440  localerror="The specified Gauss point number "// &
28441  & trim(numbertovstring(gausspointnumber,"*",err,error))// &
28442  & " is not within the expected range."
28443  CALL flagerror(localerror,err,error,*999)
28444  ENDIF
28445  ENDIF
28446  ELSE
28447  localerror="The specified user element number of "// &
28448  & trim(numbertovstring(userelementnumber,"*",err,error))// &
28449  & " does not exist in the decomposition for field component number "// &
28450  & trim(numbertovstring(componentnumber,"*",err,error))//" of field variable type "// &
28451  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28452  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28453  CALL flagerror(localerror,err,error,*999)
28454  ENDIF
28455  ELSE
28456  CALL flagerror("Field decomposition is not associated.",err,error,*999)
28457  ENDIF
28458  CASE(field_data_point_based_interpolation)
28459  localerror="Can not update by Gauss point for component number "// &
28460  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28461  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28462  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
28463  CALL flagerror(localerror,err,error,*999)
28464  CASE DEFAULT
28465  localerror="The field component interpolation type of "//trim(numbertovstring(fieldvariable% &
28466  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
28467  & " is invalid for component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
28468  & " of variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
28469  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28470  CALL flagerror(localerror,err,error,*999)
28471  END SELECT
28472  ELSE
28473  localerror="Component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
28474  & " is invalid for variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
28475  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has "// &
28476  & trim(numbertovstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
28477  CALL flagerror(localerror,err,error,*999)
28478  ENDIF
28479  ELSE
28480  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
28481  & " has not been created on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))
28482  CALL flagerror(localerror,err,error,*999)
28483  ENDIF
28484  ELSE
28485  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
28486  & " is invalid. The field parameter set type must be between 1 and "// &
28487  & trim(numbertovstring(field_number_of_set_types,"*",err,error))//"."
28488  CALL flagerror(localerror,err,error,*999)
28489  ENDIF
28490  ELSE
28491  localerror="The field variable data type of "//trim(numbertovstring(fieldvariable%DATA_TYPE,"*",err,error))// &
28492  & " does not correspond to the logical data type of the given value."
28493  CALL flagerror(localerror,err,error,*999)
28494  ENDIF
28495  ELSE
28496  localerror="The specified field variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
28497  & " has not been defined on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28498  CALL flagerror(localerror,err,error,*999)
28499  ENDIF
28500  ELSE
28501  localerror="The specified variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
28502  & " is invalid. The variable type must be between 1 and "// &
28503  & trim(numbertovstring(field_number_of_variable_types,"*",err,error))//"."
28504  CALL flagerror(localerror,err,error,*999)
28505  ENDIF
28506  ELSE
28507  localerror="Field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
28508  CALL flagerror(localerror,err,error,*999)
28509  ENDIF
28510  ELSE
28511  CALL flagerror("Field is not associated.",err,error,*999)
28512  ENDIF
28513 
28514  exits("Field_ParameterSetUpdateGaussPointL")
28515  RETURN
28516 999 errorsexits("Field_ParameterSetUpdateGaussPointL",err,error)
28517  RETURN 1
28518 
28519  END SUBROUTINE field_parametersetupdategausspointl
28520 
28521  !
28522  !================================================================================================================================
28523  !
28524 
28526  SUBROUTINE field_parametersetupdatelocalgausspointdp(field,variableType,fieldSetType,gaussPointNumber,localElementNumber, &
28527  & componentnumber,value,err,error,*)
28528 
28529  !Argument variables
28530  TYPE(field_type), POINTER :: field
28531  INTEGER(INTG), INTENT(IN) :: variabletype
28532  INTEGER(INTG), INTENT(IN) :: fieldsettype
28533  INTEGER(INTG), INTENT(IN) :: gausspointnumber
28534  INTEGER(INTG), INTENT(IN) :: localelementnumber
28535  INTEGER(INTG), INTENT(IN) :: componentnumber
28536  REAL(DP), INTENT(IN) :: value
28537  INTEGER(INTG), INTENT(OUT) :: err
28538  TYPE(varying_string), INTENT(OUT) :: error
28539  !Local Variables
28540  INTEGER(INTG) :: dofidx
28541  TYPE(decomposition_type), POINTER :: decomposition
28542  TYPE(decomposition_topology_type), POINTER :: decompositiontopology
28543  TYPE(field_parameter_set_type), POINTER :: parameterset
28544  TYPE(field_variable_type), POINTER :: fieldvariable
28545  TYPE(varying_string) :: localerror
28546 
28547  enters("Field_ParameterSetUpdateLocalGaussPointDP",err,error,*999)
28548 
28549  IF(ASSOCIATED(field)) THEN
28550  IF(field%FIELD_FINISHED) THEN
28551  IF(variabletype>=1.AND.variabletype<=field_number_of_variable_types) THEN
28552  fieldvariable=>field%VARIABLE_TYPE_MAP(variabletype)%PTR
28553  IF(ASSOCIATED(fieldvariable)) THEN
28554  IF(fieldvariable%DATA_TYPE==field_dp_type) THEN
28555  IF(fieldsettype>0.AND.fieldsettype<=field_number_of_set_types) THEN
28556  parameterset=>fieldvariable%PARAMETER_SETS%SET_TYPE(fieldsettype)%PTR
28557  IF(ASSOCIATED(parameterset)) THEN
28558  IF(componentnumber>=1.AND.componentnumber<=fieldvariable%NUMBER_OF_COMPONENTS) THEN
28559  SELECT CASE(fieldvariable%components(componentnumber)%INTERPOLATION_TYPE)
28560  CASE(field_constant_interpolation)
28561  localerror="Can not update by Gauss point for component number "// &
28562  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28563  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28564  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has constant interpolation."
28565  CALL flagerror(localerror,err,error,*999)
28566  CASE(field_element_based_interpolation)
28567  localerror="Can not update by Gauss point for component number "// &
28568  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28569  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28570  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has element based interpolation."
28571  CALL flagerror(localerror,err,error,*999)
28572  CASE(field_node_based_interpolation)
28573  localerror="Can not update by Gauss point for component number "// &
28574  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28575  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28576  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has node based interpolation."
28577  CALL flagerror(localerror,err,error,*999)
28578  CASE(field_grid_point_based_interpolation)
28579  localerror="Can not update by Gauss point for component number "// &
28580  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28581  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28582  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has grid point based interpolation."
28583  CALL flagerror(localerror,err,error,*999)
28584  CASE(field_gauss_point_based_interpolation)
28585  decomposition=>field%decomposition
28586  IF(ASSOCIATED(decomposition)) THEN
28587  decompositiontopology=>decomposition%topology
28588  IF(ASSOCIATED(decompositiontopology)) THEN
28589  IF(ASSOCIATED(decompositiontopology%elements)) THEN
28590  IF(localelementnumber>=1.AND. &
28591  & localelementnumber<=decompositiontopology%elements%TOTAL_NUMBER_OF_ELEMENTS) THEN
28592  !!TODO: check for actual # of gp?
28593  IF(gausspointnumber >= 1 .AND. gausspointnumber <= SIZE(fieldvariable% &
28594  & components(componentnumber)%PARAM_TO_DOF_MAP%GAUSS_POINT_PARAM2DOF_MAP%GAUSS_POINTS,1)) THEN
28595  dofidx=fieldvariable%components(componentnumber)%PARAM_TO_DOF_MAP% &
28596  & gauss_point_param2dof_map%GAUSS_POINTS(gausspointnumber,localelementnumber)
28597  CALL distributed_vector_values_set(parameterset%parameters,dofidx,value,err,error,*999)
28598  ELSE
28599  localerror="The specified gauss point number "// &
28600  & trim(numbertovstring(gausspointnumber,"*",err,error))// &
28601  & " is not within the expected range."
28602  CALL flagerror(localerror,err,error,*999)
28603  ENDIF
28604  ELSE
28605  localerror="Local element number "//trim(numbertovstring(localelementnumber,"*",err,error))// &
28606  & " is invalid. The local element number must be >=1 and <= "// &
28607  & trim(numbertovstring(decompositiontopology%elements%TOTAL_NUMBER_OF_ELEMENTS,"*",err,error))//"."
28608  CALL flagerror(localerror,err,error,*999)
28609  ENDIF
28610  ELSE
28611  CALL flagerror("Decomposition topology elements is not associated.",err,error,*999)
28612  ENDIF
28613  ELSE
28614  CALL flagerror("Decomposition topology is not associated.",err,error,*999)
28615  ENDIF
28616  ELSE
28617  CALL flagerror("Field decomposition is not associated.",err,error,*999)
28618  ENDIF
28619  CASE(field_data_point_based_interpolation)
28620  localerror="Can not update by local Gauss point for component number "// &
28621  & trim(numbertovstring(componentnumber,"*",err,error))//" of variable type "// &
28622  & trim(numbertovstring(variabletype,"*",err,error))//" of field number "// &
28623  & trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has data point based interpolation."
28624  CALL flagerror(localerror,err,error,*999)
28625  CASE DEFAULT
28626  localerror="The field component interpolation type of "//trim(numbertovstring(fieldvariable% &
28627  & components(componentnumber)%INTERPOLATION_TYPE,"*",err,error))// &
28628  & " is invalid for component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
28629  & " of variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
28630  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28631  CALL flagerror(localerror,err,error,*999)
28632  END SELECT
28633  ELSE
28634  localerror="Component number "//trim(numbertovstring(componentnumber,"*",err,error))// &
28635  & " is invalid for variable type "//trim(numbertovstring(variabletype,"*",err,error))// &
28636  & " of field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" which has "// &
28637  & trim(numbertovstring(fieldvariable%NUMBER_OF_COMPONENTS,"*",err,error))//" components."
28638  CALL flagerror(localerror,err,error,*999)
28639  ENDIF
28640  ELSE
28641  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
28642  & " has not been created on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))
28643  CALL flagerror(localerror,err,error,*999)
28644  ENDIF
28645  ELSE
28646  localerror="The field parameter set type of "//trim(numbertovstring(fieldsettype,"*",err,error))// &
28647  & " is invalid. The field parameter set type must be between 1 and "// &
28648  & trim(numbertovstring(field_number_of_set_types,"*",err,error))//"."
28649  CALL flagerror(localerror,err,error,*999)
28650  ENDIF
28651  ELSE
28652  localerror="The field variable data type of "//trim(numbertovstring(fieldvariable%DATA_TYPE,"*",err,error))// &
28653  & " does not correspond to the double precision data type of the given value."
28654  CALL flagerror(localerror,err,error,*999)
28655  ENDIF
28656  ELSE
28657  localerror="The specified field variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
28658  & " has not been defined on field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//"."
28659  CALL flagerror(localerror,err,error,*999)
28660  ENDIF
28661  ELSE
28662  localerror="The specified variable type of "//trim(numbertovstring(variabletype,"*",err,error))// &
28663  & " is invalid. The variable type must be between 1 and "// &
28664  & trim(numbertovstring(field_number_of_variable_types,"*",err,error))//"."
28665  CALL flagerror(localerror,err,error,*999)
28666  ENDIF
28667  ELSE
28668  localerror="Field number "//trim(numbertovstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
28669  CALL flagerror(localerror,err,error,*999)
28670  ENDIF
28671  ELSE
28672  CALL flagerror("Field is not associated.",err,error,*999)
28673  ENDIF
28674 
28675  exits("Field_ParameterSetUpdateLocalGaussPointDP")
28676  RETURN
28677 999 errorsexits("Field_ParameterSetUpdateLocalGaussPointDP",err,error)
28678  RETURN 1
28679 
28680  END SUBROUTINE field_parametersetupdatelocalgausspointdp
28681 
28682  !
28683  !================================================================================================================================
28684  !
28685 
28687  SUBROUTINE field_parametersetinterpolatesinglexidp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DERIVATIVE_NUMBER, &
28688  & user_element_number,xi,values,err,error,*)
28689 
28690  !Argument variables
28691  TYPE(field_type), POINTER :: field
28692  INTEGER(INTG), INTENT(IN) :: variable_type
28693  INTEGER(INTG), INTENT(IN) :: field_set_type
28694  INTEGER(INTG), INTENT(IN) :: derivative_number
28695  INTEGER(INTG), INTENT(IN) :: user_element_number
28696  REAL(DP), INTENT(IN) :: xi(:)
28697  REAL(DP), INTENT(OUT) :: values(:)
28698  INTEGER(INTG), INTENT(OUT) :: err
28699  TYPE(varying_string), INTENT(OUT) :: error
28700  !Local Variables
28701  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolated_parameters(:)
28702  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolated_point(:)
28703  TYPE(decomposition_type), POINTER :: decomposition
28704  TYPE(domain_elements_type), POINTER :: domain_elements
28705  TYPE(field_variable_type), POINTER :: field_variable
28706  INTEGER(INTG) :: numberofcomponents
28707  TYPE(varying_string) :: local_error
28708 
28709  enters("Field_ParameterSetInterpolateSingleXiDP",err,error,*999)
28710 
28711  NULLIFY(interpolated_parameters)
28712  NULLIFY(interpolated_point)
28713 
28714  IF(ASSOCIATED(field)) THEN
28715  IF(field%FIELD_FINISHED) THEN
28716  decomposition=>field%DECOMPOSITION
28717  IF(ASSOCIATED(decomposition)) THEN
28718  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
28719  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
28720  IF(ASSOCIATED(field_variable)) THEN
28721  IF(field_variable%DATA_TYPE==field_dp_type) THEN
28722  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
28723  domain_elements=>field_variable%COMPONENTS(decomposition%MESH_COMPONENT_NUMBER)%DOMAIN%TOPOLOGY%ELEMENTS
28724  IF(user_element_number>0.AND.user_element_number<=domain_elements%NUMBER_OF_ELEMENTS) THEN
28725  CALL field_interpolation_parameters_initialise(field,interpolated_parameters,err,error,*999)
28726  CALL field_interpolated_points_initialise(interpolated_parameters,interpolated_point,err,error,*999)
28727  CALL field_interpolation_parameters_element_get(field_values_set_type,user_element_number, &
28728  & interpolated_parameters(variable_type)%PTR,err,error,*999)
28729  CALL field_number_of_components_get(field,variable_type,numberofcomponents,err,error,*999)
28730  IF(SIZE(values)==numberofcomponents) THEN
28731  IF(SIZE(xi)==domain_elements%ELEMENTS(user_element_number)%BASIS%NUMBER_OF_XI) THEN
28732  CALL field_interpolate_xi(derivative_number,xi(:),interpolated_point(variable_type)%PTR, &
28733  & err,error,*999)
28734  values(1:numberofcomponents)=interpolated_point(variable_type)%PTR% &
28735  & values(1:numberofcomponents,derivative_number)
28736  ELSE
28737  local_error="The specified xi to interpolate the field at are invalid. "// &
28738  & "The supplied size is "// &
28739  & trim(number_to_vstring(SIZE(xi),"*",err,error))//" and should be "// &
28740  & trim(number_to_vstring(domain_elements%ELEMENTS(user_element_number)%BASIS%NUMBER_OF_XI,"*", &
28741  & err,error))//" for this field."
28742  CALL flagerror(local_error,err,error,*999)
28743  ENDIF
28744  ELSE
28745  local_error="The number of the coordinate values to return the interpolated field to is invalid. "// &
28746  & "The supplied size is "//trim(number_to_vstring(SIZE(values),"*",err,error))//" and should be "// &
28747  & trim(number_to_vstring(numberofcomponents,"*", &
28748  & err,error))//" for this field."
28749  CALL flagerror(local_error,err,error,*999)
28750  ENDIF
28751  !Finalise the interpolated point and parameters
28752  CALL field_interpolated_points_finalise(interpolated_point,err,error,*999)
28753  CALL field_interpolation_parameters_finalise(interpolated_parameters,err,error,*999)
28754  ELSE
28755  local_error="The specified element number of "//trim(number_to_vstring(user_element_number,"*",err,error))// &
28756  & " is invalid. The element number must be between 1 and "// &
28757  & trim(number_to_vstring(domain_elements%NUMBER_OF_ELEMENTS,"*",err,error))//"."
28758  CALL flagerror(local_error,err,error,*999)
28759  ENDIF
28760  ELSE
28761  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
28762  & " is invalid. The field parameter set type must be between 1 and "// &
28763  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
28764  CALL flagerror(local_error,err,error,*999)
28765  ENDIF
28766  ELSE
28767  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
28768  & " does not correspond to the double precision data type of the given value."
28769  CALL flagerror(local_error,err,error,*999)
28770  ENDIF
28771  ELSE
28772  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
28773  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
28774  CALL flagerror(local_error,err,error,*999)
28775  ENDIF
28776  ELSE
28777  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
28778  & " is invalid. The variable type must be between 1 and "// &
28779  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
28780  CALL flagerror(local_error,err,error,*999)
28781  ENDIF
28782  ELSE
28783  CALL flagerror("Field decomposition is not associated.",err,error,*999)
28784  ENDIF
28785  ELSE
28786  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
28787  & " has not been finished."
28788  CALL flagerror(local_error,err,error,*999)
28789  ENDIF
28790  ELSE
28791  CALL flagerror("Field is not associated.",err,error,*999)
28792  ENDIF
28793 
28794  exits("Field_ParameterSetInterpolateSingleXiDP")
28795  RETURN
28796 999 errorsexits("Field_ParameterSetInterpolateSingleXiDP",err,error)
28797  RETURN 1
28798 
28799  END SUBROUTINE field_parametersetinterpolatesinglexidp
28800 
28801  !
28802  !================================================================================================================================
28803  !
28804 
28806  SUBROUTINE field_parametersetinterpolatemultiplexidp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DERIVATIVE_NUMBER, &
28807  & user_element_number,xi,values,err,error,*)
28808 
28809  !Argument variables
28810  TYPE(field_type), POINTER :: field
28811  INTEGER(INTG), INTENT(IN) :: variable_type
28812  INTEGER(INTG), INTENT(IN) :: field_set_type
28813  INTEGER(INTG), INTENT(IN) :: derivative_number
28814  INTEGER(INTG), INTENT(IN) :: user_element_number
28815  REAL(DP), INTENT(IN) :: xi(:,:)
28816  REAL(DP), INTENT(OUT) :: values(:,:)
28817  INTEGER(INTG), INTENT(OUT) :: err
28818  TYPE(varying_string), INTENT(OUT) :: error
28819  !Local Variables
28820  INTEGER(INTG) :: xi_set
28821  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolated_parameters(:)
28822  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolated_point(:)
28823  TYPE(decomposition_type), POINTER :: decomposition
28824  TYPE(domain_elements_type), POINTER :: domain_elements
28825  TYPE(field_variable_type), POINTER :: field_variable
28826  INTEGER(INTG) :: numberofcomponents
28827  TYPE(varying_string) :: local_error
28828 
28829  enters("Field_ParameterSetInterpolateMultipleXiDP",err,error,*999)
28830 
28831  NULLIFY(interpolated_parameters)
28832  NULLIFY(interpolated_point)
28833 
28834  IF(ASSOCIATED(field)) THEN
28835  IF(field%FIELD_FINISHED) THEN
28836  decomposition=>field%DECOMPOSITION
28837  IF(ASSOCIATED(decomposition)) THEN
28838  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
28839  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
28840  IF(ASSOCIATED(field_variable)) THEN
28841  IF(field_variable%DATA_TYPE==field_dp_type) THEN
28842  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
28843  domain_elements=>field_variable%COMPONENTS(decomposition%MESH_COMPONENT_NUMBER)%DOMAIN%TOPOLOGY%ELEMENTS
28844  IF(user_element_number>0.AND.user_element_number<=domain_elements%NUMBER_OF_ELEMENTS) THEN
28845  CALL field_interpolation_parameters_initialise(field,interpolated_parameters,err,error,*999)
28846  CALL field_interpolated_points_initialise(interpolated_parameters,interpolated_point,err,error,*999)
28847  CALL field_interpolation_parameters_element_get(field_values_set_type,user_element_number, &
28848  & interpolated_parameters(variable_type)%PTR,err,error,*999)
28849  CALL field_number_of_components_get(field,variable_type,numberofcomponents,err,error,*999)
28850  IF(SIZE(values,1)==numberofcomponents) THEN
28851  IF(SIZE(xi,1)==domain_elements%ELEMENTS(user_element_number)%BASIS%NUMBER_OF_XI) THEN
28852  IF(SIZE(values,2)==SIZE(xi,2)) THEN
28853  DO xi_set=1,SIZE(xi,2)
28854  CALL field_interpolate_xi(derivative_number,xi(:,xi_set),interpolated_point(variable_type)%PTR, &
28855  & err,error,*999)
28856  values(1:numberofcomponents,xi_set)=interpolated_point(variable_type)%PTR% &
28857  & values(1:numberofcomponents,derivative_number)
28858  ENDDO
28859  ELSE
28860  local_error="The number of xi sets in the field interpolated values output array is "// &
28861  & "not the same as the number to be interpolated."
28862  CALL flagerror(local_error,err,error,*999)
28863  ENDIF
28864  ELSE
28865  local_error="The specified xi values to interpolate the field at are invalid. "// &
28866  & "The supplied size is "// &
28867  & trim(number_to_vstring(SIZE(xi,1),"*",err,error))//" and should be "// &
28868  & trim(number_to_vstring(domain_elements%ELEMENTS(user_element_number)%BASIS%NUMBER_OF_XI,"*", &
28869  & err,error))//" for this field."
28870  CALL flagerror(local_error,err,error,*999)
28871  ENDIF
28872  ELSE
28873  local_error="The number of the coordinate values to return the interpolated field to is invalid. "// &
28874  & "The supplied size is "//trim(number_to_vstring(SIZE(values,1),"*",err,error))//" and should be "// &
28875  & trim(number_to_vstring(numberofcomponents,"*",err,error))//" for this field."
28876  CALL flagerror(local_error,err,error,*999)
28877  ENDIF
28878  !Finalise the interpolated point and parameters
28879  CALL field_interpolated_points_finalise(interpolated_point,err,error,*999)
28880  CALL field_interpolation_parameters_finalise(interpolated_parameters,err,error,*999)
28881  ELSE
28882  local_error="The specified element number of "//trim(number_to_vstring(user_element_number,"*",err,error))// &
28883  & " is invalid. The element number must be between 1 and "// &
28884  & trim(number_to_vstring(domain_elements%NUMBER_OF_ELEMENTS,"*",err,error))//"."
28885  CALL flagerror(local_error,err,error,*999)
28886  ENDIF
28887  ELSE
28888  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
28889  & " is invalid. The field parameter set type must be between 1 and "// &
28890  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
28891  CALL flagerror(local_error,err,error,*999)
28892  ENDIF
28893  ELSE
28894  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
28895  & " does not correspond to the double precision data type of the given value."
28896  CALL flagerror(local_error,err,error,*999)
28897  ENDIF
28898  ELSE
28899  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
28900  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
28901  CALL flagerror(local_error,err,error,*999)
28902  ENDIF
28903  ELSE
28904  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
28905  & " is invalid. The variable type must be between 1 and "// &
28906  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
28907  CALL flagerror(local_error,err,error,*999)
28908  ENDIF
28909  ELSE
28910  CALL flagerror("Field decomposition is not associated.",err,error,*999)
28911  ENDIF
28912  ELSE
28913  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
28914  & " has not been finished."
28915  CALL flagerror(local_error,err,error,*999)
28916  ENDIF
28917  ELSE
28918  CALL flagerror("Field is not associated.",err,error,*999)
28919  ENDIF
28920 
28921  exits("Field_ParameterSetInterpolateMultipleXiDP")
28922  RETURN
28923 999 errorsexits("Field_ParameterSetInterpolateMultipleXiDP",err,error)
28924  RETURN 1
28925 
28926  END SUBROUTINE field_parametersetinterpolatemultiplexidp
28927 
28928  !
28929  !================================================================================================================================
28930  !
28931 
28933  SUBROUTINE field_parametersetinterpolatesinglegaussdp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DERIVATIVE_NUMBER, &
28934  & user_element_number,scheme,gauss_point,values,err,error,*)
28935 
28936  !Argument variables
28937  TYPE(field_type), POINTER :: field
28938  INTEGER(INTG), INTENT(IN) :: variable_type
28939  INTEGER(INTG), INTENT(IN) :: field_set_type
28940  INTEGER(INTG), INTENT(IN) :: derivative_number
28941  INTEGER(INTG), INTENT(IN) :: user_element_number
28942  INTEGER(INTG), INTENT(IN) :: scheme
28943  INTEGER(INTG), INTENT(IN) :: gauss_point
28944  REAL(DP), INTENT(OUT) :: values(:)
28945  INTEGER(INTG), INTENT(OUT) :: err
28946  TYPE(varying_string), INTENT(OUT) :: error
28947  !Local Variables
28948  TYPE(quadrature_scheme_type), POINTER :: quadrature_scheme
28949  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolated_parameters(:)
28950  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolated_point(:)
28951  TYPE(decomposition_type), POINTER :: decomposition
28952  TYPE(domain_elements_type), POINTER :: domain_elements
28953  TYPE(field_variable_type), POINTER :: field_variable
28954  INTEGER(INTG) :: numberofcomponents
28955  TYPE(varying_string) :: local_error
28956 
28957  enters("Field_ParameterSetInterpolateSingleGaussDP",err,error,*999)
28958 
28959  IF(ASSOCIATED(field)) THEN
28960  IF(field%FIELD_FINISHED) THEN
28961  decomposition=>field%DECOMPOSITION
28962  IF(ASSOCIATED(decomposition)) THEN
28963  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
28964  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
28965  IF(ASSOCIATED(field_variable)) THEN
28966  IF(field_variable%DATA_TYPE==field_dp_type) THEN
28967  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
28968  domain_elements=>field_variable%COMPONENTS(decomposition%MESH_COMPONENT_NUMBER)%DOMAIN%TOPOLOGY%ELEMENTS
28969  IF(user_element_number>0.AND.user_element_number<=domain_elements%NUMBER_OF_ELEMENTS) THEN
28970  CALL field_interpolation_parameters_initialise(field,interpolated_parameters,err,error,*999)
28971  CALL field_interpolated_points_initialise(interpolated_parameters,interpolated_point,err,error,*999)
28972  CALL field_interpolation_parameters_element_get(field_values_set_type,user_element_number, &
28973  & interpolated_parameters(variable_type)%PTR,err,error,*999)
28974  CALL field_number_of_components_get(field,variable_type,numberofcomponents,err,error,*999)
28975  quadrature_scheme=>domain_elements%ELEMENTS(user_element_number)%BASIS%QUADRATURE% &
28976  & quadrature_scheme_map(scheme)%PTR
28977  IF(ASSOCIATED(quadrature_scheme)) THEN
28978  IF(SIZE(values)==numberofcomponents) THEN
28979  IF(gauss_point>0.AND.gauss_point<=quadrature_scheme%NUMBER_OF_GAUSS) THEN
28980  CALL field_interpolate_gauss(derivative_number,scheme,gauss_point, &
28981  & interpolated_point(variable_type)%PTR,err,error,*999)
28982  values(1:numberofcomponents)=interpolated_point(variable_type)%PTR% &
28983  & values(1:numberofcomponents,derivative_number)
28984  ELSE
28985  local_error="The specified Gauss point number of "// &
28986  & trim(number_to_vstring(gauss_point,"*",err,error))//"is invalid for "// &
28987  & "the specified quadrature scheme of the specified element for this field which has "// &
28988  & trim(number_to_vstring(quadrature_scheme%NUMBER_OF_GAUSS,"*",err,error))//" Gauss points."
28989  CALL flagerror(local_error,err,error,*999)
28990  ENDIF
28991  ELSE
28992  local_error="The number of the coordinate values to return the interpolated field to is invalid. "// &
28993  & "The supplied size is "//trim(number_to_vstring(SIZE(values),"*",err,error))//" and should be "// &
28994  & trim(number_to_vstring(numberofcomponents,"*",err,error))//" for this field."
28995  CALL flagerror(local_error,err,error,*999)
28996  ENDIF
28997  ELSE
28998  CALL flagerror("The specified quadrature scheme is not associated the specified element's basis.", &
28999  & err,error,*999)
29000  ENDIF
29001  !Finalise the interpolated point and parameters
29002  CALL field_interpolated_points_finalise(interpolated_point,err,error,*999)
29003  CALL field_interpolation_parameters_finalise(interpolated_parameters,err,error,*999)
29004  ELSE
29005  local_error="The specified element number of "//trim(number_to_vstring(user_element_number,"*",err,error))// &
29006  & " is invalid. The element number must be between 1 and "// &
29007  & trim(number_to_vstring(domain_elements%NUMBER_OF_ELEMENTS,"*",err,error))//"."
29008  CALL flagerror(local_error,err,error,*999)
29009  ENDIF
29010  ELSE
29011  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
29012  & " is invalid. The field parameter set type must be between 1 and "// &
29013  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
29014  CALL flagerror(local_error,err,error,*999)
29015  ENDIF
29016  ELSE
29017  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
29018  & " does not correspond to the double precision data type of the given value."
29019  CALL flagerror(local_error,err,error,*999)
29020  ENDIF
29021  ELSE
29022  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
29023  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
29024  CALL flagerror(local_error,err,error,*999)
29025  ENDIF
29026  ELSE
29027  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
29028  & " is invalid. The variable type must be between 1 and "// &
29029  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
29030  CALL flagerror(local_error,err,error,*999)
29031  ENDIF
29032  ELSE
29033  CALL flagerror("Field decomposition is not associated.",err,error,*999)
29034  ENDIF
29035  ELSE
29036  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
29037  & " has not been finished."
29038  CALL flagerror(local_error,err,error,*999)
29039  ENDIF
29040  ELSE
29041  CALL flagerror("Field is not associated.",err,error,*999)
29042  ENDIF
29043 
29044  exits("Field_ParameterSetInterpolateSingleGaussDP")
29045  RETURN
29046 999 errorsexits("Field_ParameterSetInterpolateSingleGaussDP",err,error)
29047  RETURN 1
29048 
29049  END SUBROUTINE field_parametersetinterpolatesinglegaussdp
29050 
29051  !
29052  !================================================================================================================================
29053  !
29054 
29056  SUBROUTINE field_parametersetinterpolatemultiplegaussdp(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DERIVATIVE_NUMBER, &
29057  & user_element_number,scheme,gauss_points,values,err,error,*)
29058 
29059  !Argument variables
29060  TYPE(field_type), POINTER :: field
29061  INTEGER(INTG), INTENT(IN) :: variable_type
29062  INTEGER(INTG), INTENT(IN) :: field_set_type
29063  INTEGER(INTG), INTENT(IN) :: derivative_number
29064  INTEGER(INTG), INTENT(IN) :: user_element_number
29065  INTEGER(INTG), INTENT(IN) :: scheme
29066  INTEGER(INTG), INTENT(IN) :: gauss_points(:)
29067  REAL(DP), INTENT(OUT) :: values(:,:)
29068  INTEGER(INTG), INTENT(OUT) :: err
29069  TYPE(varying_string), INTENT(OUT) :: error
29070  !Local Variables
29071  INTEGER(INTG) :: gauss_point
29072  INTEGER(INTG) :: decomposition_local_element_number
29073  LOGICAL :: ghost_element,user_element_exists
29074  TYPE(quadrature_scheme_type), POINTER :: quadrature_scheme
29075  TYPE(field_interpolation_parameters_ptr_type), POINTER :: interpolated_parameters(:)
29076  TYPE(field_interpolated_point_ptr_type), POINTER :: interpolated_point(:)
29077  TYPE(decomposition_topology_type), POINTER :: decomposition_topology
29078  TYPE(decomposition_type), POINTER :: decomposition
29079  TYPE(domain_elements_type), POINTER :: domain_elements
29080  TYPE(field_variable_type), POINTER :: field_variable
29081  INTEGER(INTG) :: numberofcomponents
29082  TYPE(varying_string) :: local_error
29083 
29084  enters("Field_ParameterSetInterpolateMultipleGaussDP",err,error,*999)
29085 
29086  IF(ASSOCIATED(field)) THEN
29087  IF(field%FIELD_FINISHED) THEN
29088  decomposition=>field%DECOMPOSITION
29089  IF(ASSOCIATED(decomposition)) THEN
29090  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
29091  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
29092  IF(ASSOCIATED(field_variable)) THEN
29093  IF(field_variable%DATA_TYPE==field_dp_type) THEN
29094  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
29095  domain_elements=>field_variable%COMPONENTS(decomposition%MESH_COMPONENT_NUMBER)%DOMAIN%TOPOLOGY%ELEMENTS
29096  decomposition_topology=>decomposition%TOPOLOGY
29097  CALL decomposition_topology_element_check_exists(decomposition_topology,user_element_number, &
29098  & user_element_exists,decomposition_local_element_number,ghost_element,err,error,*999)
29099  IF(user_element_exists) THEN
29100  CALL field_interpolation_parameters_initialise(field,interpolated_parameters,err,error,*999)
29101  CALL field_interpolated_points_initialise(interpolated_parameters,interpolated_point,err,error,*999)
29102  CALL field_interpolation_parameters_element_get(field_values_set_type,decomposition_local_element_number, &
29103  & interpolated_parameters(variable_type)%PTR,err,error,*999)
29104  CALL field_number_of_components_get(field,variable_type,numberofcomponents,err,error,*999)
29105  quadrature_scheme=>domain_elements%ELEMENTS(decomposition_local_element_number)%BASIS%QUADRATURE% &
29106  & quadrature_scheme_map(scheme)%PTR
29107  IF(ASSOCIATED(quadrature_scheme)) THEN
29108  IF(SIZE(values,1)==numberofcomponents) THEN
29109  IF(SIZE(gauss_points)==0) THEN !Interpolate all Gauss points.
29110  IF(SIZE(values,2)==quadrature_scheme%NUMBER_OF_GAUSS) THEN
29111  DO gauss_point=1,quadrature_scheme%NUMBER_OF_GAUSS
29112  CALL field_interpolate_gauss(derivative_number,scheme,gauss_point, &
29113  & interpolated_point(variable_type)%PTR,err,error,*999)
29114  values(1:numberofcomponents,gauss_point)=interpolated_point(variable_type)%PTR% &
29115  & values(1:numberofcomponents,derivative_number)
29116  ENDDO
29117  ELSE
29118  local_error="The number of Gauss points in the field interpolated values output array is "// &
29119  & "invalid. For returning the interpolated field values at all element Gauss points, the "//&
29120  & "output array is required to be allocated for "// &
29121  & trim(number_to_vstring(quadrature_scheme%NUMBER_OF_GAUSS,"*",err,error))// &
29122  & " Gauss points for the specified quadrature scheme."
29123  CALL flagerror(local_error,err,error,*999)
29124  ENDIF
29125  ELSE !Interpolate only at the specified Gauss points.
29126  IF(SIZE(values,2)==SIZE(gauss_points)) THEN
29127  DO gauss_point=1,SIZE(gauss_points)
29128  IF(gauss_points(gauss_point)>0.AND.gauss_points(gauss_point)<=quadrature_scheme% &
29129  & number_of_gauss) THEN
29130  CALL field_interpolate_gauss(derivative_number,scheme,gauss_points(gauss_point), &
29131  & interpolated_point(variable_type)%PTR,err,error,*999)
29132  values(:,gauss_point)=interpolated_point(variable_type)%PTR%VALUES(:,derivative_number)
29133  ELSE
29134  local_error="The specified Gauss point number of "// &
29135  & trim(number_to_vstring(gauss_points(gauss_point),"*",err,error))//"is invalid for "// &
29136  & "the specified quadrature scheme of the specified element for this field which has "// &
29137  & trim(number_to_vstring(quadrature_scheme%NUMBER_OF_GAUSS,"*",err,error))//" Gauss points."
29138  CALL flagerror(local_error,err,error,*999)
29139  ENDIF
29140  ENDDO
29141  ELSE
29142  local_error="The number of Gauss points in the field interpolated values output array is "// &
29143  & "not the same as the number to be interpolated."
29144  CALL flagerror(local_error,err,error,*999)
29145  ENDIF
29146  ENDIF
29147  ELSE
29148  local_error="The number of the coordinate values to return the interpolated field to is invalid. "// &
29149  & "The supplied size is "//trim(number_to_vstring(SIZE(values,1),"*",err,error))//" and should be "// &
29150  & trim(number_to_vstring(numberofcomponents,"*",err,error))//" for this field."
29151  CALL flagerror(local_error,err,error,*999)
29152  ENDIF
29153  ELSE
29154  CALL flagerror("The specified quadrature scheme is not associated the specified element's basis.", &
29155  & err,error,*999)
29156  ENDIF
29157  !Finalise the interpolated point and parameters
29158  CALL field_interpolated_points_finalise(interpolated_point,err,error,*999)
29159  CALL field_interpolation_parameters_finalise(interpolated_parameters,err,error,*999)
29160  ELSE
29161  local_error="The specified user element number of "// &
29162  & trim(number_to_vstring(user_element_number,"*",err,error))// &
29163  & " does not exist in the decomposition for field variable type "// &
29164  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
29165  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
29166  CALL flagerror(local_error,err,error,*999)
29167  ENDIF
29168  ELSE
29169  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
29170  & " is invalid. The field parameter set type must be between 1 and "// &
29171  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
29172  CALL flagerror(local_error,err,error,*999)
29173  ENDIF
29174  ELSE
29175  local_error="The field variable data type of "//trim(number_to_vstring(field_variable%DATA_TYPE,"*",err,error))// &
29176  & " does not correspond to the double precision data type of the given value."
29177  CALL flagerror(local_error,err,error,*999)
29178  ENDIF
29179  ELSE
29180  local_error="The specified field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
29181  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
29182  CALL flagerror(local_error,err,error,*999)
29183  ENDIF
29184  ELSE
29185  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
29186  & " is invalid. The variable type must be between 1 and "// &
29187  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
29188  CALL flagerror(local_error,err,error,*999)
29189  ENDIF
29190  ELSE
29191  CALL flagerror("Field decomposition is not associated.",err,error,*999)
29192  ENDIF
29193  ELSE
29194  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
29195  & " has not been finished."
29196  CALL flagerror(local_error,err,error,*999)
29197  ENDIF
29198  ELSE
29199  CALL flagerror("Field is not associated.",err,error,*999)
29200  ENDIF
29201 
29202  exits("Field_ParameterSetInterpolateMultipleGaussDP")
29203  RETURN
29204 999 errors("Field_ParameterSetInterpolateMultipleGaussDP",err,error)
29205  exits("Field_ParameterSetInterpolateMultipleGaussDP")
29206  RETURN 1
29207 
29208  END SUBROUTINE field_parametersetinterpolatemultiplegaussdp
29209 
29210  !
29211  !================================================================================================================================
29212  !
29213 
29215  SUBROUTINE field_parameter_set_update_start(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,ERR,ERROR,*)
29216 
29217  !Argument variables
29218  TYPE(field_type), POINTER :: field
29219  INTEGER(INTG), INTENT(IN) :: variable_type
29220  INTEGER(INTG), INTENT(IN) :: field_set_type
29221  INTEGER(INTG), INTENT(OUT) :: err
29222  TYPE(varying_string), INTENT(OUT) :: error
29223  !Local Variables
29224  TYPE(field_parameter_set_type), POINTER :: parameter_set
29225  TYPE(field_variable_type), POINTER :: field_variable
29226  TYPE(varying_string) :: local_error
29227 
29228  enters("FIELD_PARAMETER_SET_UPDATE_START",err,error,*999)
29229 
29230  IF(ASSOCIATED(field)) THEN
29231  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
29232  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
29233  IF(ASSOCIATED(field_variable)) THEN
29234  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
29235  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
29236  IF(ASSOCIATED(parameter_set)) THEN
29237  CALL distributed_vector_update_start(parameter_set%PARAMETERS,err,error,*999)
29238  ELSE
29239  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
29240  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
29241  CALL flagerror(local_error,err,error,*999)
29242  ENDIF
29243  ELSE
29244  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
29245  & " is invalid. The field parameter set type must be between 1 and "// &
29246  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
29247  CALL flagerror(local_error,err,error,*999)
29248  ENDIF
29249  ELSE
29250  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
29251  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
29252  CALL flagerror(local_error,err,error,*999)
29253  ENDIF
29254  ELSE
29255  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
29256  & " is invalid. The variable type must be between 1 and "// &
29257  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
29258  CALL flagerror(local_error,err,error,*999)
29259  ENDIF
29260  ELSE
29261  CALL flagerror("Field is not associated.",err,error,*999)
29262  ENDIF
29263 
29264  exits("FIELD_PARAMETER_SET_UPDATE_START")
29265  RETURN
29266 999 errorsexits("FIELD_PARAMETER_SET_UPDATE_START",err,error)
29267  RETURN 1
29268  END SUBROUTINE field_parameter_set_update_start
29269 
29270  !
29271  !================================================================================================================================
29272  !
29273 
29275  SUBROUTINE field_parameter_set_vector_get(FIELD,VARIABLE_TYPE,FIELD_SET_TYPE,DISTRIBUTED_VECTOR,ERR,ERROR,*)
29276 
29277  !Argument variables
29278  TYPE(field_type), POINTER :: field
29279  INTEGER(INTG), INTENT(IN) :: variable_type
29280  INTEGER(INTG), INTENT(IN) :: field_set_type
29281  TYPE(distributed_vector_type), POINTER :: distributed_vector
29282  INTEGER(INTG), INTENT(OUT) :: err
29283  TYPE(varying_string), INTENT(OUT) :: error
29284  !Local Variables
29285  TYPE(field_parameter_set_type), POINTER :: parameter_set
29286  TYPE(field_variable_type), POINTER :: field_variable
29287  TYPE(varying_string) :: local_error
29288 
29289  enters("FIELD_PARAMETER_SET_VECTOR_GET",err,error,*999)
29290 
29291  IF(ASSOCIATED(field)) THEN
29292  IF(ASSOCIATED(distributed_vector)) THEN
29293  CALL flagerror("Distributed vector is already associated.",err,error,*999)
29294  ELSE
29295  NULLIFY(distributed_vector)
29296  IF(field%FIELD_FINISHED) THEN
29297  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
29298  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
29299  IF(ASSOCIATED(field_variable)) THEN
29300  IF(field_set_type>0.AND.field_set_type<=field_number_of_set_types) THEN
29301  parameter_set=>field_variable%PARAMETER_SETS%SET_TYPE(field_set_type)%PTR
29302  IF(ASSOCIATED(parameter_set)) THEN
29303  distributed_vector=>parameter_set%PARAMETERS
29304  IF(.NOT.ASSOCIATED(distributed_vector)) &
29305  & CALL flagerror("Call parameter set distributed vector is not associated.",err,error,*999)
29306  ELSE
29307  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
29308  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
29309  CALL flagerror(local_error,err,error,*999)
29310  ENDIF
29311  ELSE
29312  local_error="The field parameter set type of "//trim(number_to_vstring(field_set_type,"*",err,error))// &
29313  & " is invalid. The field parameter set type must be between 1 and "// &
29314  & trim(number_to_vstring(field_number_of_set_types,"*",err,error))//"."
29315  CALL flagerror(local_error,err,error,*999)
29316  ENDIF
29317  ELSE
29318  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
29319  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
29320  CALL flagerror(local_error,err,error,*999)
29321  ENDIF
29322  ELSE
29323  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
29324  & " is invalid. The variable type must be between 1 and "// &
29325  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
29326  CALL flagerror(local_error,err,error,*999)
29327  ENDIF
29328  ELSE
29329  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
29330  & " has not been finished."
29331  CALL flagerror(local_error,err,error,*999)
29332  ENDIF
29333  ENDIF
29334  ELSE
29335  CALL flagerror("Field is not associated.",err,error,*999)
29336  ENDIF
29337 
29338  exits("FIELD_PARAMETER_SET_VECTOR_GET")
29339  RETURN
29340 999 errorsexits("FIELD_PARAMETER_SET_VECTOR_GET",err,error)
29341  RETURN 1
29342  END SUBROUTINE field_parameter_set_vector_get
29343 
29344  !
29345  !================================================================================================================================
29346  !
29347 
29349  SUBROUTINE field_parameter_sets_finalise(FIELD_VARIABLE,ERR,ERROR,*)
29350 
29351  !Argument variables
29352  TYPE(field_variable_type) :: field_variable
29353  INTEGER(INTG), INTENT(OUT) :: err
29354  TYPE(varying_string), INTENT(OUT) :: error
29355  !Local Variables
29356  INTEGER(INTG) :: parameter_set_idx
29357 
29358  enters("FIELD_PARAMETER_SETS_FINALISE",err,error,*999)
29359 
29360  IF(ASSOCIATED(field_variable%PARAMETER_SETS%SET_TYPE)) DEALLOCATE(field_variable%PARAMETER_SETS%SET_TYPE)
29361  IF(ASSOCIATED(field_variable%PARAMETER_SETS%PARAMETER_SETS)) THEN
29362  DO parameter_set_idx=1,SIZE(field_variable%PARAMETER_SETS%PARAMETER_SETS,1)
29363  CALL field_parameter_set_finalise(field_variable%PARAMETER_SETS%PARAMETER_SETS(parameter_set_idx)%PTR,err,error,*999)
29364  ENDDO !parameter_set_idx
29365  DEALLOCATE(field_variable%PARAMETER_SETS%PARAMETER_SETS)
29366  ENDIF
29367  field_variable%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS=0
29368 
29369  exits("FIELD_PARAMETER_SETS_FINALISE")
29370  RETURN
29371 999 errorsexits("FIELD_PARAMETER_SETS_FINALISE",err,error)
29372  RETURN 1
29373  END SUBROUTINE field_parameter_sets_finalise
29374 
29375  !
29376  !================================================================================================================================
29377  !
29378 
29380  SUBROUTINE field_parameter_sets_initialise(FIELD,ERR,ERROR,*)
29381 
29382  !Argument variables
29383  TYPE(field_type), POINTER :: field
29384  INTEGER(INTG), INTENT(OUT) :: err
29385  TYPE(varying_string), INTENT(OUT) :: error
29386  !Local Variables
29387  INTEGER(INTG) :: dummy_err,parameter_set_idx,variable_idx
29388  TYPE(varying_string) :: dummy_error
29389 
29390  enters("FIELD_PARAMETER_SETS_INITIALISE",err,error,*998)
29391 
29392  IF(ASSOCIATED(field)) THEN
29393  DO variable_idx=1,field%NUMBER_OF_VARIABLES
29394  field%VARIABLES(variable_idx)%PARAMETER_SETS%FIELD_VARIABLE=>field%VARIABLES(variable_idx)
29395  field%VARIABLES(variable_idx)%PARAMETER_SETS%NUMBER_OF_PARAMETER_SETS=0
29396  NULLIFY(field%VARIABLES(variable_idx)%PARAMETER_SETS%PARAMETER_SETS)
29397  ALLOCATE(field%VARIABLES(variable_idx)%PARAMETER_SETS%SET_TYPE(field_number_of_set_types),stat=err)
29398  IF(err/=0) CALL flagerror("Could not allocate field parameter sets set types.",err,error,*999)
29399  DO parameter_set_idx=1,field_number_of_set_types
29400  NULLIFY(field%VARIABLES(variable_idx)%PARAMETER_SETS%SET_TYPE(parameter_set_idx)%PTR)
29401  ENDDO !parameter_set_idx
29402  !Create a field values parameter set
29403  CALL field_parameter_set_create(field,field%VARIABLES(variable_idx)%VARIABLE_TYPE,field_values_set_type,err,error,*999)
29404  ENDDO !variable_idx
29405  ELSE
29406  CALL flagerror("Field is not associated.",err,error,*998)
29407  ENDIF
29408 
29409  exits("FIELD_PARAMETER_SETS_INITIALISE")
29410  RETURN
29411 999 DO variable_idx=1,field_number_of_variable_types
29412  IF(ASSOCIATED(field%VARIABLE_TYPE_MAP(variable_idx)%PTR)) &
29413  & CALL field_parameter_sets_finalise(field%VARIABLE_TYPE_MAP(variable_idx)%PTR,dummy_err,dummy_error,*998)
29414  ENDDO !variable_idx
29415 998 errorsexits("FIELD_PARAMETER_SETS_INITIALISE",err,error)
29416  RETURN 1
29417  END SUBROUTINE field_parameter_sets_initialise
29418 
29419  !
29420  !================================================================================================================================
29421  !
29422 
29424  SUBROUTINE field_region_get(FIELD,REGION,ERR,ERROR,*)
29425 
29426  !Argument variables
29427  TYPE(field_type), POINTER :: field
29428  TYPE(region_type), POINTER :: region
29429  INTEGER(INTG), INTENT(OUT) :: err
29430  TYPE(varying_string), INTENT(OUT) :: error
29431  !Local Variables
29432  TYPE(interface_type), POINTER :: interface
29433  TYPE(region_type), POINTER :: parent_region
29434  TYPE(varying_string) :: local_error
29435 
29436  enters("FIELD_REGION_GET",err,error,*999)
29437 
29438  IF(ASSOCIATED(field)) THEN
29439  IF(ASSOCIATED(region)) THEN
29440  CALL flagerror("Region is already associated.",err,error,*999)
29441  ELSE
29442  NULLIFY(region)
29443  NULLIFY(interface)
29444  region=>field%REGION
29445  IF(.NOT.ASSOCIATED(region)) THEN
29446  interface=>field%INTERFACE
29447  IF(ASSOCIATED(interface)) THEN
29448  parent_region=>interface%PARENT_REGION
29449  IF(ASSOCIATED(parent_region)) THEN
29450  region=>parent_region
29451  ELSE
29452  local_error="The parent region not associated for field number "// &
29453  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" of interface number "// &
29454  & trim(number_to_vstring(interface%USER_NUMBER,"*",err,error))//"."
29455  CALL flagerror(local_error,err,error,*999)
29456  ENDIF
29457  ELSE
29458  local_error="The region or interface is not associated for field number "// &
29459  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
29460  CALL flagerror(local_error,err,error,*999)
29461  ENDIF
29462  ENDIF
29463  ENDIF
29464  ELSE
29465  CALL flagerror("Field is not associated.",err,error,*999)
29466  ENDIF
29467 
29468  exits("FIELD_REGION_GET")
29469  RETURN
29470 999 errorsexits("FIELD_REGION_GET",err,error)
29471  RETURN 1
29472  END SUBROUTINE field_region_get
29473 
29474  !
29475  !================================================================================================================================
29476  !
29477 
29479  SUBROUTINE field_scaling_finalise(FIELD,SCALING_INDEX,ERR,ERROR,*)
29480 
29481  !Argument variables
29482  TYPE(field_type), POINTER :: field
29483  INTEGER(INTG), INTENT(IN) :: scaling_index
29484  INTEGER(INTG), INTENT(OUT) :: err
29485  TYPE(varying_string), INTENT(OUT) :: error
29486  !Local Variables
29487  TYPE(varying_string) :: local_error
29488 
29489  enters("FIELD_SCALING_FINALISE",err,error,*999)
29490 
29491  IF(ASSOCIATED(field)) THEN
29492  IF(scaling_index>0.AND.scaling_index<=field%SCALINGS%NUMBER_OF_SCALING_INDICES) THEN
29493  !IF(ALLOCATED(FIELD%SCALINGS%SCALINGS(SCALING_INDEX)%SCALE_FACTORS)) &
29494  ! & DEALLOCATE(FIELD%SCALINGS%SCALINGS(SCALING_INDEX)%SCALE_FACTORS)
29495  IF(ASSOCIATED(field%SCALINGS%SCALINGS(scaling_index)%SCALE_FACTORS)) &
29496  & CALL distributed_vector_destroy(field%SCALINGS%SCALINGS(scaling_index)%SCALE_FACTORS,err,error,*999)
29497  ELSE
29498  local_error="The scaling index of "//trim(number_to_vstring(scaling_index,"*",err,error))// &
29499  & " is invalid for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
29500  & " which has "//trim(number_to_vstring(field%SCALINGS%NUMBER_OF_SCALING_INDICES,"*",err,error))// &
29501  & " scaling indices."
29502  CALL flagerror(local_error,err,error,*999)
29503  ENDIF
29504  ELSE
29505  CALL flagerror("Field is not associated.",err,error,*999)
29506  ENDIF
29507 
29508  exits("FIELD_SCALING_FINALISE")
29509  RETURN
29510 999 errorsexits("FIELD_SCALING_FINALISE",err,error)
29511  RETURN 1
29512  END SUBROUTINE field_scaling_finalise
29513 
29514  !
29515  !================================================================================================================================
29516  !
29517 
29519  SUBROUTINE field_scaling_initialise(FIELD,SCALING_INDEX,MESH_COMPONENT_NUMBER,ERR,ERROR,*)
29520 
29521  !Argument variables
29522  TYPE(field_type), POINTER :: field
29523  INTEGER(INTG), INTENT(IN) :: scaling_index
29524  INTEGER(INTG), INTENT(IN) :: mesh_component_number
29525  INTEGER(INTG), INTENT(OUT) :: err
29526  TYPE(varying_string), INTENT(OUT) :: error
29527  !Local Variables
29528  TYPE(varying_string) :: local_error
29529 
29530  enters("FIELD_SCALING_INITIALISE",err,error,*999)
29531 
29532  IF(ASSOCIATED(field)) THEN
29533  IF(scaling_index>0.AND.scaling_index<=field%SCALINGS%NUMBER_OF_SCALING_INDICES) THEN
29534  IF(mesh_component_number>0.AND.mesh_component_number<=field%DECOMPOSITION%MESH%NUMBER_OF_COMPONENTS) THEN
29535  field%SCALINGS%SCALINGS(scaling_index)%MESH_COMPONENT_NUMBER=mesh_component_number
29536  field%SCALINGS%SCALINGS(scaling_index)%MAX_NUMBER_OF_ELEMENT_PARAMETERS=field%DECOMPOSITION% &
29537  & domain(mesh_component_number)%PTR%TOPOLOGY%ELEMENTS%MAXIMUM_NUMBER_OF_ELEMENT_PARAMETERS
29538  field%SCALINGS%SCALINGS(scaling_index)%MAX_NUMBER_OF_DERIVATIVES=field%DECOMPOSITION% &
29539  & domain(mesh_component_number)%PTR%TOPOLOGY%NODES%MAXIMUM_NUMBER_OF_DERIVATIVES
29540  NULLIFY(field%SCALINGS%SCALINGS(scaling_index)%SCALE_FACTORS)
29541  SELECT CASE(field%SCALINGS%SCALING_TYPE)
29542  CASE(field_no_scaling)
29543  !Do nothing
29544  CASE(field_unit_scaling,field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
29545  !ALLOCATE(FIELD%SCALINGS%SCALINGS(SCALING_INDEX)%SCALE_FACTORS(FIELD%SCALINGS%SCALINGS(SCALING_INDEX)% &
29546  ! & MAX_NUMBER_OF_DERIVATIVES,FIELD%DECOMPOSITION%DOMAIN(MESH_COMPONENT_NUMBER)%PTR%TOPOLOGY% &
29547  ! & NODES%TOTAL_NUMBER_OF_NODES),STAT=ERR)
29548  !IF(ERR/=0) CALL FlagError("Could not allocate scale factors",ERR,ERROR,*999)
29549  !FIELD%SCALINGS%SCALINGS(SCALING_INDEX)%SCALE_FACTORS=1.0_DP
29550  CALL distributed_vector_create_start(field%DECOMPOSITION%DOMAIN(mesh_component_number)%PTR%MAPPINGS%DOFS, &
29551  & field%SCALINGS%SCALINGS(scaling_index)%SCALE_FACTORS,err,error,*999)
29552  CALL distributed_vector_data_type_set(field%SCALINGS%SCALINGS(scaling_index)%SCALE_FACTORS, &
29553  & distributed_matrix_vector_dp_type,err,error,*999)
29554  CALL distributed_vector_create_finish(field%SCALINGS%SCALINGS(scaling_index)%SCALE_FACTORS,err,error,*999)
29555  IF(field%TYPE==field_geometric_type) THEN
29556  !Initialise the scalings to 1.0 for a geometric field. Other field types will be setup in FIELD_SCALINGS_CALCULATE
29557  CALL distributed_vector_all_values_set(field%SCALINGS%SCALINGS(scaling_index)%SCALE_FACTORS,1.0_dp,err,error,*999)
29558  ENDIF
29559  CASE(field_arc_length_scaling)
29560  CALL flagerror("Not implemented.",err,error,*999)
29561  CASE DEFAULT
29562  local_error="The scaling type of "//trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
29563  & " is invalid for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
29564  CALL flagerror(local_error,err,error,*999)
29565  END SELECT
29566  ELSE
29567  local_error="The mesh component number of "//trim(number_to_vstring(scaling_index,"*",err,error))// &
29568  & " is invalid for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
29569  & " which is associated with a mesh which has "//trim(number_to_vstring(field%DECOMPOSITION% &
29570  & mesh%NUMBER_OF_COMPONENTS,"*",err,error))//" mesh components."
29571  CALL flagerror(local_error,err,error,*999)
29572  ENDIF
29573  ELSE
29574  local_error="The scaling index of "//trim(number_to_vstring(scaling_index,"*",err,error))// &
29575  & " is invalid for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
29576  & " which has "//trim(number_to_vstring(field%SCALINGS%NUMBER_OF_SCALING_INDICES,"*",err,error))// &
29577  & " scaling indices."
29578  CALL flagerror(local_error,err,error,*999)
29579  ENDIF
29580  ELSE
29581  CALL flagerror("Field is not associated.",err,error,*999)
29582  ENDIF
29583 
29584  exits("FIELD_SCALING_INITIALISE")
29585  RETURN
29586 999 errorsexits("FIELD_SCALING_INITIALISE",err,error)
29587  RETURN 1
29588  END SUBROUTINE field_scaling_initialise
29589 
29590  !
29591  !================================================================================================================================
29592  !
29593 
29595  SUBROUTINE field_scalings_calculate(FIELD,ERR,ERROR,*)
29596 
29597  !Argument variables
29598  TYPE(field_type), POINTER :: field
29599  INTEGER(INTG), INTENT(OUT) :: err
29600  TYPE(varying_string), INTENT(OUT) :: error
29601  !Local Variables
29602  INTEGER(INTG) :: mesh_component_number,xi_direction,ni1,ni2,version_idx,derivative_idx,nk2,local_node_line_idx, &
29603  & adjacent_local_node_line_idx,node_line_idx,node_idx,partial_derivative_idx,nu1,nu2,dof_idx,ny1,ny2,ny3,scaling_idx
29604  REAL(DP) :: length1,length2,mean_length,temp,number_of_line_versions1,number_of_line_versions2,value
29605  REAL(DP), POINTER :: scale_factors(:)
29606  LOGICAL :: found
29607  TYPE(decomposition_lines_type), POINTER :: decomposition_lines
29608  TYPE(domain_type), POINTER :: domain
29609  TYPE(domain_lines_type), POINTER :: domain_lines
29610  TYPE(domain_nodes_type), POINTER :: domain_nodes
29611  TYPE(field_type), POINTER :: geometric_field
29612  TYPE(field_scaling_type), POINTER :: field_scaling
29613  TYPE(field_scalings_type), POINTER :: field_scalings
29614  TYPE(varying_string) :: local_error
29615 
29616  enters("FIELD_SCALINGS_CALCULATE",err,error,*999)
29617 
29618  IF(ASSOCIATED(field)) THEN
29619  field_scalings=>field%SCALINGS
29620  IF(ASSOCIATED(field_scalings)) THEN
29621  geometric_field=>field%GEOMETRIC_FIELD
29622  IF(ASSOCIATED(geometric_field)) THEN
29623  SELECT CASE(field_scalings%SCALING_TYPE)
29624  CASE(field_no_scaling)
29625  !Do nothing
29626  NULLIFY(domain)
29627  CASE(field_unit_scaling)
29628  DO scaling_idx=1,field_scalings%NUMBER_OF_SCALING_INDICES
29629  field_scaling=>field_scalings%SCALINGS(scaling_idx)
29630  mesh_component_number=field_scaling%MESH_COMPONENT_NUMBER
29631  domain=>field%DECOMPOSITION%DOMAIN(mesh_component_number)%PTR
29632  CALL distributed_vector_all_values_set(field_scaling%SCALE_FACTORS,1.0_dp,err,error,*999)
29633  CALL distributed_vector_update_start(field_scaling%SCALE_FACTORS,err,error,*999)
29634  CALL distributed_vector_update_finish(field_scaling%SCALE_FACTORS,err,error,*999)
29635  ENDDO !scaling_idx
29636  CASE(field_arc_length_scaling)
29637  CALL flagerror("Not implemented.",err,error,*999)
29638 
29639  CASE(field_arithmetic_mean_scaling,field_geometric_mean_scaling,field_harmonic_mean_scaling)
29640  DO scaling_idx=1,field_scalings%NUMBER_OF_SCALING_INDICES
29641  field_scaling=>field_scalings%SCALINGS(scaling_idx)
29642  mesh_component_number=field_scaling%MESH_COMPONENT_NUMBER
29643  domain=>field%DECOMPOSITION%DOMAIN(mesh_component_number)%PTR
29644  domain_nodes=>domain%TOPOLOGY%NODES
29645  IF(field%DECOMPOSITION%CALCULATE_LINES) THEN
29646  domain_lines=>domain%TOPOLOGY%LINES
29647  decomposition_lines=>field%DECOMPOSITION%TOPOLOGY%LINES
29648  ENDIF
29649  NULLIFY(scale_factors)
29650  CALL distributed_vector_data_get(field_scaling%SCALE_FACTORS,scale_factors,err,error,*999)
29651  DO node_idx=1,domain_nodes%NUMBER_OF_NODES
29652  DO derivative_idx=1,domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
29653  partial_derivative_idx=domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%PARTIAL_DERIVATIVE_INDEX
29654  SELECT CASE(partial_derivative_idx)
29655  CASE(no_part_deriv)
29656  DO version_idx=1,domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
29657  dof_idx=domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%DOF_INDEX(version_idx)
29658  CALL distributed_vector_values_set(field_scaling%SCALE_FACTORS,dof_idx,1.0_dp,err,error,*999)
29659  ENDDO
29660  CASE(part_deriv_s1,part_deriv_s2,part_deriv_s3)
29661  IF(field%DECOMPOSITION%CALCULATE_LINES) THEN
29662  IF(partial_derivative_idx==part_deriv_s1) THEN
29663  xi_direction=1
29664  ELSE IF(partial_derivative_idx==part_deriv_s2) THEN
29665  xi_direction=2
29666  ELSE
29667  xi_direction=3
29668  ENDIF
29669  length1 = 0.0_dp
29670  length2 = 0.0_dp
29671  number_of_line_versions1 = 0.0_dp
29672  number_of_line_versions2 = 0.0_dp
29673  DO version_idx=1,domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
29674  !Find a line of the correct Xi direction going through this node
29675  found=.false.
29676  DO node_line_idx=1,domain_nodes%NODES(node_idx)%NUMBER_OF_NODE_LINES
29677  local_node_line_idx=domain_nodes%NODES(node_idx)%NODE_LINES(node_line_idx)
29678  IF(decomposition_lines%LINES(local_node_line_idx)%XI_DIRECTION==xi_direction) THEN
29679  found=.true.
29680  EXIT
29681  ENDIF
29682  ENDDO !node_line_idx
29683  IF(found) THEN
29684  IF(domain_lines%LINES(local_node_line_idx)%NODES_IN_LINE(1)==node_idx) THEN !Current node at the beginning of the line
29685  adjacent_local_node_line_idx=decomposition_lines%LINES(local_node_line_idx)%ADJACENT_LINES(0)
29686  ELSE !Current node at the end of the line
29687  adjacent_local_node_line_idx=decomposition_lines%LINES(local_node_line_idx)%ADJACENT_LINES(1)
29688  ENDIF
29689  !Average line lengths for the different versions (division by the number of lines is done after all the line lengths are added together)
29690  length1=length1+geometric_field%GEOMETRIC_FIELD_PARAMETERS%LENGTHS(local_node_line_idx)
29691  number_of_line_versions1=number_of_line_versions1+1
29692  IF(adjacent_local_node_line_idx/=0) THEN !Adjacent node and therefore lines exist
29693  length2=length2+geometric_field%GEOMETRIC_FIELD_PARAMETERS%LENGTHS(adjacent_local_node_line_idx)
29694  number_of_line_versions2=number_of_line_versions2+1
29695  ENDIF
29696  ELSE
29697  local_error="Could not find a line in the Xi "//trim(number_to_vstring(xi_direction,"*",err,error))// &
29698  & " direction going through node number "//trim(number_to_vstring(node_idx,"*",err,error))//"."
29699  CALL flagerror(local_error,err,error,*999)
29700  ENDIF
29701  ENDDO !version_idx
29702  !Division by the numer of version for this node derivative, completing the calculation for the average line lengths
29703  length1 = length1/number_of_line_versions1
29704  IF(adjacent_local_node_line_idx==0) THEN !No adjacent node ie end of mesh
29705  mean_length=length1
29706  ELSE !Adjacent node and therefore lines exist
29707  length2 = length2/number_of_line_versions2
29708  SELECT CASE(field_scalings%SCALING_TYPE)
29709  CASE(field_arithmetic_mean_scaling)
29710  mean_length=(length1+length2)/2.0_dp
29711  CASE(field_geometric_mean_scaling)
29712  mean_length=sqrt(length1*length2)
29713  CASE(field_harmonic_mean_scaling)
29714  temp=length1*length2
29715  IF(abs(temp)>zero_tolerance) THEN
29716  mean_length=2.0_dp*temp/(length1+length2)
29717  ELSE
29718  mean_length=0.0_dp
29719  ENDIF
29720  CASE DEFAULT
29721  local_error="The scaling type of "// &
29722  & trim(number_to_vstring(field_scalings%SCALING_TYPE,"*",err,error))//" is invalid."
29723  CALL flagerror(local_error,err,error,*999)
29724  END SELECT
29725  ENDIF
29726  DO version_idx=1,domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
29727  dof_idx=domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%DOF_INDEX(version_idx)
29728  CALL distributed_vector_values_set(field_scaling%SCALE_FACTORS,dof_idx,mean_length,err,error,*999)
29729  ENDDO !version_idx
29730  ENDIF
29731  CASE(part_deriv_s1_s2,part_deriv_s1_s3,part_deriv_s2_s3,part_deriv_s1_s2_s3)
29732  DO version_idx=1,domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
29733  dof_idx=domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%DOF_INDEX(version_idx)
29734  IF(partial_derivative_idx==part_deriv_s1_s2) THEN
29735  ni1=1
29736  nu1=part_deriv_s1
29737  ni2=2
29738  nu2=part_deriv_s2
29739  ELSE IF(partial_derivative_idx==part_deriv_s1_s3) THEN
29740  ni1=1
29741  nu1=part_deriv_s1
29742  ni2=3
29743  nu2=part_deriv_s3
29744  ELSE IF(partial_derivative_idx==part_deriv_s2_s3) THEN
29745  ni1=2
29746  nu1=part_deriv_s2
29747  ni2=3
29748  nu2=part_deriv_s3
29749  ELSE
29750  ni1=1
29751  nu1=part_deriv_s1
29752  ni2=2
29753  nu2=part_deriv_s2
29754  ENDIF
29755  !!TODO: Shouldn't have to search for the derivative_idx directions. Store them somewhere.
29756  !Find the first direction derivative_idx
29757  found=.false.
29758  DO nk2=1,domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
29759  IF(domain_nodes%NODES(node_idx)%DERIVATIVES(nk2)%PARTIAL_DERIVATIVE_INDEX==nu1) THEN
29760  ny1=domain_nodes%NODES(node_idx)%DERIVATIVES(nk2)%DOF_INDEX(version_idx)
29761  found=.true.
29762  EXIT
29763  ENDIF
29764  ENDDO !nk2
29765  IF(found) THEN
29766  !Find the second direction derivative_idx
29767  found=.false.
29768  DO nk2=1,domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
29769  IF(domain_nodes%NODES(node_idx)%DERIVATIVES(nk2)%PARTIAL_DERIVATIVE_INDEX==nu2) THEN
29770  ny2=domain_nodes%NODES(node_idx)%DERIVATIVES(nk2)%DOF_INDEX(version_idx)
29771  found=.true.
29772  EXIT
29773  ENDIF
29774  ENDDO !nk2
29775  IF(found) THEN
29776  IF(partial_derivative_idx==part_deriv_s1_s2_s3) THEN
29777  !Find the third direction derivative_idx
29778  found=.false.
29779  DO nk2=1,domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
29780  IF(domain_nodes%NODES(node_idx)%DERIVATIVES(nk2)%PARTIAL_DERIVATIVE_INDEX==part_deriv_s3) THEN
29781  ny3=domain_nodes%NODES(node_idx)%DERIVATIVES(nk2)%DOF_INDEX(version_idx)
29782  found=.true.
29783  EXIT
29784  ENDIF
29785  ENDDO !nk2
29786  IF(found) THEN
29787  CALL distributed_vector_values_set(field_scaling%SCALE_FACTORS,dof_idx, &
29788  scale_factors(ny1)*scale_factors(ny2)*scale_factors(ny3),err,error,*999)
29789  ELSE
29790  local_error="Could not find the first partial derivative in the s3 direction index for "//&
29791  & "local node number "//trim(number_to_vstring(node_idx,"*",err,error))//"."
29792  CALL flagerror(local_error,err,error,*999)
29793  ENDIF
29794  ELSE
29795  CALL distributed_vector_values_set(field_scaling%SCALE_FACTORS,dof_idx,scale_factors(ny1)* &
29796  & scale_factors(ny2),err,error,*999)
29797  ENDIF
29798  ELSE
29799  local_error="Could not find the first partial derivative in the s"// &
29800  & trim(number_to_vstring(ni2,"*",err,error))//" direction index for "//&
29801  & "local node number "//trim(number_to_vstring(node_idx,"*",err,error))//"."
29802  CALL flagerror(local_error,err,error,*999)
29803  ENDIF
29804  ELSE
29805  local_error="Could not find the first partial derivative in the s"// &
29806  & trim(number_to_vstring(ni1,"*",err,error))//" direction index for "//&
29807  & "local node number "//trim(number_to_vstring(node_idx,"*",err,error))//"."
29808  ENDIF
29809  ENDDO !version_idx
29810  CASE DEFAULT
29811  local_error="The partial derivative index of "//trim(number_to_vstring(partial_derivative_idx,"*", &
29812  & err,error))//" for derivative number "//trim(number_to_vstring(derivative_idx,"*",err,error))// &
29813  & " of local node number "//trim(number_to_vstring(node_idx,"*",err,error))//" is invalid."
29814  CALL flagerror(local_error,err,error,*999)
29815  END SELECT
29816  ENDDO !derivative_idx
29817  ENDDO !node_idx
29818  CALL distributed_vector_update_start(field_scaling%SCALE_FACTORS,err,error,*999)
29819  CALL distributed_vector_update_finish(field_scaling%SCALE_FACTORS,err,error,*999)
29820  ENDDO !scaling_idx
29821  CASE DEFAULT
29822  local_error="The scaling type of "//trim(number_to_vstring(field_scalings%SCALING_TYPE,"*",err,error))// &
29823  & " is invalid."
29824  CALL flagerror(local_error,err,error,*999)
29825  END SELECT
29826  ELSE
29827  CALL flagerror("Field geometric field is not associated.",err,error,*999)
29828  ENDIF
29829  ELSE
29830  CALL flagerror("Field scalings is not associated.",err,error,*999)
29831  ENDIF
29832  ELSE
29833  CALL flagerror("Field is not associated.",err,error,*999)
29834  ENDIF
29835 
29836  IF(diagnostics1) THEN
29837  IF(field_scalings%SCALING_TYPE /= field_no_scaling) THEN
29838  IF(ASSOCIATED(domain))THEN
29839  domain_nodes=>domain%TOPOLOGY%NODES
29840  CALL write_string(diagnostic_output_type,"Scale Factors for nodes in the domain:",err,error,*999)
29841  DO node_idx=1,domain_nodes%NUMBER_OF_NODES
29842  CALL write_string_value(diagnostic_output_type,"Node : ",node_idx,err,error,*999)
29843  CALL write_string_value(diagnostic_output_type," Number of Derivatives = ", &
29844  & domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES,err,error,*999)
29845  DO derivative_idx=1,domain_nodes%NODES(node_idx)%NUMBER_OF_DERIVATIVES
29846  CALL write_string_value(diagnostic_output_type," Derivative : ",derivative_idx,err,error,*999)
29847  CALL write_string_value(diagnostic_output_type," Number of Versions = ", &
29848  & domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions,err,error,*999)
29849  DO version_idx=1,domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%numberOfVersions
29850  CALL write_string_value(diagnostic_output_type," Version : ",version_idx,err,error,*999)
29851  dof_idx=domain_nodes%NODES(node_idx)%DERIVATIVES(derivative_idx)%DOF_INDEX(version_idx)
29852  CALL distributed_vector_values_get(field_scaling%SCALE_FACTORS,dof_idx,VALUE,err,error,*999)
29853  CALL write_string_value(diagnostic_output_type," Scale Factor : ",VALUE,err,error,*999)
29854  ENDDO !version_idx
29855  ENDDO !derivative_idx
29856  ENDDO !node_idx
29857  ENDIF
29858  ENDIF
29859  ENDIF
29860 
29861  exits("FIELD_SCALINGS_CALCULATE")
29862  RETURN
29863 999 errorsexits("FIELD_SCALINGS_CALCULATE",err,error)
29864  RETURN 1
29865  END SUBROUTINE field_scalings_calculate
29866 
29867  !
29868  !================================================================================================================================
29869  !
29870 
29872  SUBROUTINE field_scalings_finalise(FIELD,ERR,ERROR,*)
29873 
29874  !Argument variables
29875  TYPE(field_type), POINTER :: field
29876  INTEGER(INTG), INTENT(OUT) :: err
29877  TYPE(varying_string), INTENT(OUT) :: error
29878  !Local Variables
29879  INTEGER(INTG) :: scaling_idx
29880 
29881  enters("FIELD_SCALINGS_FINALISE",err,error,*999)
29882 
29883  IF(ASSOCIATED(field)) THEN
29884  DO scaling_idx=1,field%SCALINGS%NUMBER_OF_SCALING_INDICES
29885  CALL field_scaling_finalise(field,scaling_idx,err,error,*999)
29886  ENDDO !scaling_idx
29887  IF(ALLOCATED(field%SCALINGS%SCALINGS)) DEALLOCATE(field%SCALINGS%SCALINGS)
29888  ELSE
29889  CALL flagerror("Field is not associated.",err,error,*999)
29890  ENDIF
29891 
29892  exits("FIELD_SCALINGS_FINALISE")
29893  RETURN
29894 999 errorsexits("FIELD_SCALINGS_FINALISE",err,error)
29895  RETURN 1
29896  END SUBROUTINE field_scalings_finalise
29897 
29898  !
29899  !================================================================================================================================
29900  !
29901 
29903  SUBROUTINE field_scalings_initialise(FIELD,ERR,ERROR,*)
29904 
29905  !Argument variables
29906  TYPE(field_type), POINTER :: field
29907  INTEGER(INTG), INTENT(OUT) :: err
29908  TYPE(varying_string), INTENT(OUT) :: error
29909  !Local Variables
29910  INTEGER(INTG) :: component_idx,dummy_err,number_of_mesh_components,scaling_idx,variable_idx
29911  INTEGER(INTG), ALLOCATABLE :: mesh_components(:),mesh_components_map(:)
29912  TYPE(list_type), POINTER :: mesh_components_list
29913  TYPE(varying_string) :: dummy_error
29914 
29915  NULLIFY(mesh_components_list)
29916 
29917  enters("FIELD_SCALINGS_INITIALISE",err,error,*997)
29918 
29919  IF(ASSOCIATED(field)) THEN
29920  !Calculate the mesh component numbers involved in the field
29921  CALL list_create_start(mesh_components_list,err,error,*999)
29922  CALL list_data_type_set(mesh_components_list,list_intg_type,err,error,*999)
29923  CALL list_initial_size_set(mesh_components_list,field%DECOMPOSITION%MESH%NUMBER_OF_COMPONENTS,err,error,*999)
29924  CALL list_create_finish(mesh_components_list,err,error,*999)
29925  DO variable_idx=1,field%NUMBER_OF_VARIABLES
29926  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
29927  CALL list_item_add(mesh_components_list,field%VARIABLES(variable_idx)%COMPONENTS(component_idx)%MESH_COMPONENT_NUMBER, &
29928  & err,error,*999)
29929  ENDDO !component_idx
29930  ENDDO !variable_idx
29931  CALL list_remove_duplicates(mesh_components_list,err,error,*999)
29932  CALL list_detach_and_destroy(mesh_components_list,number_of_mesh_components,mesh_components,err,error,*999)
29933  ALLOCATE(mesh_components_map(field%DECOMPOSITION%MESH%NUMBER_OF_COMPONENTS),stat=err)
29934  IF(err/=0) CALL flagerror("Could not allocate mesh components map.",err,error,*999)
29935  mesh_components_map=0
29936  DO component_idx=1,number_of_mesh_components
29937  mesh_components_map(mesh_components(component_idx))=component_idx
29938  ENDDO !component_idx
29939  !Allocate the scaling indices and initialise them
29940  field%SCALINGS%NUMBER_OF_SCALING_INDICES=number_of_mesh_components
29941  ALLOCATE(field%SCALINGS%SCALINGS(field%SCALINGS%NUMBER_OF_SCALING_INDICES),stat=err)
29942  IF(err/=0) CALL flagerror("Could not allocate field scalings.",err,error,*999)
29943  DO scaling_idx=1,field%SCALINGS%NUMBER_OF_SCALING_INDICES
29944  CALL field_scaling_initialise(field,scaling_idx,mesh_components(scaling_idx),err,error,*999)
29945  ENDDO !scaling_idx
29946  !Set the scaling index for all the field variable components
29947  DO variable_idx=1,field%NUMBER_OF_VARIABLES
29948  DO component_idx=1,field%VARIABLES(variable_idx)%NUMBER_OF_COMPONENTS
29949  field%VARIABLES(variable_idx)%COMPONENTS(component_idx)%SCALING_INDEX= &
29950  & mesh_components_map(field%VARIABLES(variable_idx)%COMPONENTS(component_idx)%MESH_COMPONENT_NUMBER)
29951  ENDDO !component_idx
29952  ENDDO !variable_idx
29953  DEALLOCATE(mesh_components)
29954  IF(field%TYPE/=field_geometric_type) CALL field_scalings_calculate(field,err,error,*999)
29955  ELSE
29956  CALL flagerror("Field is not associated.",err,error,*997)
29957  ENDIF
29958 
29959  exits("FIELD_SCALINGS_INITIALISE")
29960  RETURN
29961 999 IF(ALLOCATED(mesh_components)) DEALLOCATE(mesh_components)
29962  IF(ASSOCIATED(mesh_components_list)) CALL list_destroy(mesh_components_list,err,error,*998)
29963 998 CALL field_scalings_finalise(field,dummy_err,dummy_error,*997)
29964 997 errorsexits("FIELD_SCALINGS_INITIALISE",err,error)
29965  RETURN 1
29966  END SUBROUTINE field_scalings_initialise
29967 
29968  !
29969  !================================================================================================================================
29970  !
29971 
29973  SUBROUTINE field_scaling_type_check(FIELD,SCALING_TYPE,ERR,ERROR,*)
29974 
29975  !Argument variables
29976  TYPE(field_type), POINTER :: field
29977  INTEGER(INTG), INTENT(IN) :: scaling_type
29978  INTEGER(INTG), INTENT(OUT) :: err
29979  TYPE(varying_string), INTENT(OUT) :: error
29980  !Local Variables
29981  TYPE(varying_string) :: local_error
29982 
29983  enters("FIELD_SCALING_TYPE_CHECK",err,error,*999)
29984 
29985  IF(ASSOCIATED(field)) THEN
29986  IF(field%FIELD_FINISHED) THEN
29987  SELECT CASE(scaling_type)
29988  CASE(field_no_scaling)
29989  IF(field%SCALINGS%SCALING_TYPE/=field_no_scaling) THEN
29990  local_error="Invalid scaling type. The scaling type for field number "// &
29991  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
29992  & trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
29993  & " which is not no scaling."
29994  CALL flagerror(local_error,err,error,*999)
29995  ENDIF
29996  CASE(field_unit_scaling)
29997  IF(field%SCALINGS%SCALING_TYPE/=field_unit_scaling) THEN
29998  local_error="Invalid scaling type. The scaling type for field number "// &
29999  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
30000  & trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
30001  & " which is not unit scaling."
30002  CALL flagerror(local_error,err,error,*999)
30003  ENDIF
30004  CASE(field_arc_length_scaling)
30005  IF(field%SCALINGS%SCALING_TYPE/=field_arc_length_scaling) THEN
30006  local_error="Invalid scaling type. The scaling type for field number "// &
30007  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
30008  & trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
30009  & " which is not arc length scaling."
30010  CALL flagerror(local_error,err,error,*999)
30011  ENDIF
30012  CASE(field_arithmetic_mean_scaling)
30013  IF(field%SCALINGS%SCALING_TYPE/=field_arithmetic_mean_scaling) THEN
30014  local_error="Invalid scaling type. The scaling type for field number "// &
30015  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
30016  & trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
30017 
30018  & " which is not arithmetic mean scaling."
30019  CALL flagerror(local_error,err,error,*999)
30020  ENDIF
30021  CASE(field_geometric_mean_scaling)
30022  IF(field%SCALINGS%SCALING_TYPE/=field_geometric_mean_scaling) THEN
30023  local_error="Invalid scaling type. The scaling type for field number "// &
30024  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
30025  & trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
30026 
30027  & " which is not geometric mean scaling."
30028  CALL flagerror(local_error,err,error,*999)
30029  ENDIF
30030  CASE(field_harmonic_mean_scaling)
30031  IF(field%SCALINGS%SCALING_TYPE/=field_harmonic_mean_scaling) THEN
30032  local_error="Invalid scaling type. The scaling type for field number "// &
30033  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
30034  & trim(number_to_vstring(field%SCALINGS%SCALING_TYPE,"*",err,error))// &
30035  & " which is not harmonic mean scaling."
30036  CALL flagerror(local_error,err,error,*999)
30037  ENDIF
30038  CASE DEFAULT
30039  local_error="The specified scaling type of "//trim(number_to_vstring(scaling_type,"*",err,error))// &
30040  & " is invalid."
30041  CALL flagerror(local_error,err,error,*999)
30042  END SELECT
30043  ELSE
30044  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
30045  & " has not been finished."
30046  CALL flagerror(local_error,err,error,*999)
30047  ENDIF
30048  ELSE
30049  CALL flagerror("Field is not associated.",err,error,*999)
30050  ENDIF
30051 
30052  exits("FIELD_SCALING_TYPE_CHECK")
30053  RETURN
30054 999 errorsexits("FIELD_SCALING_TYPE_CHECK",err,error)
30055  RETURN 1
30056  END SUBROUTINE field_scaling_type_check
30057 
30058  !
30059  !================================================================================================================================
30060  !
30061 
30063  SUBROUTINE field_scaling_type_get(FIELD,SCALING_TYPE,ERR,ERROR,*)
30064 
30065  !Argument variables
30066  TYPE(field_type), POINTER :: field
30067  INTEGER(INTG), INTENT(OUT) :: scaling_type
30068  INTEGER(INTG), INTENT(OUT) :: err
30069  TYPE(varying_string), INTENT(OUT) :: error
30070  !Local Variables
30071  TYPE(varying_string) :: local_error
30072 
30073  enters("FIELD_SCALING_TYPE_GET",err,error,*999)
30074 
30075  IF(ASSOCIATED(field)) THEN
30076  IF(field%FIELD_FINISHED) THEN
30077  scaling_type=field%SCALINGS%SCALING_TYPE
30078  ELSE
30079  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
30080  & " has not been finished."
30081  CALL flagerror(local_error,err,error,*999)
30082  ENDIF
30083  ELSE
30084  CALL flagerror("Field is not associated.",err,error,*999)
30085  ENDIF
30086 
30087  exits("FIELD_SCALING_TYPE_GET")
30088  RETURN
30089 999 errorsexits("FIELD_SCALING_TYPE_GET",err,error)
30090  RETURN 1
30091  END SUBROUTINE field_scaling_type_get
30092 
30093  !
30094  !================================================================================================================================
30095  !
30096 
30098  SUBROUTINE field_scaling_type_set(FIELD,SCALING_TYPE,ERR,ERROR,*)
30099 
30100  !Argument variables
30101  TYPE(field_type), POINTER :: field
30102  INTEGER(INTG), INTENT(IN) :: scaling_type
30103  INTEGER(INTG), INTENT(OUT) :: err
30104  TYPE(varying_string), INTENT(OUT) :: error
30105  !Local Variables
30106  TYPE(varying_string) :: local_error
30107 
30108  enters("FIELD_SCALING_TYPE_SET",err,error,*999)
30109 
30110  IF(ASSOCIATED(field)) THEN
30111  IF(field%FIELD_FINISHED) THEN
30112  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
30113  & " has been finished."
30114  CALL flagerror(local_error,err,error,*999)
30115  ELSE
30116  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
30117  IF(field%CREATE_VALUES_CACHE%SCALING_TYPE_LOCKED) THEN
30118  local_error="The field scaling type has been locked for field number "// &
30119  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
30120  CALL flagerror(local_error,err,error,*999)
30121  ELSE
30122  SELECT CASE(scaling_type)
30123  CASE(field_no_scaling)
30124  field%SCALINGS%SCALING_TYPE=field_no_scaling
30125  CASE(field_unit_scaling)
30126  field%SCALINGS%SCALING_TYPE=field_unit_scaling
30127  CASE(field_arc_length_scaling)
30128  field%SCALINGS%SCALING_TYPE=field_arc_length_scaling
30129  CASE(field_arithmetic_mean_scaling)
30130  field%SCALINGS%SCALING_TYPE=field_arithmetic_mean_scaling
30131  CASE(field_geometric_mean_scaling)
30132  field%SCALINGS%SCALING_TYPE=field_geometric_mean_scaling
30133  CASE(field_harmonic_mean_scaling)
30134  field%SCALINGS%SCALING_TYPE=field_harmonic_mean_scaling
30135  CASE DEFAULT
30136  local_error="The specified scaling type of "//trim(number_to_vstring(scaling_type,"*",err,error))// &
30137  & " is invalid."
30138  CALL flagerror(local_error,err,error,*999)
30139  END SELECT
30140  ENDIF
30141  ELSE
30142  local_error="Field create values cache is not associated for field number "// &
30143  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30144  CALL flagerror(local_error,err,error,*999)
30145  ENDIF
30146  ENDIF
30147  ELSE
30148  CALL flagerror("Field is not associated.",err,error,*999)
30149  ENDIF
30150 
30151  exits("FIELD_SCALING_TYPE_SET")
30152  RETURN
30153 999 errorsexits("FIELD_SCALING_TYPE_SET",err,error)
30154  RETURN 1
30155  END SUBROUTINE field_scaling_type_set
30156 
30157  !
30158  !================================================================================================================================
30159  !
30160 
30162  SUBROUTINE field_scaling_type_set_and_lock(FIELD,SCALING_TYPE,ERR,ERROR,*)
30163 
30164  !Argument variables
30165  TYPE(field_type), POINTER :: field
30166  INTEGER(INTG), INTENT(IN) :: scaling_type
30167  INTEGER(INTG), INTENT(OUT) :: err
30168  TYPE(varying_string), INTENT(OUT) :: error
30169  !Local Variables
30170  TYPE(varying_string) :: local_error
30171 
30172  enters("FIELD_SCALING_TYPE_SET_AND_LOCK",err,error,*999)
30173 
30174  CALL field_scaling_type_set(field,scaling_type,err,error,*999)
30175  IF(ASSOCIATED(field)) THEN
30176  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
30177  field%CREATE_VALUES_CACHE%SCALING_TYPE_LOCKED=.true.
30178  ELSE
30179  local_error="Field create values cache is not associated for field number "// &
30180  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30181  CALL flagerror(local_error,err,error,*999)
30182  ENDIF
30183  ELSE
30184  CALL flagerror("Field is not associated.",err,error,*999)
30185  ENDIF
30186 
30187  exits("FIELD_SCALING_TYPE_SET_AND_LOCK")
30188  RETURN
30189 999 errorsexits("FIELD_SCALING_TYPE_SET_AND_LOCK",err,error)
30190  RETURN 1
30191  END SUBROUTINE field_scaling_type_set_and_lock
30192 
30193  !
30194  !================================================================================================================================
30195  !
30196 
30198  SUBROUTINE field_type_check(FIELD,TYPE,ERR,ERROR,*)
30199 
30200  !Argument variables
30201  TYPE(field_type), POINTER :: field
30202  INTEGER(INTG), INTENT(IN) :: TYPE
30203  INTEGER(INTG), INTENT(OUT) :: err
30204  TYPE(varying_string), INTENT(OUT) :: error
30205  !Local Variables
30206  TYPE(varying_string) :: local_error
30207 
30208  enters("FIELD_TYPE_CHECK",err,error,*999)
30209 
30210  IF(ASSOCIATED(field)) THEN
30211  IF(field%FIELD_FINISHED) THEN
30212  SELECT CASE(type)
30213  CASE(field_geometric_type)
30214  IF(field%TYPE/=field_geometric_type) THEN
30215  local_error="Invalid field type. The field type for field number "// &
30216  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
30217  & trim(number_to_vstring(field%TYPE,"*",err,error))// &
30218  & " which is not a geometric field."
30219  CALL flagerror(local_error,err,error,*999)
30220  ENDIF
30221  CASE(field_fibre_type)
30222  IF(field%TYPE/=field_fibre_type) THEN
30223  local_error="Invalid field type. The field type for field number "// &
30224  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
30225  & trim(number_to_vstring(field%TYPE,"*",err,error))// &
30226  & " which is not a fibre field."
30227  CALL flagerror(local_error,err,error,*999)
30228  ENDIF
30229  CASE(field_general_type)
30230  IF(field%TYPE/=field_general_type) THEN
30231  local_error="Invalid field type. The field type for field number "// &
30232  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
30233  & trim(number_to_vstring(field%TYPE,"*",err,error))// &
30234  & " which is not a general field."
30235  CALL flagerror(local_error,err,error,*999)
30236  ENDIF
30237  CASE(field_material_type)
30238  IF(field%TYPE/=field_material_type) THEN
30239  local_error="Invalid field type. The field type for field number "// &
30240  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
30241  & trim(number_to_vstring(field%TYPE,"*",err,error))// &
30242  & " which is not a material field."
30243  CALL flagerror(local_error,err,error,*999)
30244  ENDIF
30245  CASE(field_geometric_general_type)
30246  IF(field%TYPE/=field_geometric_general_type) THEN
30247  local_error="Invalid field type. The field type for field number "// &
30248  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
30249  & trim(number_to_vstring(field%TYPE,"*",err,error))// &
30250  & " which is not a geometric general field."
30251  CALL flagerror(local_error,err,error,*999)
30252  ENDIF
30253  CASE DEFAULT
30254  local_error="The specified field type of "//trim(number_to_vstring(TYPE,"*",err,error))//" is invalid."
30255  CALL flagerror(local_error,err,error,*999)
30256  END SELECT
30257  ELSE
30258  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
30259  & " has not been finished."
30260  CALL flagerror(local_error,err,error,*999)
30261  ENDIF
30262  ELSE
30263  CALL flagerror("Field is not associated.",err,error,*999)
30264  ENDIF
30265 
30266  exits("FIELD_TYPE_CHECK")
30267  RETURN
30268 999 errorsexits("FIELD_TYPE_CHECK",err,error)
30269  RETURN 1
30270  END SUBROUTINE field_type_check
30271 
30272  !
30273  !================================================================================================================================
30274  !
30275 
30277  SUBROUTINE field_type_get(FIELD,TYPE,ERR,ERROR,*)
30278 
30279  !Argument variables
30280  TYPE(field_type), POINTER :: field
30281  INTEGER(INTG), INTENT(OUT) :: TYPE
30282  INTEGER(INTG), INTENT(OUT) :: err
30283  TYPE(varying_string), INTENT(OUT) :: error
30284  !Local Variables
30285  TYPE(varying_string) :: local_error
30286 
30287  enters("FIELD_TYPE_GET",err,error,*999)
30288 
30289  IF(ASSOCIATED(field)) THEN
30290  IF(field%FIELD_FINISHED) THEN
30291  TYPE=field%TYPE
30292  ELSE
30293  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
30294  & " has not been finished."
30295  CALL flagerror(local_error,err,error,*999)
30296  ENDIF
30297  ELSE
30298  CALL flagerror("Field is not associated.",err,error,*999)
30299  ENDIF
30300 
30301  exits("FIELD_TYPE_GET")
30302  RETURN
30303 999 errorsexits("FIELD_TYPE_GET",err,error)
30304  RETURN 1
30305  END SUBROUTINE field_type_get
30306 
30307  !
30308  !================================================================================================================================
30309  !
30310 
30312  SUBROUTINE field_type_set(FIELD,TYPE,ERR,ERROR,*)
30313 
30314  !Argument variables
30315  TYPE(field_type), POINTER :: field
30316  INTEGER(INTG), INTENT(IN) :: TYPE
30317  INTEGER(INTG), INTENT(OUT) :: err
30318  TYPE(varying_string), INTENT(OUT) :: error
30319  !Local Variables
30320  TYPE(varying_string) :: local_error
30321 
30322  enters("FIELD_TYPE_SET",err,error,*999)
30323 
30324  IF(ASSOCIATED(field)) THEN
30325  IF(field%FIELD_FINISHED) THEN
30326  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
30327  & " has been finished."
30328  CALL flagerror(local_error,err,error,*999)
30329  ELSE
30330  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
30331  IF(field%CREATE_VALUES_CACHE%TYPE_LOCKED) THEN
30332  local_error="The field type has been locked for field number "// &
30333  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
30334  CALL flagerror(local_error,err,error,*999)
30335  ELSE
30336  SELECT CASE(type)
30337  CASE(field_geometric_type)
30338  field%TYPE=field_geometric_type
30339  field%GEOMETRIC_FIELD=>field
30340  CASE(field_fibre_type)
30341  field%TYPE=field_fibre_type
30342  NULLIFY(field%GEOMETRIC_FIELD)
30343  CASE(field_general_type)
30344  field%TYPE=field_general_type
30345  NULLIFY(field%GEOMETRIC_FIELD)
30346  CASE(field_material_type)
30347  field%TYPE=field_material_type
30348  NULLIFY(field%GEOMETRIC_FIELD)
30349  CASE(field_geometric_general_type)
30350  field%TYPE=field_geometric_general_type
30351  NULLIFY(field%GEOMETRIC_FIELD)
30352  CASE DEFAULT
30353  local_error="The specified field type of "//trim(number_to_vstring(TYPE,"*",err,error))//" is invalid."
30354  CALL flagerror(local_error,err,error,*999)
30355  END SELECT
30356  ENDIF
30357  ELSE
30358  local_error="Field create values cache is not associated for field number "// &
30359  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30360  CALL flagerror(local_error,err,error,*999)
30361  ENDIF
30362  ENDIF
30363  ELSE
30364  CALL flagerror("Field is not associated.",err,error,*999)
30365  ENDIF
30366 
30367  exits("FIELD_TYPE_SET")
30368  RETURN
30369 999 errorsexits("FIELD_TYPE_SET",err,error)
30370  RETURN 1
30371  END SUBROUTINE field_type_set
30372 
30373  !
30374  !================================================================================================================================
30375  !
30376 
30378  SUBROUTINE field_type_set_and_lock(FIELD,TYPE,ERR,ERROR,*)
30379 
30380  !Argument variables
30381  TYPE(field_type), POINTER :: field
30382  INTEGER(INTG), INTENT(IN) :: TYPE
30383  INTEGER(INTG), INTENT(OUT) :: err
30384  TYPE(varying_string), INTENT(OUT) :: error
30385  !Local Variables
30386  TYPE(varying_string) :: local_error
30387 
30388  enters("FIELD_TYPE_SET_AND_LOCK",err,error,*999)
30389 
30390  CALL field_type_set(field,TYPE,err,error,*999)
30391  IF(ASSOCIATED(field)) THEN
30392  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
30393  field%CREATE_VALUES_CACHE%TYPE_LOCKED=.true.
30394  ELSE
30395  local_error="Field create values cache is not associated for field number "// &
30396  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30397  CALL flagerror(local_error,err,error,*999)
30398  ENDIF
30399  ELSE
30400  CALL flagerror("Field is not associated.",err,error,*999)
30401  ENDIF
30402 
30403  exits("FIELD_TYPE_SET_AND_LOCK")
30404  RETURN
30405 999 errorsexits("FIELD_TYPE_SET_AND_LOCK",err,error)
30406  RETURN 1
30407  END SUBROUTINE field_type_set_and_lock
30408 
30409  !
30410  !================================================================================================================================
30411  !
30412 
30414  SUBROUTINE field_user_number_find_generic(USER_NUMBER,FIELDS,FIELD,ERR,ERROR,*)
30415 
30416  !Argument variables
30417  INTEGER(INTG), INTENT(IN) :: user_number
30418  TYPE(fields_type), POINTER :: fields
30419  TYPE(field_type), POINTER :: field
30420  INTEGER(INTG), INTENT(OUT) :: err
30421  TYPE(varying_string), INTENT(OUT) :: error
30422  !Local Variables
30423  INTEGER(INTG) :: field_idx
30424 
30425  enters("FIELD_USER_NUMBER_FIND_GENERIC",err,error,*999)
30426 
30427  IF(ASSOCIATED(fields)) THEN
30428  IF(ASSOCIATED(field)) THEN
30429  CALL flagerror("Field is already associated.",err,error,*999)
30430  ELSE
30431  NULLIFY(field)
30432  field_idx=1
30433  DO WHILE(field_idx<=fields%NUMBER_OF_FIELDS.AND..NOT.ASSOCIATED(field))
30434  IF(fields%FIELDS(field_idx)%PTR%USER_NUMBER==user_number) THEN
30435  field=>fields%FIELDS(field_idx)%PTR
30436  ELSE
30437  field_idx=field_idx+1
30438  ENDIF
30439  ENDDO
30440  ENDIF
30441  ELSE
30442  CALL flagerror("Fields is not associated.",err,error,*999)
30443  ENDIF
30444 
30445  exits("FIELD_USER_NUMBER_FIND_GENERIC")
30446  RETURN
30447 999 errorsexits("FIELD_USER_NUMBER_FIND_GENERIC",err,error)
30448  RETURN 1
30449  END SUBROUTINE field_user_number_find_generic
30450 
30451  !
30452  !================================================================================================================================
30453  !
30454 
30456  SUBROUTINE field_user_number_find_interface(USER_NUMBER,INTERFACE,FIELD,ERR,ERROR,*)
30457 
30458  !Argument variables
30459  INTEGER(INTG), INTENT(IN) :: user_number
30460  TYPE(interface_type), POINTER :: interface
30461  TYPE(field_type), POINTER :: field
30462  INTEGER(INTG), INTENT(OUT) :: err
30463  TYPE(varying_string), INTENT(OUT) :: error
30464  !Local Variables
30465 
30466  enters("FIELD_USER_NUMBER_FIND_INTERFACE",err,error,*999)
30467 
30468  IF(ASSOCIATED(interface)) THEN
30469  CALL field_user_number_find_generic(user_number,interface%FIELDS,field,err,error,*999)
30470  ELSE
30471  CALL flagerror("Interface is not associated.",err,error,*999)
30472  ENDIF
30473 
30474  exits("FIELD_USER_NUMBER_FIND_INTERFACE")
30475  RETURN
30476 999 errorsexits("FIELD_USER_NUMBER_FIND_INTERFACE",err,error)
30477  RETURN 1
30478  END SUBROUTINE field_user_number_find_interface
30479 
30480  !
30481  !================================================================================================================================
30482  !
30483 
30485  SUBROUTINE field_user_number_find_region(USER_NUMBER,REGION,FIELD,ERR,ERROR,*)
30486 
30487  !Argument variables
30488  INTEGER(INTG), INTENT(IN) :: user_number
30489  TYPE(region_type), POINTER :: region
30490  TYPE(field_type), POINTER :: field
30491  INTEGER(INTG), INTENT(OUT) :: err
30492  TYPE(varying_string), INTENT(OUT) :: error
30493  !Local Variables
30494 
30495  enters("FIELD_USER_NUMBER_FIND_REGION",err,error,*999)
30496 
30497  IF(ASSOCIATED(region)) THEN
30498  CALL field_user_number_find_generic(user_number,region%FIELDS,field,err,error,*999)
30499  ELSE
30500  CALL flagerror("Region is not associated.",err,error,*999)
30501  ENDIF
30502 
30503  exits("FIELD_USER_NUMBER_FIND_REGION")
30504  RETURN
30505 999 errorsexits("FIELD_USER_NUMBER_FIND_REGION",err,error)
30506  RETURN 1
30507  END SUBROUTINE field_user_number_find_region
30508 
30509  !
30510  !================================================================================================================================
30511  !
30512 
30514  SUBROUTINE field_variable_finalise(FIELD_VARIABLE,ERR,ERROR,*)
30515 
30516  !Argument variables
30517  TYPE(field_variable_type) :: field_variable
30518  INTEGER(INTG), INTENT(OUT) :: err
30519  TYPE(varying_string), INTENT(OUT) :: error
30520  !Local Variables
30521 
30522  enters("FIELD_VARIABLE_FINALISE",err,error,*999)
30523 
30524  field_variable%VARIABLE_LABEL=""
30525  CALL field_variable_components_finalise(field_variable,err,error,*999)
30526  IF(ASSOCIATED(field_variable%DOMAIN_MAPPING)) THEN
30527  CALL domain_mappings_mapping_finalise(field_variable%DOMAIN_MAPPING,err,error,*999)
30528  ENDIF
30529  CALL field_dof_to_param_map_finalise(field_variable%DOF_TO_PARAM_MAP,err,error,*999)
30530  CALL field_parameter_sets_finalise(field_variable,err,error,*999)
30531 
30532 
30533  exits("FIELD_VARIABLE_FINALISE")
30534  RETURN
30535 999 errorsexits("FIELD_VARIABLE_FINALISE",err,error)
30536  RETURN 1
30537  END SUBROUTINE field_variable_finalise
30538 
30539  !
30540  !================================================================================================================================
30541  !
30542 
30544  SUBROUTINE field_variable_get(FIELD,VARIABLE_TYPE,FIELD_VARIABLE,ERR,ERROR,*)
30545 
30546  !Argument variables
30547  TYPE(field_type), POINTER :: field
30548  INTEGER(INTG), INTENT(IN) :: variable_type
30549  TYPE(field_variable_type), POINTER :: field_variable
30550  INTEGER(INTG), INTENT(OUT) :: err
30551  TYPE(varying_string), INTENT(OUT) :: error
30552  !Local Variables
30553  TYPE(varying_string) :: local_error
30554 
30555  enters("FIELD_VARIABLE_GET",err,error,*999)
30556 
30557  IF(ASSOCIATED(field)) THEN
30558  IF(field%FIELD_FINISHED) THEN
30559  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
30560  IF(ASSOCIATED(field_variable)) THEN
30561  CALL flagerror("Field variable is already associated.",err,error,*999)
30562  ELSE
30563  NULLIFY(field_variable)
30564  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
30565  IF(.NOT.ASSOCIATED(field_variable)) THEN
30566  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30567  & " has not been defined on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30568  CALL flagerror(local_error,err,error,*999)
30569  ENDIF
30570  ENDIF
30571  ELSE
30572  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30573  & " is invalid. The field variable type must be between 1 and "// &
30574  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
30575  CALL flagerror(local_error,err,error,*999)
30576  ENDIF
30577  ELSE
30578  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
30579  & " has not been finished."
30580  CALL flagerror(local_error,err,error,*999)
30581  ENDIF
30582  ELSE
30583  CALL flagerror("Field is not associated.",err,error,*999)
30584  ENDIF
30585 
30586  exits("FIELD_VARIABLE_GET")
30587  RETURN
30588 999 errorsexits("FIELD_VARIABLE_GET",err,error)
30589  RETURN 1
30590  END SUBROUTINE field_variable_get
30591 
30592  !
30593  !================================================================================================================================
30594  !
30595 
30597  SUBROUTINE field_variable_initialise(FIELD,VARIABLE_NUMBER,ERR,ERROR,*)
30598 
30599  !Argument variables
30600  TYPE(field_type), POINTER :: field
30601  INTEGER(INTG), INTENT(IN) :: variable_number
30602  INTEGER(INTG), INTENT(OUT) :: err
30603  TYPE(varying_string), INTENT(OUT) :: error
30604  !Local Variables
30605  INTEGER(INTG) :: component_idx,dummy_err,variable_type
30606  TYPE(field_variable_type), POINTER :: field_variable
30607  TYPE(varying_string) :: dummy_error,local_error
30608 
30609  enters("FIELD_VARIABLE_INITIALISE",err,error,*998)
30610 
30611  IF(ASSOCIATED(field)) THEN
30612  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
30613  IF(variable_number>=1.AND.variable_number<=field%NUMBER_OF_VARIABLES) THEN
30614  NULLIFY(field%VARIABLES(variable_number)%FIELD)
30615  NULLIFY(field%VARIABLES(variable_number)%REGION)
30616  NULLIFY(field%VARIABLES(variable_number)%DOMAIN_MAPPING)
30617  !!TODO this should be done via a field_parameter_sets_initialise call
30618  NULLIFY(field%VARIABLES(variable_number)%PARAMETER_SETS%SET_TYPE)
30619  NULLIFY(field%VARIABLES(variable_number)%PARAMETER_SETS%PARAMETER_SETS)
30620  field%VARIABLES(variable_number)%VARIABLE_NUMBER=variable_number
30621  variable_type=field%CREATE_VALUES_CACHE%VARIABLE_TYPES(variable_number)
30622  IF(variable_type>=1.AND.variable_type<=field_number_of_variable_types) THEN
30623  field%VARIABLES(variable_number)%VARIABLE_TYPE=field%CREATE_VALUES_CACHE%VARIABLE_TYPES(variable_number)
30624  ELSE
30625  local_error="A field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30626  & " for variable number "//trim(number_to_vstring(variable_number,"*",err,error))// &
30627  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
30628  & " is invalid. The number must be between 1 and "// &
30629  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
30630  CALL flagerror(local_error,err,error,*998)
30631  ENDIF
30632  field%VARIABLE_TYPE_MAP(field%VARIABLES(variable_number)%VARIABLE_TYPE)%PTR=>field%VARIABLES(variable_number)
30633  field_variable=>field%VARIABLE_TYPE_MAP(field%VARIABLES(variable_number)%VARIABLE_TYPE)%PTR
30634  field_variable%VARIABLE_LABEL=""
30635  field_variable%VARIABLE_LABEL=field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)
30636  field_variable%FIELD=>field
30637  field_variable%REGION=>field%REGION
30638  field_variable%DIMENSION=field%CREATE_VALUES_CACHE%DIMENSION(variable_type)
30639  field_variable%DATA_TYPE=field%CREATE_VALUES_CACHE%DATA_TYPES(variable_type)
30640  field_variable%DOF_ORDER_TYPE=field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES(variable_type)
30641  IF(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)>0) THEN
30642  field_variable%NUMBER_OF_COMPONENTS=field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)
30643  CALL field_variable_components_initialise(field,variable_type,err,error,*999)
30644  ELSE
30645  local_error="The number of components of "// &
30646  & trim(number_to_vstring(field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type),"*",err,error))// &
30647  & " for variable type "//trim(number_to_vstring(variable_type,"*",err,error))// &
30648  & " of field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
30649  & " is invalid. The number must be > 0."
30650  CALL flagerror(local_error,err,error,*999)
30651  ENDIF
30652  field_variable%maxNumberElementInterpolationParameters=-1
30653  field_variable%maxNumberNodeInterpolationParameters=-1
30654  DO component_idx=1,field_variable%NUMBER_OF_COMPONENTS
30655  IF(field_variable%COMPONENTS(component_idx)%maxNumberElementInterpolationParameters> &
30656  & field_variable%maxNumberElementInterpolationParameters) field_variable% &
30657  & maxnumberelementinterpolationparameters=field_variable%COMPONENTS(component_idx)% &
30658  & maxnumberelementinterpolationparameters
30659  IF(field_variable%COMPONENTS(component_idx)%maxNumberNodeInterpolationParameters> &
30660  & field_variable%maxNumberNodeInterpolationParameters) field_variable% &
30661  & maxnumbernodeinterpolationparameters=field_variable%COMPONENTS(component_idx)% &
30662  & maxnumbernodeinterpolationparameters
30663  ENDDO !component_idx
30664  field_variable%NUMBER_OF_DOFS=0
30665  field_variable%TOTAL_NUMBER_OF_DOFS=0
30666  field_variable%NUMBER_OF_GLOBAL_DOFS=0
30667  ALLOCATE(field_variable%DOMAIN_MAPPING,stat=err)
30668  IF(err/=0) CALL flagerror("Could not allocate field variable domain mapping.",err,error,*999)
30669  CALL domain_mappings_mapping_initialise(field_variable%DOMAIN_MAPPING, &
30670  & field%DECOMPOSITION%NUMBER_OF_DOMAINS,err,error,*999)
30671  CALL field_dof_to_param_map_initialise(field_variable%DOF_TO_PARAM_MAP,err,error,*999)
30672  ELSE
30673  local_error="Variable number "//trim(number_to_vstring(variable_number,"*",err,error))// &
30674  & " is invalid for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" which has "// &
30675  & trim(number_to_vstring(field%NUMBER_OF_VARIABLES,"*",err,error))//" variables."
30676  CALL flagerror(local_error,err,error,*998)
30677  ENDIF
30678  ELSE
30679  CALL flagerror("Field create values cache is not associated.",err,error,*998)
30680  ENDIF
30681  ELSE
30682  CALL flagerror("Field is not associated.",err,error,*998)
30683  ENDIF
30684 
30685  exits("FIELD_VARIABLE_INITIALISE")
30686  RETURN
30687 999 CALL field_variable_finalise(field_variable,dummy_err,dummy_error,*998)
30688 998 errorsexits("FIELD_VARIABLE_INITIALISE",err,error)
30689  RETURN 1
30690  END SUBROUTINE field_variable_initialise
30691 
30692  !
30693  !================================================================================================================================
30694  !
30695 
30697  SUBROUTINE field_variable_label_get_c(FIELD,VARIABLE_TYPE,LABEL,ERR,ERROR,*)
30698 
30699  !Argument variables
30700  TYPE(field_type), POINTER :: field
30701  INTEGER(INTG), INTENT(IN) :: variable_type
30702  CHARACTER(LEN=*), INTENT(OUT) :: label
30703  INTEGER(INTG), INTENT(OUT) :: err
30704  TYPE(varying_string), INTENT(OUT) :: error
30705  !Local Variables
30706  INTEGER :: c_length,vs_length
30707  TYPE(field_variable_type), POINTER :: field_variable
30708  TYPE(varying_string) :: local_error
30709 
30710  enters("FIELD_VARIABLE_LABEL_GET_C",err,error,*999)
30711 
30712  IF(ASSOCIATED(field)) THEN
30713  IF(field%FIELD_FINISHED) THEN
30714  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
30715  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
30716  IF(ASSOCIATED(field_variable)) THEN
30717  c_length=len(label)
30718  vs_length=len_trim(field_variable%VARIABLE_LABEL)
30719  IF(c_length>vs_length) THEN
30720  label=char(len_trim(field_variable%VARIABLE_LABEL))
30721  ELSE
30722  label=char(field_variable%VARIABLE_LABEL,c_length)
30723  ENDIF
30724  ELSE
30725  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30726  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30727  CALL flagerror(local_error,err,error,*999)
30728  ENDIF
30729  ELSE
30730  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30731  & " is invalid. The variable type must be between 1 and "// &
30732  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
30733  CALL flagerror(local_error,err,error,*999)
30734  ENDIF
30735  ELSE
30736  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
30737  CALL flagerror(local_error,err,error,*999)
30738  ENDIF
30739  ELSE
30740  CALL flagerror("Field is not associated.",err,error,*999)
30741  ENDIF
30742 
30743  exits("FIELD_VARIABLE_LABEL_GET_C")
30744  RETURN
30745 999 errorsexits("FIELD_VARIABLE_LABEL_GET_C",err,error)
30746  RETURN 1
30747  END SUBROUTINE field_variable_label_get_c
30748 
30749  !
30750  !================================================================================================================================
30751  !
30752 
30754  SUBROUTINE field_variable_label_get_vs(FIELD,VARIABLE_TYPE,LABEL,ERR,ERROR,*)
30755 
30756  !Argument variables
30757  TYPE(field_type), POINTER :: field
30758  INTEGER(INTG), INTENT(IN) :: variable_type
30759  TYPE(varying_string), INTENT(OUT) :: label
30760  INTEGER(INTG), INTENT(OUT) :: err
30761  TYPE(varying_string), INTENT(OUT) :: error
30762  !Local Variables
30763  TYPE(field_variable_type), POINTER :: field_variable
30764  TYPE(varying_string) :: local_error
30765 
30766  enters("FIELD_VARIABLE_LABEL_GET_VS",err,error,*999)
30767 
30768  IF(ASSOCIATED(field)) THEN
30769  IF(field%FIELD_FINISHED) THEN
30770  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
30771  field_variable=>field%VARIABLE_TYPE_MAP(variable_type)%PTR
30772  IF(ASSOCIATED(field_variable)) THEN
30773  label=field_variable%VARIABLE_LABEL
30774  ELSE
30775  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30776  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30777  CALL flagerror(local_error,err,error,*999)
30778  ENDIF
30779  ELSE
30780  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30781  & " is invalid. The variable type must be between 1 and "// &
30782  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
30783  CALL flagerror(local_error,err,error,*999)
30784  ENDIF
30785  ELSE
30786  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has not been finished."
30787  CALL flagerror(local_error,err,error,*999)
30788  ENDIF
30789  ELSE
30790  CALL flagerror("Field is not associated.",err,error,*999)
30791  ENDIF
30792 
30793  exits("FIELD_VARIABLE_LABEL_GET_VS")
30794  RETURN
30795 999 errorsexits("FIELD_VARIABLE_LABEL_GET_VS",err,error)
30796  RETURN 1
30797  END SUBROUTINE field_variable_label_get_vs
30798 
30799  !
30800  !================================================================================================================================
30801  !
30802 
30804  SUBROUTINE field_variable_label_set_c(FIELD,VARIABLE_TYPE,LABEL,ERR,ERROR,*)
30805 
30806  !Argument variables
30807  TYPE(field_type), POINTER :: field
30808  INTEGER(INTG), INTENT(IN) :: variable_type
30809  CHARACTER(LEN=*), INTENT(IN) :: label
30810  INTEGER(INTG), INTENT(OUT) :: err
30811  TYPE(varying_string), INTENT(OUT) :: error
30812  !Local Variables
30813  TYPE(varying_string) :: local_error
30814 
30815  enters("FIELD_VARIABLE_LABEL_SET_C",err,error,*999)
30816 
30817  IF(ASSOCIATED(field)) THEN
30818  IF(field%FIELD_FINISHED) THEN
30819  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
30820  CALL flagerror(local_error,err,error,*999)
30821  ELSE
30822  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
30823  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
30824  IF(any(field%CREATE_VALUES_CACHE%VARIABLE_TYPES==variable_type)) THEN
30825  IF(field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED(variable_type)) THEN
30826  local_error="The field variable label has been locked for for variable type "// &
30827  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
30828  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
30829  CALL flagerror(local_error,err,error,*999)
30830  ELSE
30831  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)=label
30832  ENDIF
30833  ELSE
30834  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30835  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30836  CALL flagerror(local_error,err,error,*999)
30837  ENDIF
30838  ELSE
30839  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30840  & " is invalid. The variable type must be between 1 and "// &
30841 
30842  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
30843  CALL flagerror(local_error,err,error,*999)
30844  ENDIF
30845  ELSE
30846  local_error="Field create values cache is not associated for field number "// &
30847  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30848  CALL flagerror(local_error,err,error,*999)
30849  ENDIF
30850  ENDIF
30851  ELSE
30852  CALL flagerror("Field is not associated.",err,error,*999)
30853  ENDIF
30854 
30855  exits("FIELD_VARIABLE_LABEL_SET_C")
30856  RETURN
30857 999 errorsexits("FIELD_VARIABLE_LABEL_SET_C",err,error)
30858  RETURN 1
30859  END SUBROUTINE field_variable_label_set_c
30860 
30861  !
30862  !================================================================================================================================
30863  !
30864 
30866  SUBROUTINE field_variable_label_set_vs(FIELD,VARIABLE_TYPE,LABEL,ERR,ERROR,*)
30867 
30868  !Argument variables
30869  TYPE(field_type), POINTER :: field
30870  INTEGER(INTG), INTENT(IN) :: variable_type
30871  TYPE(varying_string), INTENT(IN) :: label
30872  INTEGER(INTG), INTENT(OUT) :: err
30873  TYPE(varying_string), INTENT(OUT) :: error
30874  !Local Variables
30875  TYPE(varying_string) :: local_error
30876 
30877  enters("FIELD_VARIABLE_LABEL_SET_VS",err,error,*999)
30878 
30879  IF(ASSOCIATED(field)) THEN
30880  IF(field%FIELD_FINISHED) THEN
30881  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" has been finished."
30882  CALL flagerror(local_error,err,error,*999)
30883  ELSE
30884  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
30885  IF(variable_type>0.AND.variable_type<=field_number_of_variable_types) THEN
30886  IF(any(field%CREATE_VALUES_CACHE%VARIABLE_TYPES==variable_type)) THEN
30887  IF(field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED(variable_type)) THEN
30888  local_error="The field variable label has been locked for for variable type "// &
30889  & trim(number_to_vstring(variable_type,"*",err,error))//" of field number "// &
30890  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
30891  CALL flagerror(local_error,err,error,*999)
30892  ELSE
30893  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)=label
30894  ENDIF
30895  ELSE
30896  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30897  & " has not been created on field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30898  CALL flagerror(local_error,err,error,*999)
30899  ENDIF
30900  ELSE
30901  local_error="The field variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
30902  & " is invalid. The variable type must be between 1 and "// &
30903  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
30904  CALL flagerror(local_error,err,error,*999)
30905  ENDIF
30906  ELSE
30907  local_error="Field create values cache is not associated for field number "// &
30908  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30909  CALL flagerror(local_error,err,error,*999)
30910  ENDIF
30911  ENDIF
30912  ELSE
30913  CALL flagerror("Field is not associated.",err,error,*999)
30914  ENDIF
30915 
30916  exits("FIELD_VARIABLE_LABEL_SET_VS")
30917  RETURN
30918 999 errorsexits("FIELD_VARIABLE_LABEL_SET_VS",err,error)
30919  RETURN 1
30920  END SUBROUTINE field_variable_label_set_vs
30921 
30922  !
30923  !================================================================================================================================
30924  !
30925 
30927  SUBROUTINE field_variable_label_set_and_lock_c(FIELD,VARIABLE_TYPE,LABEL,ERR,ERROR,*)
30928 
30929  !Argument variables
30930  TYPE(field_type), POINTER :: field
30931  INTEGER(INTG), INTENT(IN) :: variable_type
30932  CHARACTER(LEN=*), INTENT(IN) :: label
30933  INTEGER(INTG), INTENT(OUT) :: err
30934  TYPE(varying_string), INTENT(OUT) :: error
30935  !Local Variables
30936  TYPE(varying_string) :: local_error
30937 
30938  enters("FIELD_VARIABLE_LABEL_SET_AND_LOCK_C",err,error,*999)
30939 
30940  CALL field_variable_label_set(field,variable_type,label,err,error,*999)
30941  IF(ASSOCIATED(field)) THEN
30942  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
30943  field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED(variable_type)=.true.
30944  ELSE
30945  local_error="Field create values cache is not associated for field number "// &
30946  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30947  CALL flagerror(local_error,err,error,*999)
30948  ENDIF
30949  ELSE
30950  CALL flagerror("Field is not associated.",err,error,*999)
30951  ENDIF
30952 
30953  exits("FIELD_VARIABLE_LABEL_SET_AND_LOCK_C")
30954  RETURN
30955 999 errorsexits("FIELD_VARIABLE_LABEL_SET_AND_LOCK_C",err,error)
30956  RETURN 1
30957  END SUBROUTINE field_variable_label_set_and_lock_c
30958 
30959  !
30960  !================================================================================================================================
30961  !
30962 
30964  SUBROUTINE field_variable_label_set_and_lock_vs(FIELD,VARIABLE_TYPE,LABEL,ERR,ERROR,*)
30965 
30966  !Argument variables
30967  TYPE(field_type), POINTER :: field
30968  INTEGER(INTG), INTENT(IN) :: variable_type
30969  TYPE(varying_string), INTENT(IN) :: label
30970  INTEGER(INTG), INTENT(OUT) :: err
30971  TYPE(varying_string), INTENT(OUT) :: error
30972  !Local Variables
30973  TYPE(varying_string) :: local_error
30974 
30975  enters("FIELD_VARIABLE_LABEL_SET_AND_LOCK_VS",err,error,*999)
30976 
30977  CALL field_variable_label_set(field,variable_type,label,err,error,*999)
30978  IF(ASSOCIATED(field)) THEN
30979  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
30980  field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED(variable_type)=.true.
30981  ELSE
30982  local_error="Field create values cache is not associated for field number "// &
30983  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
30984  CALL flagerror(local_error,err,error,*999)
30985  ENDIF
30986  ELSE
30987  CALL flagerror("Field is not associated.",err,error,*999)
30988  ENDIF
30989 
30990  exits("FIELD_VARIABLE_LABEL_SET_AND_LOCK_VS")
30991  RETURN
30992 999 errorsexits("FIELD_VARIABLE_LABEL_SET_AND_LOCK_VS",err,error)
30993  RETURN 1
30994  END SUBROUTINE field_variable_label_set_and_lock_vs
30995 
30996  !
30997  !================================================================================================================================
30998  !
30999 
31001  SUBROUTINE field_variable_types_check(FIELD,VARIABLE_TYPES,ERR,ERROR,*)
31002 
31003  !Argument variables
31004  TYPE(field_type), POINTER :: field
31005  INTEGER(INTG), INTENT(IN) :: variable_types(:)
31006  INTEGER(INTG), INTENT(OUT) :: err
31007  TYPE(varying_string), INTENT(OUT) :: error
31008  !Local Variables
31009  INTEGER(INTG) :: variable_idx
31010  TYPE(varying_string) :: local_error
31011 
31012  enters("FIELD_VARIABLE_TYPES_CHECK",err,error,*999)
31013 
31014  IF(ASSOCIATED(field)) THEN
31015  IF(field%FIELD_FINISHED) THEN
31016  IF(SIZE(variable_types,1)>=field%NUMBER_OF_VARIABLES) THEN
31017  DO variable_idx=1,field%NUMBER_OF_VARIABLES
31018  IF(variable_types(variable_idx)>=1.AND.variable_types(variable_idx)<=field_number_of_variable_types) THEN
31019  IF(field%VARIABLES(variable_idx)%VARIABLE_TYPE/=variable_types(variable_idx)) THEN
31020  local_error="Invalid variable type. The variable type for variable index number "// &
31021  & trim(number_to_vstring(variable_idx,"*",err,error))//" of field number "// &
31022  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" is "// &
31023  & trim(number_to_vstring(field%VARIABLES(variable_idx)%VARIABLE_TYPE,"*",err,error))// &
31024  & " which is does correspond to the specified variable_type of "// &
31025  & trim(number_to_vstring(variable_types(variable_idx),"*",err,error))//"."
31026  CALL flagerror(local_error,err,error,*999)
31027  ENDIF
31028  ELSE
31029  local_error="The specified variable type of "//trim(number_to_vstring(variable_types(variable_idx),"*",err,error))// &
31030  & " at position number "//trim(number_to_vstring(variable_idx,"*",err,error))// &
31031  & " is invalid. The variable type must be between 1 and "// &
31032  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
31033  CALL flagerror(local_error,err,error,*999)
31034  ENDIF
31035  ENDDO !variable_idx
31036  ELSE
31037  local_error="Invalid variable types. The size of the specified variable types array is "// &
31038  & trim(number_to_vstring(SIZE(variable_types,1),"*",err,error))//" and it must be >= "// &
31039  & trim(number_to_vstring(field%NUMBER_OF_VARIABLES,"*",err,error))//"."
31040  CALL flagerror(local_error,err,error,*999)
31041  ENDIF
31042  ELSE
31043  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
31044  & " has not been finished."
31045  CALL flagerror(local_error,err,error,*999)
31046  ENDIF
31047  ELSE
31048  CALL flagerror("Field is not associated.",err,error,*999)
31049  ENDIF
31050 
31051  exits("FIELD_VARIABLE_TYPES_CHECK")
31052  RETURN
31053 999 errorsexits("FIELD_VARIABLE_TYPES_CHECK",err,error)
31054  RETURN 1
31055  END SUBROUTINE field_variable_types_check
31056 
31057  !
31058  !================================================================================================================================
31059  !
31060 
31062  SUBROUTINE field_variable_type_check(FIELD,VARIABLE_TYPE,ERR,ERROR,*)
31063 
31064  !Argument variables
31065  TYPE(field_type), POINTER :: field
31066  INTEGER(INTG), INTENT(IN) :: variable_type
31067  INTEGER(INTG), INTENT(OUT) :: err
31068  TYPE(varying_string), INTENT(OUT) :: error
31069  !Local Variables
31070  INTEGER(INTG) :: variable_idx
31071  LOGICAL :: variable_found
31072  TYPE(varying_string) :: local_error
31073 
31074  enters("FIELD_VARIABLE_TYPE_CHECK",err,error,*999)
31075 
31076  variable_found=.false.
31077  IF(ASSOCIATED(field)) THEN
31078  IF(field%FIELD_FINISHED) THEN
31079  DO variable_idx=1,field%NUMBER_OF_VARIABLES
31080  IF(field%VARIABLES(variable_idx)%VARIABLE_TYPE==variable_type) THEN
31081  variable_found=.true.
31082  cycle
31083  END IF
31084  ENDDO !variable_idx
31085  IF(.NOT.variable_found) THEN
31086  CALL flagerror("Field does not have a variable type of "// &
31087  & trim(number_to_vstring(variable_type,"*",err,error))//".",err,error,*999)
31088  END IF
31089  ELSE
31090  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
31091  & " has not been finished."
31092  CALL flagerror(local_error,err,error,*999)
31093  END IF
31094  ELSE
31095  CALL flagerror("Field is not associated.",err,error,*999)
31096  ENDIF
31097 
31098  exits("FIELD_VARIABLE_TYPE_CHECK")
31099  RETURN
31100 999 errorsexits("FIELD_VARIABLE_TYPE_CHECK",err,error)
31101  RETURN 1
31102  END SUBROUTINE field_variable_type_check
31103 
31104  !
31105  !================================================================================================================================
31106  !
31107 
31109  SUBROUTINE field_variable_types_get(FIELD,VARIABLE_TYPES,ERR,ERROR,*)
31110 
31111  !Argument variables
31112  TYPE(field_type), POINTER :: field
31113  INTEGER(INTG), INTENT(OUT) :: variable_types(:)
31114  INTEGER(INTG), INTENT(OUT) :: err
31115  TYPE(varying_string), INTENT(OUT) :: error
31116  !Local Variables
31117  INTEGER(INTG) :: variable_idx
31118  TYPE(varying_string) :: local_error
31119 
31120  enters("FIELD_VARIABLE_TYPES_GET",err,error,*999)
31121 
31122  IF(ASSOCIATED(field)) THEN
31123  IF(field%FIELD_FINISHED) THEN
31124  IF(SIZE(variable_types,1)>=field%NUMBER_OF_VARIABLES) THEN
31125  variable_types=0
31126  DO variable_idx=1,field%NUMBER_OF_VARIABLES
31127  variable_types(variable_idx)=field%VARIABLES(variable_idx)%VARIABLE_TYPE
31128  ENDDO !variable_idx
31129  ELSE
31130  local_error="Invalid variable types. The size of the specified variable types array is "// &
31131  & trim(number_to_vstring(SIZE(variable_types,1),"*",err,error))//" and it must be >= "// &
31132  & trim(number_to_vstring(field%NUMBER_OF_VARIABLES,"*",err,error))//"."
31133  CALL flagerror(local_error,err,error,*999)
31134  ENDIF
31135  ELSE
31136  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
31137  & " has not been finished."
31138  CALL flagerror(local_error,err,error,*999)
31139  ENDIF
31140  ELSE
31141  CALL flagerror("Field is not associated.",err,error,*999)
31142  ENDIF
31143 
31144  exits("FIELD_VARIABLE_TYPES_GET")
31145  RETURN
31146 999 errorsexits("FIELD_VARIABLE_TYPES_GET",err,error)
31147  RETURN 1
31148  END SUBROUTINE field_variable_types_get
31149 
31150  !
31151  !================================================================================================================================
31152  !
31153 
31155  SUBROUTINE field_variable_types_set(FIELD,VARIABLE_TYPES,ERR,ERROR,*)
31156 
31157  !Argument variables
31158  TYPE(field_type), POINTER :: field
31159  INTEGER(INTG), INTENT(IN) :: variable_types(:)
31160  INTEGER(INTG), INTENT(OUT) :: err
31161  TYPE(varying_string), INTENT(OUT) :: error
31162  !Local Variables
31163  INTEGER(INTG) :: number_of_components,old_variable_type,variable_idx,variable_idx2,variable_type
31164  INTEGER(INTG) :: old_dimension(field_number_of_variable_types),old_data_types(field_number_of_variable_types), &
31165  & OLD_DOF_ORDER_TYPES(FIELD_NUMBER_OF_VARIABLE_TYPES),OLD_NUMBER_OF_COMPONENTS(FIELD_NUMBER_OF_VARIABLE_TYPES)
31166  INTEGER(INTG), ALLOCATABLE :: old_variable_types(:),old_interpolation_type(:,:),old_mesh_component_number(:,:)
31167  LOGICAL :: old_dimension_locked(field_number_of_variable_types),old_data_types_locked(field_number_of_variable_types), &
31168  & OLD_DOF_ORDER_TYPES_LOCKED(FIELD_NUMBER_OF_VARIABLE_TYPES), &
31169  & OLD_NUMBER_OF_COMPONENTS_LOCKED(FIELD_NUMBER_OF_VARIABLE_TYPES),OLD_LABELS_LOCKED(FIELD_NUMBER_OF_VARIABLE_TYPES)
31170  LOGICAL, ALLOCATABLE :: old_interpolation_type_locked(:,:),old_mesh_component_number_locked(:,:)
31171  TYPE(varying_string) :: local_error,old_labels(field_number_of_variable_types)
31172 
31173  enters("FIELD_VARIABLE_TYPES_SET",err,error,*999)
31174 
31175  IF(ASSOCIATED(field)) THEN
31176  IF(field%FIELD_FINISHED) THEN
31177  local_error="Field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
31178  & " has been finished."
31179  CALL flagerror(local_error,err,error,*999)
31180  ELSE
31181  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
31182  IF(field%CREATE_VALUES_CACHE%VARIABLE_TYPES_LOCKED) THEN
31183  local_error="The field variable types has been locked for field number "// &
31184  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//" and can not be changed."
31185  CALL flagerror(local_error,err,error,*999)
31186  ELSE
31187  IF(SIZE(variable_types,1)==field%NUMBER_OF_VARIABLES) THEN
31188  DO variable_idx=1,field%NUMBER_OF_VARIABLES
31189  variable_type=variable_types(variable_idx)
31190  !Check that the variable type is in range
31191  IF(variable_type<1.OR.variable_type>field_number_of_variable_types) THEN
31192  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
31193  & " at position number "//trim(number_to_vstring(variable_idx,"*",err,error))// &
31194  & " is invalid. The variable type must be between 1 and "// &
31195  & trim(number_to_vstring(field_number_of_variable_types,"*",err,error))//"."
31196  CALL flagerror(local_error,err,error,*999)
31197  ENDIF
31198  !Check that the variable type is not repeated
31199  DO variable_idx2=variable_idx+1,field%NUMBER_OF_VARIABLES
31200  IF(variable_types(variable_idx2)==variable_type) THEN
31201  local_error="The specified variable type of "//trim(number_to_vstring(variable_type,"*",err,error))// &
31202  & " occurs at position number "//trim(number_to_vstring(variable_idx,"*",err,error))// &
31203  & " and position number "//trim(number_to_vstring(variable_idx2,"*",err,error))// &
31204  & ". The variable types must be unique."
31205  CALL flagerror(local_error,err,error,*999)
31206  ENDIF
31207  ENDDO !variable_idx2
31208  ENDDO !variable_idx
31209  number_of_components=SIZE(field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE,1)
31210  ALLOCATE(old_variable_types(field%NUMBER_OF_VARIABLES),stat=err)
31211  IF(err/=0) CALL flagerror("Could not allocate old variable types.",err,error,*999)
31212  ALLOCATE(old_interpolation_type(number_of_components,field_number_of_variable_types),stat=err)
31213  IF(err/=0) CALL flagerror("Could not allocate old interpolation type.",err,error,*999)
31214  ALLOCATE(old_interpolation_type_locked(number_of_components,field_number_of_variable_types),stat=err)
31215  IF(err/=0) CALL flagerror("Could not allocate old interpolation type locked.",err,error,*999)
31216  ALLOCATE(old_mesh_component_number(number_of_components,field_number_of_variable_types),stat=err)
31217  IF(err/=0) CALL flagerror("Could not allocate old mesh component number.",err,error,*999)
31218  ALLOCATE(old_mesh_component_number_locked(number_of_components,field_number_of_variable_types),stat=err)
31219  IF(err/=0) CALL flagerror("Could not allocate old mesh component number locked.",err,error,*999)
31220  old_variable_types(1:field%NUMBER_OF_VARIABLES)=field%CREATE_VALUES_CACHE%VARIABLE_TYPES(1:field%NUMBER_OF_VARIABLES)
31221  old_labels=field%CREATE_VALUES_CACHE%VARIABLE_LABELS
31222  old_labels_locked=field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED
31223  old_dimension=field%CREATE_VALUES_CACHE%DIMENSION
31224  old_dimension_locked=field%CREATE_VALUES_CACHE%DIMENSION_LOCKED
31225  old_data_types=field%CREATE_VALUES_CACHE%DATA_TYPES
31226  old_data_types_locked=field%CREATE_VALUES_CACHE%DATA_TYPES_LOCKED
31227  old_dof_order_types=field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES
31228  old_dof_order_types_locked=field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES_LOCKED
31229  old_number_of_components=field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS
31230  old_number_of_components_locked=field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS_LOCKED
31231  old_interpolation_type(1:number_of_components,1:field_number_of_variable_types)= &
31232  & field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(1:number_of_components,1:field_number_of_variable_types)
31233  old_interpolation_type_locked(1:number_of_components,1:field_number_of_variable_types)= &
31234  & field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED(1:number_of_components,1:field_number_of_variable_types)
31235  old_mesh_component_number(1:number_of_components,1:field_number_of_variable_types)= &
31236  & field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(1:number_of_components,1:field_number_of_variable_types)
31237  old_mesh_component_number_locked(1:number_of_components,1:field_number_of_variable_types)= &
31238  & field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED(1:number_of_components,1:field_number_of_variable_types)
31239  field%CREATE_VALUES_CACHE%VARIABLE_TYPES=0
31240  field%CREATE_VALUES_CACHE%VARIABLE_LABELS=""
31241  field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED=.false.
31242  field%CREATE_VALUES_CACHE%DIMENSION=0
31243  field%CREATE_VALUES_CACHE%DIMENSION_LOCKED=.false.
31244  field%CREATE_VALUES_CACHE%DATA_TYPES=0
31245  field%CREATE_VALUES_CACHE%DATA_TYPES_LOCKED=.false.
31246  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES=0
31247  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES_LOCKED=.false.
31248  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS=0
31249  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS_LOCKED=.false.
31250  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE=0
31251  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED=.false.
31252  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER=0
31253  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED=.false.
31254  DO variable_idx=1,field%NUMBER_OF_VARIABLES
31255  variable_type=variable_types(variable_idx)
31256  old_variable_type=old_variable_types(variable_idx)
31257  field%CREATE_VALUES_CACHE%VARIABLE_LABELS(variable_type)=old_labels(old_variable_type)
31258  field%CREATE_VALUES_CACHE%VARIABLE_LABELS_LOCKED(variable_type)=old_labels_locked(old_variable_type)
31259  field%CREATE_VALUES_CACHE%DIMENSION(variable_type)=old_dimension(old_variable_type)
31260  field%CREATE_VALUES_CACHE%DIMENSION_LOCKED(variable_type)=old_dimension_locked(old_variable_type)
31261  field%CREATE_VALUES_CACHE%DATA_TYPES(variable_type)=old_data_types(old_variable_type)
31262  field%CREATE_VALUES_CACHE%DATA_TYPES_LOCKED(variable_type)=old_data_types_locked(old_variable_type)
31263  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES(variable_type)=old_dof_order_types(old_variable_type)
31264  field%CREATE_VALUES_CACHE%DOF_ORDER_TYPES_LOCKED(variable_type)=old_dof_order_types_locked(old_variable_type)
31265  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS(variable_type)=old_number_of_components(old_variable_type)
31266  field%CREATE_VALUES_CACHE%NUMBER_OF_COMPONENTS_LOCKED(variable_type)=old_number_of_components_locked( &
31267  & old_variable_type)
31268  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE(:,variable_type)=old_interpolation_type(:,old_variable_type)
31269  field%CREATE_VALUES_CACHE%INTERPOLATION_TYPE_LOCKED(:,variable_type)=old_interpolation_type_locked(:, &
31270  & old_variable_type)
31271  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER(:,variable_type)=old_mesh_component_number(:,old_variable_type)
31272  field%CREATE_VALUES_CACHE%MESH_COMPONENT_NUMBER_LOCKED(:,variable_type)=old_mesh_component_number_locked(:, &
31273  & old_variable_type)
31274  ENDDO !variable_idx
31275  field%CREATE_VALUES_CACHE%VARIABLE_TYPES(1:SIZE(variable_types,1))=variable_types(1:SIZE(variable_types,1))
31276  DEALLOCATE(old_variable_types)
31277  DEALLOCATE(old_interpolation_type)
31278  DEALLOCATE(old_interpolation_type_locked)
31279  DEALLOCATE(old_mesh_component_number)
31280  DEALLOCATE(old_mesh_component_number_locked)
31281  ELSE
31282  local_error="Invalid variable types. The size of the specified variable types array is "// &
31283  & trim(number_to_vstring(SIZE(variable_types,1),"*",err,error))// &
31284  & " and the number of variables for field number "//trim(number_to_vstring(field%USER_NUMBER,"*",err,error))// &
31285  & " is "//trim(number_to_vstring(field%NUMBER_OF_VARIABLES,"*",err,error))//"."
31286  CALL flagerror(local_error,err,error,*999)
31287  ENDIF
31288  ENDIF
31289  ELSE
31290  local_error="Field create values cache is not associated for field number "// &
31291  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
31292  CALL flagerror(local_error,err,error,*999)
31293  ENDIF
31294  ENDIF
31295  ELSE
31296  CALL flagerror("Field is not associated.",err,error,*999)
31297  ENDIF
31298 
31299  exits("FIELD_VARIABLE_TYPES_SET")
31300  RETURN
31301 999 IF(ALLOCATED(old_variable_types)) DEALLOCATE(old_variable_types)
31302  IF(ALLOCATED(old_interpolation_type)) DEALLOCATE(old_interpolation_type)
31303  IF(ALLOCATED(old_interpolation_type_locked)) DEALLOCATE(old_interpolation_type_locked)
31304  IF(ALLOCATED(old_mesh_component_number)) DEALLOCATE(old_mesh_component_number)
31305  IF(ALLOCATED(old_mesh_component_number_locked)) DEALLOCATE(old_mesh_component_number_locked)
31306  errorsexits("FIELD_VARIABLE_TYPES_SET",err,error)
31307  RETURN 1
31308  END SUBROUTINE field_variable_types_set
31309 
31310  !
31311  !================================================================================================================================
31312  !
31313 
31315  SUBROUTINE field_variable_types_set_and_lock(FIELD,VARIABLE_TYPES,ERR,ERROR,*)
31316 
31317  !Argument variables
31318  TYPE(field_type), POINTER :: field
31319  INTEGER(INTG), INTENT(IN) :: variable_types(:)
31320  INTEGER(INTG), INTENT(OUT) :: err
31321  TYPE(varying_string), INTENT(OUT) :: error
31322  !Local Variables
31323  TYPE(varying_string) :: local_error
31324 
31325  enters("FIELD_VARIABLE_TYPES_SET_AND_LOCK",err,error,*999)
31326 
31327  CALL field_variable_types_set(field,variable_types,err,error,*999)
31328  IF(ASSOCIATED(field)) THEN
31329  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
31330  field%CREATE_VALUES_CACHE%VARIABLE_TYPES_LOCKED=.true.
31331  ELSE
31332  local_error="Field create values cache is not associated for field number "// &
31333  & trim(number_to_vstring(field%USER_NUMBER,"*",err,error))//"."
31334  CALL flagerror(local_error,err,error,*999)
31335  ENDIF
31336  ELSE
31337  CALL flagerror("Field is not associated.",err,error,*999)
31338  ENDIF
31339 
31340  exits("FIELD_VARIABLE_TYPES_SET_AND_LOCK")
31341  RETURN
31342 999 errorsexits("FIELD_VARIABLE_TYPES_SET_AND_LOCK",err,error)
31343  RETURN 1
31344  END SUBROUTINE field_variable_types_set_and_lock
31345 
31346  !
31347  !================================================================================================================================
31348  !
31349 
31351  SUBROUTINE fieldvariablescheck(field,err,error,*)
31352 
31353  !Argument variables
31354  TYPE(field_type), POINTER :: field
31355  INTEGER(INTG), INTENT(OUT) :: err
31356  TYPE(varying_string), INTENT(OUT) :: error
31357  !Local Variables
31358  INTEGER(INTG) :: variableidx,variableidx2,variabletype,variabletype2
31359  LOGICAL :: duplicates
31360  TYPE(varying_string) :: localerror
31361 
31362  enters("FieldVariablesCheck",err,error,*999)
31363 
31364  IF(ASSOCIATED(field)) THEN
31365  IF(ASSOCIATED(field%CREATE_VALUES_CACHE)) THEN
31366  !Check the number of field variables
31367  IF(field%NUMBER_OF_VARIABLES>0) THEN
31368  !Check that the variable types are unique. Just do an exhaustive check. It is expensive but the list should be short.
31369  duplicates=.false.
31370  firstvariable: DO variableidx=1,field%NUMBER_OF_VARIABLES
31371  variabletype=field%CREATE_VALUES_CACHE%VARIABLE_TYPES(variableidx)
31372  secondvariable: DO variableidx2=variableidx+1,field%NUMBER_OF_VARIABLES
31373  variabletype2=field%CREATE_VALUES_CACHE%VARIABLE_TYPES(variableidx2)
31374  IF(variabletype==variabletype2) THEN
31375  duplicates=.true.
31376  EXIT firstvariable
31377  ENDIF
31378  ENDDO secondvariable !variableIdx2
31379  ENDDO firstvariable !variableIdx
31380  IF(duplicates) THEN
31381  localerror="Invalid variable types. Two or more variables have variable type "// &
31382  & trim(numbertovstring(variabletype,"*",err,error))//"."
31383  CALL flagerror(localerror,err,error,*999)
31384  ENDIF
31385  ELSE
31386  localerror="Invalid field setup. The field has "//trim(numbertovstring(field%NUMBER_OF_VARIABLES,"*",err,error))// &
31387  & " variables and should have > 0 variables."
31388  CALL flagerror(localerror,err,error,*999)
31389  ENDIF
31390  ELSE
31391  CALL flagerror("Field create values cache is not associated.",err,error,*999)
31392  ENDIF
31393  ELSE
31394  CALL flagerror("Field is not associated.",err,error,*999)
31395  ENDIF
31396 
31397  exits("FieldVariablesCheck")
31398  RETURN
31399 999 errorsexits("FieldVariablesCheck",err,error)
31400  RETURN 1
31401 
31402  END SUBROUTINE fieldvariablescheck
31403 
31404  !
31405  !================================================================================================================================
31406  !
31407 
31409  SUBROUTINE field_variables_finalise(FIELD,ERR,ERROR,*)
31410 
31411  !Argument variables
31412  TYPE(field_type), POINTER :: field
31413  INTEGER(INTG), INTENT(OUT) :: err
31414  TYPE(varying_string), INTENT(OUT) :: error
31415  !Local Variables
31416  INTEGER(INTG) :: variable_idx
31417 
31418  enters("FIELD_VARIABLES_FINALISE",err,error,*999)
31419 
31420  IF(ASSOCIATED(field)) THEN
31421  IF(ALLOCATED(field%VARIABLES)) THEN
31422  DO variable_idx=1,SIZE(field%VARIABLES,1)
31423  CALL field_variable_finalise(field%VARIABLES(variable_idx),err,error,*999)
31424  ENDDO !variable_idx
31425  DEALLOCATE(field%VARIABLES)
31426  ENDIF
31427  field%NUMBER_OF_VARIABLES=0
31428  ELSE
31429  CALL flagerror("Field is not associated.",err,error,*999)
31430  ENDIF
31431 
31432  exits("FIELD_VARIABLES_FINALISE")
31433  RETURN
31434 999 errorsexits("FIELD_VARIABLES_FINALISE",err,error)
31435  RETURN 1
31436  END SUBROUTINE field_variables_finalise
31437 
31438  !
31439  !================================================================================================================================
31440  !
31441 
31443  SUBROUTINE field_variables_initialise(FIELD,ERR,ERROR,*)
31444 
31445  !Argument variables
31446  TYPE(field_type), POINTER :: field
31447  INTEGER(INTG), INTENT(OUT) :: err
31448  TYPE(varying_string), INTENT(OUT) :: error
31449  !Local Variables
31450  INTEGER(INTG) :: variable_idx
31451 
31452  enters("FIELD_VARIABLES_INITIALISE",err,error,*999)
31453 
31454  IF(ASSOCIATED(field)) THEN
31455  IF(ALLOCATED(field%VARIABLES)) THEN
31456  CALL flagerror("Field already has associated variables.",err,error,*999)
31457  ELSE
31458  ALLOCATE(field%VARIABLES(field%NUMBER_OF_VARIABLES),stat=err)
31459  IF(err/=0) CALL flagerror("Could not allocate new field variables.",err,error,*999)
31460  DO variable_idx=1,field%NUMBER_OF_VARIABLES
31461  CALL field_variable_initialise(field,variable_idx,err,error,*999)
31462  ENDDO !variable_idx
31463  ENDIF
31464  ELSE
31465  CALL flagerror("Field is not associated.",err,error,*999)
31466  ENDIF
31467 
31468  exits("FIELD_VARIABLES_INITIALISE")
31469  RETURN
31470 999 errorsexits("FIELD_VARIABLES_INITIALISE",err,error)
31471  RETURN 1
31472  END SUBROUTINE field_variables_initialise
31473 
31474  !
31475  !================================================================================================================================
31476  !
31477 
31479  SUBROUTINE fields_finalise(FIELDS,ERR,ERROR,*)
31480 
31481  !Argument variables
31482  TYPE(fields_type), POINTER :: fields
31483  INTEGER(INTG), INTENT(OUT) :: err
31484  TYPE(varying_string), INTENT(OUT) :: error
31485  !Local Variables
31486  TYPE(field_type), POINTER :: field
31487 
31488  enters("FIELDS_FINALISE",err,error,*999)
31489 
31490  IF(ASSOCIATED(fields)) THEN
31491  DO WHILE(fields%NUMBER_OF_FIELDS>0)
31492  field=>fields%FIELDS(1)%PTR
31493  CALL field_destroy(field,err,error,*999)
31494  ENDDO !field_idx
31495  DEALLOCATE(fields)
31496  ENDIF
31497 
31498  exits("FIELDS_FINALISE")
31499  RETURN
31500 999 errorsexits("FIELDS_FINALISE",err,error)
31501  RETURN 1
31502  END SUBROUTINE fields_finalise
31503 
31504  !
31505  !================================================================================================================================
31506  !
31507 
31509  SUBROUTINE fields_initialise_generic(FIELDS,ERR,ERROR,*)
31510 
31511  !Argument variables
31512  TYPE(fields_type), POINTER :: fields
31513  INTEGER(INTG), INTENT(OUT) :: err
31514  TYPE(varying_string), INTENT(OUT) :: error
31515  !Local Variables
31516 
31517  enters("FIELDS_INITIALISE_GENERIC",err,error,*999)
31518 
31519  IF(ASSOCIATED(fields)) THEN
31520  NULLIFY(fields%REGION)
31521  NULLIFY(fields%INTERFACE)
31522  fields%NUMBER_OF_FIELDS=0
31523  NULLIFY(fields%FIELDS)
31524  ELSE
31525  CALL flagerror("Fields is not associated.",err,error,*999)
31526  ENDIF
31527 
31528  exits("FIELDS_INITIALISE_GENERIC")
31529  RETURN
31530 999 errorsexits("FIELDS_INITIALISE_GENERIC",err,error)
31531  RETURN 1
31532  END SUBROUTINE fields_initialise_generic
31533 
31534  !
31535  !================================================================================================================================
31536  !
31537 
31539  SUBROUTINE fields_initialise_interface(INTERFACE,ERR,ERROR,*)
31540 
31541  !Argument variables
31542  TYPE(interface_type), POINTER :: interface
31543  INTEGER(INTG), INTENT(OUT) :: err
31544  TYPE(varying_string), INTENT(OUT) :: error
31545  !Local Variables
31546 
31547  enters("FIELDS_INITIALISE_INTERFACE",err,error,*999)
31548 
31549  IF(ASSOCIATED(interface)) THEN
31550  IF(ASSOCIATED(interface%FIELDS)) THEN
31551  CALL flagerror("Interface already has fields associated.",err,error,*999)
31552  ELSE
31553  ALLOCATE(interface%FIELDS,stat=err)
31554  IF(err/=0) CALL flagerror("Interface fields could not be allocated.",err,error,*999)
31555  CALL fields_initialise_generic(interface%FIELDS,err,error,*999)
31556  interface%FIELDS%INTERFACE=>INTERFACE
31557  ENDIF
31558  ELSE
31559  CALL flagerror("Interface is not associated.",err,error,*999)
31560  ENDIF
31561 
31562  exits("FIELDS_INITIALISE_INTERFACE")
31563  RETURN
31564 999 errorsexits("FIELDS_INITIALISE_INTERFACE",err,error)
31565  RETURN 1
31566  END SUBROUTINE fields_initialise_interface
31567 
31568  !
31569  !================================================================================================================================
31570  !
31571 
31573  SUBROUTINE fields_initialise_region(REGION,ERR,ERROR,*)
31574 
31575  !Argument variables
31576  TYPE(region_type), POINTER :: region
31577  INTEGER(INTG), INTENT(OUT) :: err
31578  TYPE(varying_string), INTENT(OUT) :: error
31579  !Local Variables
31580 
31581  enters("FIELDS_INITIALISE_REGION",err,error,*999)
31582 
31583  IF(ASSOCIATED(region)) THEN
31584  IF(ASSOCIATED(region%FIELDS)) THEN
31585  CALL flagerror("Region already has fields associated.",err,error,*999)
31586  ELSE
31587  ALLOCATE(region%FIELDS,stat=err)
31588  IF(err/=0) CALL flagerror("Region fields could not be allocated.",err,error,*999)
31589  CALL fields_initialise_generic(region%FIELDS,err,error,*999)
31590  region%FIELDS%REGION=>region
31591  ENDIF
31592  ELSE
31593  CALL flagerror("Region is not associated.",err,error,*999)
31594  ENDIF
31595 
31596  exits("FIELDS_INITIALISE_REGION")
31597  RETURN
31598 999 errorsexits("FIELDS_INITIALISE_REGION",err,error)
31599  RETURN 1
31600  END SUBROUTINE fields_initialise_region
31601 
31602  !
31603  !================================================================================================================================
31604  !
31605 
31607  SUBROUTINE mesh_embedding_push_data(MESH_EMBEDDING,PARENT_FIELD,PARENT_COMPONENT,CHILD_FIELD,CHILD_COMPONENT,ERR,ERROR,*)
31608  TYPE(mesh_embedding_type), INTENT(INOUT) :: mesh_embedding
31609  INTEGER(INTG), INTENT(OUT) :: err
31610  TYPE(varying_string), INTENT(OUT) :: error
31611  TYPE(field_type), POINTER :: parent_field
31612  TYPE(field_type), POINTER :: child_field
31613  INTEGER(INTG), INTENT(IN) :: parent_component
31614  INTEGER(INTG), INTENT(IN) :: child_component
31615 
31616  !Local variables
31617  TYPE(mesh_element_type), POINTER :: element
31618  TYPE(basis_type), POINTER :: basis
31619  INTEGER(INTG) :: e,i,b,version
31620  REAL(DP) :: interp_val, wt
31621  REAL(DP),ALLOCATABLE :: parent_values(:)
31622 
31623  enters("MESH_EMBEDDING_PUSH_DATA",err,error,*999)
31624  version=1
31625  DO e=1,mesh_embedding%PARENT_MESH%NUMBER_OF_ELEMENTS
31626  element=>mesh_embedding%PARENT_MESH%TOPOLOGY(1)%PTR%ELEMENTS%ELEMENTS(e)
31627  basis=>element%BASIS
31628  ALLOCATE(parent_values(basis%NUMBER_OF_NODES))
31629 
31630  DO b=1,basis%NUMBER_OF_NODES
31631  ! Version variable added and initialized above
31632  CALL field_parameter_set_get_node(parent_field,field_u_variable_type,field_values_set_type,version,1,& ! TODO: FROM INPUT
31633  & element%GLOBAL_ELEMENT_NODES(b),parent_component,parent_values(b),err,error,*999) ! global no?
31634  ENDDO
31635 
31636 
31637  DO i=1,mesh_embedding%CHILD_NODE_XI_POSITION(e)%NUMBER_OF_NODES
31638  interp_val = 0.0
31639  DO b=1,basis%NUMBER_OF_NODES
31640  wt = basis_evaluate_xi(basis,b,no_part_deriv,mesh_embedding%CHILD_NODE_XI_POSITION(e)%XI_COORDS(:,i),err,error)
31641  interp_val = interp_val + wt * parent_values(b)
31642  ENDDO
31643 
31644  ! store in field
31645  ! Version variable added and initialized above
31646  CALL field_parameter_set_update_node(child_field,field_u_variable_type,field_values_set_type,version,1,& ! TODO: FROM INPUT
31647  & mesh_embedding%CHILD_NODE_XI_POSITION(e)%NODE_NUMBERS(i),child_component,interp_val,err,error,*999)
31648  ENDDO
31649  DEALLOCATE(parent_values)
31650  ENDDO
31651 
31652  RETURN
31653 999 errorsexits("MESH_EMBEDDING_PUSH_DATA",err,error)
31654  RETURN 1
31655  END SUBROUTINE mesh_embedding_push_data
31656 
31657  !
31658  !================================================================================================================================
31659  !
31660 
31661  SUBROUTINE mesh_embedding_pull_gauss_point_data(MESH_EMBEDDING,PARENT_FIELD,PARENT_COMPONENT,CHILD_FIELD,CHILD_COMPONENT,&
31662  & err,error,*)
31663 
31664  TYPE(mesh_embedding_type), INTENT(INOUT) :: mesh_embedding
31665  INTEGER(INTG), INTENT(OUT) :: err
31666  TYPE(varying_string), INTENT(OUT) :: error
31667  TYPE(field_type), POINTER :: parent_field
31668  TYPE(field_type), POINTER :: child_field
31669  INTEGER(INTG), INTENT(IN) :: parent_component
31670  INTEGER(INTG), INTENT(IN) :: child_component
31671 
31672  !Local variables
31673  TYPE(meshelementstype), POINTER :: elements
31674  TYPE(mesh_element_type), POINTER :: element
31675  TYPE(basis_type), POINTER :: basis
31676  INTEGER(INTG) :: e,gp,b, ngp,version
31677  REAL(DP) :: interp_val, wt, val
31678 
31679  enters("MESH_EMBEDDING_PULL_GAUSS_POINT_DATA",err,error,*999)
31680 
31681  elements=>mesh_embedding%CHILD_MESH%TOPOLOGY(1)%PTR%ELEMENTS
31682 
31683  basis=>mesh_embedding%CHILD_MESH%TOPOLOGY(1)%PTR%ELEMENTS%ELEMENTS(1)%BASIS
31684  version = 1
31685  DO e=1,mesh_embedding%PARENT_MESH%NUMBER_OF_ELEMENTS
31686  ngp = basis%QUADRATURE%QUADRATURE_SCHEME_MAP(basis_default_quadrature_scheme)%PTR%NUMBER_OF_GAUSS
31687  DO gp=1,ngp
31688  element=>elements%ELEMENTS(mesh_embedding%GAUSS_POINT_XI_POSITION(gp,e)%ELEMENT_NUMBER)
31689  basis=>element%BASIS
31690  DO b=1,basis%NUMBER_OF_NODES
31691  ! Version variable added and initialized above
31692  CALL field_parameter_set_get_node(child_field,field_u_variable_type,field_values_set_type,version,1,& ! TODO: FROM INPUT
31693  & element%GLOBAL_ELEMENT_NODES(b),child_component,val ,err,error,*999) ! global no?
31694  wt = basis_evaluate_xi(basis,b,no_part_deriv,mesh_embedding%GAUSS_POINT_XI_POSITION(gp,e)%CHILD_XI_COORD,err,error)
31695  interp_val = interp_val + wt * val
31696  ENDDO
31697  ! store in gauss point parent field
31698  CALL field_parameter_set_update_gauss_point(parent_field,field_u_variable_type,field_values_set_type,gp,e,& ! TODO: var type/par set from input
31699  & parent_component, interp_val,err,error,*999)
31700  ENDDO
31701  ENDDO
31702 
31703  RETURN
31704 999 errorsexits("MESH_EMBEDDING_PULL_GAUSS_POINT_DATA",err,error)
31705  RETURN 1
31706  END SUBROUTINE mesh_embedding_pull_gauss_point_data
31707 
31708  !
31709  !================================================================================================================================
31710  !
31711 
31713  SUBROUTINE field_parameter_set_get_gauss_point_coord(MESH_EMBEDDING,COMPONENT_NUMBER,NGP,COORD_VALUE, &
31714  & err,error,*)
31715 
31716  TYPE(mesh_embedding_type), INTENT(INOUT) :: mesh_embedding
31717  INTEGER(INTG), INTENT(IN) :: component_number
31718  INTEGER(INTG), INTENT(OUT) :: ngp
31719  REAL(DP), INTENT(OUT) :: coord_value(:)
31720  INTEGER(INTG), INTENT(OUT) :: err
31721  TYPE(varying_string), INTENT(OUT) :: error
31722 
31723  !Local variables
31724  TYPE(meshelementstype), POINTER :: elements
31725  TYPE(basis_type), POINTER :: basis
31726  INTEGER(INTG) :: gp
31727 
31728  enters("FIELD_PARAMETER_SET_GET_GAUSS_POINT_COORD",err,error,*999)
31729 
31730  elements=>mesh_embedding%PARENT_MESH%TOPOLOGY(1)%PTR%ELEMENTS
31731 
31732  basis=>mesh_embedding%PARENT_MESH%TOPOLOGY(1)%PTR%ELEMENTS%ELEMENTS(1)%BASIS
31733  ngp = basis%QUADRATURE%QUADRATURE_SCHEME_MAP(basis_default_quadrature_scheme)%PTR%NUMBER_OF_GAUSS
31734 
31735  DO gp = 1,ngp
31736  coord_value(gp) = basis%QUADRATURE%QUADRATURE_SCHEME_MAP(basis_default_quadrature_scheme)%PTR%&
31737  &gauss_positions(component_number,gp)
31738  ENDDO
31739 
31740 999 errorsexits("FIELD_PARAMETER_SET_GET_GAUSS_POINT_COORD",err,error)
31741  RETURN 1
31742  END SUBROUTINE field_parameter_set_get_gauss_point_coord
31743 
31744  !
31745  !================================================================================================================================
31746  !
31747 
31749  SUBROUTINE field_user_number_to_field_region( USER_NUMBER, REGION, FIELD, ERR, ERROR, * )
31750  !Arguments
31751  INTEGER(INTG), INTENT(IN) :: user_number
31752  TYPE(region_type), POINTER :: region
31753  TYPE(field_type), POINTER :: field
31754  INTEGER(INTG), INTENT(OUT) :: err
31755  TYPE(varying_string), INTENT(OUT) :: error
31756 
31757  !Locals
31758  TYPE(varying_string) :: local_error
31759 
31760  enters("FIELD_USER_NUMBER_TO_FIELD_REGION", err, error, *999 )
31761 
31762  NULLIFY( field )
31763  CALL field_user_number_find( user_number, region, field, err, error, *999 )
31764  CALL field_user_number_find( user_number, region, field, err, error, *999 )
31765  IF( .NOT.ASSOCIATED( field ) ) THEN
31766  local_error = "A field with an user number of "//trim(number_to_vstring( user_number, "*", err, error ))// &
31767  & " does not exist on region number "//trim(number_to_vstring( region%USER_NUMBER, "*", err, error ))//"."
31768  CALL flagerror( local_error, err, error, *999 )
31769  ENDIF
31770 
31771  exits( "FIELD_USER_NUMBER_TO_FIELD_REGION" )
31772  RETURN
31773 999 errorsexits( "FIELD_USER_NUMBER_TO_FIELD_REGION", err, error )
31774  RETURN 1
31775 
31776  END SUBROUTINE field_user_number_to_field_region
31777 
31778  !
31779  !================================================================================================================================
31780  !
31781 
31783  SUBROUTINE field_user_number_to_field_interface( USER_NUMBER, INTERFACE, FIELD, ERR, ERROR, * )
31784  !Arguments
31785  INTEGER(INTG), INTENT(IN) :: user_number
31786  TYPE(interface_type), POINTER :: interface
31787  TYPE(field_type), POINTER :: field
31788  INTEGER(INTG), INTENT(OUT) :: err
31789  TYPE(varying_string), INTENT(OUT) :: error
31790 
31791  !Locals
31792  TYPE(varying_string) :: local_error
31793 
31794  enters("FIELD_USER_NUMBER_TO_FIELD_INTERFACE", err, error, *999 )
31795 
31796  NULLIFY( field )
31797  CALL field_user_number_find( user_number, interface, field, err, error, *999 )
31798  CALL field_user_number_find( user_number, interface, field, err, error, *999 )
31799  IF( .NOT.ASSOCIATED( field ) ) THEN
31800  local_error = "A field with an user number of "//trim(number_to_vstring( user_number, "*", err, error ))// &
31801  & " does not exist on region number "//trim(number_to_vstring( interface%USER_NUMBER, "*", err, error ))//"."
31802  CALL flagerror( local_error, err, error, *999 )
31803  ENDIF
31804 
31805  exits( "FIELD_USER_NUMBER_TO_FIELD_INTERFACE" )
31806  RETURN
31807 999 errorsexits( "FIELD_USER_NUMBER_TO_FIELD_INTERFACE", err, error )
31808  RETURN 1
31809 
31810  END SUBROUTINE field_user_number_to_field_interface
31811 
31812  !
31813  !================================================================================================================================
31814  !
31815 
31816 END MODULE field_routines
This module contains all basis function routines.
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
Write a string followed by a value to a given output stream.
integer, parameter ptr
Pointer integer kind.
Definition: kinds.f90:58
Contains information for a component of a field variable.
Definition: types.f90:1254
This module contains all coordinate transformation and support routines.
Contains information for a region.
Definition: types.f90:3252
Converts a number to its equivalent varying string representation.
Definition: strings.f90:161
Contains information on the mesh decomposition.
Definition: types.f90:1063
A buffer type to allow for an array of pointers to a FIELD_TYPE.
Definition: types.f90:1368
Contains the topology information for a domain.
Definition: types.f90:724
Contains information on the fields defined on a region.
Definition: types.f90:1373
This module contains all string manipulation and transformation routines.
Definition: strings.f90:45
This module contains all mathematics support routines.
Definition: maths.f90:45
Contains information for a field defined on a region.
Definition: types.f90:1346
logical, save, public diagnostics2
.TRUE. if level 2 diagnostic output is active in the current routine
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
A type to temporarily hold (cache) the user modifiable values which are used to create a field...
Definition: types.f90:1316
integer(intg), parameter, public basis_default_quadrature_scheme
Identifier for the default quadrature scheme.
Contains information on a coordinate system.
Definition: types.f90:255
Contains the topology information for the elements of a domain.
Definition: types.f90:677
logical, save, public diagnostics3
.TRUE. if level 3 diagnostic output is active in the current routine
Contains the topology information for a decomposition.
Definition: types.f90:1054
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.
Definition: types.f90:70
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
Contains data point decompostion topology.
Definition: types.f90:1041
This module contains all computational environment variables.
This module contains CMISS MPI routines.
Definition: cmiss_mpi.f90:45
This module handles all domain mappings routines.
Contains information on a mesh defined on a region.
Definition: types.f90:503
Contains the topology information for the nodes of a domain.
Definition: types.f90:713
logical, save, public diagnostics1
.TRUE. if level 1 diagnostic output is active in the current routine
This module handles all distributed matrix vector routines.
Contains the interpolated value (and the derivatives wrt xi) of a field at a point. Old CMISS name XG.
Definition: types.f90:1129
A type to hold the parameter sets for a field.
Definition: types.f90:1268
integer(intg), parameter, public diagnostic_output_type
Diagnostic output type.
Contains information for a field variable defined on a field.
Definition: types.f90:1289
Contains the parameters required to interpolate a field variable within an element. Old CMISS name XE.
Definition: types.f90:1141
A pointer to the domain decomposition for this domain.
Definition: types.f90:938
subroutine, public errors(NAME, ERR, ERROR)
Records the exiting error of the subroutine.
Contains information for the interface data.
Definition: types.f90:2228
Implements lists of base types.
Definition: lists.f90:46
Contains all information about a basis .
Definition: types.f90:184
Flags an error condition.
Flags an error condition.
This module contains all kind definitions.
Definition: kinds.f90:45
This module handles all formating and input and output.