@@ -656,9 +656,9 @@ t8_cmesh_partition_copy_data (char *send_buffer, t8_cmesh_t cmesh, const t8_cmes
656656 sc_array_t *send_as_ghost, const t8_locidx_t send_first, const t8_locidx_t send_last,
657657 const size_t total_alloc, const int to_proc)
658658{
659- t8_ctree_t tree, tree_cpy ;
659+ t8_ctree_t tree, tree_copy ;
660660 int num_attributes;
661- size_t temp_offset_tree, temp_offset_att, iz, temp_offset, temp_offset_data, last_offset, last_num_att, last_size,
661+ size_t temp_offset_tree, temp_offset_att, temp_offset, temp_offset_data, last_offset, last_num_att, last_size,
662662 temp_offset_ghost_att, temp_offset_ghost_data, temp_offset_ghost, ghost_attr_info_bytes_sofar;
663663 size_t ghost_att_size;
664664 // ssize_t last_attribute_diff;
@@ -668,7 +668,7 @@ t8_cmesh_partition_copy_data (char *send_buffer, t8_cmesh_t cmesh, const t8_cmes
668668 t8_locidx_t ghosts_left;
669669 t8_locidx_t *face_neighbor, ghost_id, itree;
670670 t8_gloidx_t *face_neighbor_g, *face_neighbor_gnew, new_neighbor;
671- t8_cghost_t ghost, ghost_cpy ;
671+ t8_cghost_t ghost, ghost_copy ;
672672 int iface, iatt;
673673 int8_t *ttf_ghost, *ttf;
674674
@@ -724,48 +724,48 @@ t8_cmesh_partition_copy_data (char *send_buffer, t8_cmesh_t cmesh, const t8_cmes
724724 temp_offset_tree = 0 ;
725725
726726 /* Set attribute offsets of trees and attribute data offsets of info objects */
727- tree_cpy = NULL ;
727+ tree_copy = NULL ;
728728 last_num_att = 0 ;
729729 last_size = 0 ;
730730 last_offset = attr_info_bytes;
731731
732732 for (itree = send_first; itree <= send_last; itree++) {
733733 /* Get the current tree */
734- tree_cpy = (t8_ctree_t ) (send_buffer + temp_offset_tree);
734+ tree_copy = (t8_ctree_t ) (send_buffer + temp_offset_tree);
735735
736736 /* new neighbor offset of tree */
737- tree_cpy ->neigh_offset = temp_offset - temp_offset_tree;
737+ tree_copy ->neigh_offset = temp_offset - temp_offset_tree;
738738
739739 /* Set new face neighbor entries, since we store local ids we have to adapt
740740 * to the local ids of the new process */
741- face_neighbor = (t8_locidx_t *) T8_TREE_FACE (tree_cpy );
742- for (iface = 0 ; iface < t8_eclass_num_faces[tree_cpy ->eclass ]; iface++) {
741+ face_neighbor = (t8_locidx_t *) T8_TREE_FACE (tree_copy );
742+ for (iface = 0 ; iface < t8_eclass_num_faces[tree_copy ->eclass ]; iface++) {
743743 t8_cmesh_partition_send_change_neighbor (cmesh, (t8_cmesh_t ) cmesh_from, face_neighbor + iface, to_proc);
744744 }
745745
746746 /* compute neighbor offset for next tree */
747- temp_offset += t8_eclass_num_faces[tree_cpy ->eclass ] * (sizeof (t8_locidx_t ) + sizeof (int8_t ))
748- + T8_ADD_PADDING (t8_eclass_num_faces[tree_cpy ->eclass ] * (sizeof (t8_locidx_t ) + sizeof (int8_t )));
747+ temp_offset += t8_eclass_num_faces[tree_copy ->eclass ] * (sizeof (t8_locidx_t ) + sizeof (int8_t ))
748+ + T8_ADD_PADDING (t8_eclass_num_faces[tree_copy ->eclass ] * (sizeof (t8_locidx_t ) + sizeof (int8_t )));
749749
750750 /* new attribute offset for tree */
751- tree_cpy ->att_offset = temp_offset_att - temp_offset_tree;
752- if (tree_cpy ->num_attributes > 0 ) {
753- attr_info = T8_TREE_ATTR_INFO (tree_cpy , 0 );
751+ tree_copy ->att_offset = temp_offset_att - temp_offset_tree;
752+ if (tree_copy ->num_attributes > 0 ) {
753+ attr_info = T8_TREE_ATTR_INFO (tree_copy , 0 );
754754 attr_info->attribute_offset = last_offset + last_size - last_num_att * sizeof (t8_attribute_info_struct_t );
755755 last_offset = attr_info->attribute_offset ;
756756 last_size = attr_info->attribute_size ;
757757
758758 /* set new attribute data offsets */
759- for (iz = 1 ; iz < (size_t ) tree_cpy ->num_attributes ; iz ++) {
759+ for (size_t iattribute = 1 ; iattribute < (size_t ) tree_copy ->num_attributes ; iattribute ++) {
760760 attr_info++;
761761 attr_info->attribute_offset = last_offset + last_size;
762762 last_offset = attr_info->attribute_offset ;
763763 last_size = attr_info->attribute_size ;
764764 }
765- temp_offset_att += tree_cpy ->num_attributes * sizeof (t8_attribute_info_struct_t );
765+ temp_offset_att += tree_copy ->num_attributes * sizeof (t8_attribute_info_struct_t );
766766 }
767767 temp_offset_tree += sizeof (t8_ctree_struct_t );
768- last_num_att = tree_cpy ->num_attributes ;
768+ last_num_att = tree_copy ->num_attributes ;
769769 }
770770
771771 /* Copy all ghosts and set their face entries and offsets */
@@ -780,27 +780,28 @@ t8_cmesh_partition_copy_data (char *send_buffer, t8_cmesh_t cmesh, const t8_cmes
780780 temp_offset_ghost_data = 0 ;
781781 /* number of bytes of attribute_infos that we already counted */
782782 ghost_attr_info_bytes_sofar = 0 ;
783- for (iz = 0 ; iz < send_as_ghost->elem_count ; iz++) {
784- ghost_id = *((t8_locidx_t *) sc_array_index (send_as_ghost, iz));
785- ghost_cpy = (t8_cghost_t ) (send_buffer + num_trees * sizeof (t8_ctree_struct_t ) + iz * sizeof (t8_cghost_struct_t ));
783+ for (size_t isendghost = 0 ; isendghost < send_as_ghost->elem_count ; isendghost++) {
784+ ghost_id = *((t8_locidx_t *) sc_array_index (send_as_ghost, isendghost));
785+ ghost_copy
786+ = (t8_cghost_t ) (send_buffer + num_trees * sizeof (t8_ctree_struct_t ) + isendghost * sizeof (t8_cghost_struct_t ));
786787 /* Get the correct element class from the ghost_id.
787788 * For this we have to check whether ghost_id points to a local tree or ghost */
788- ghost_cpy ->eclass = ghost_id < cmesh_from->num_local_trees
789- ? t8_cmesh_get_tree_class ((t8_cmesh_t ) cmesh_from, ghost_id)
790- : t8_cmesh_get_ghost_class ((t8_cmesh_t ) cmesh_from, ghost_id - cmesh_from->num_local_trees );
791- ghost_cpy ->neigh_offset = temp_offset - temp_offset_ghost; /* New face neighbor offset */
792- face_neighbor_gnew = (t8_gloidx_t *) T8_GHOST_FACE (ghost_cpy );
793- ttf_ghost = T8_GHOST_TTF (ghost_cpy );
789+ ghost_copy ->eclass = ghost_id < cmesh_from->num_local_trees
790+ ? t8_cmesh_get_tree_class ((t8_cmesh_t ) cmesh_from, ghost_id)
791+ : t8_cmesh_get_ghost_class ((t8_cmesh_t ) cmesh_from, ghost_id - cmesh_from->num_local_trees );
792+ ghost_copy ->neigh_offset = temp_offset - temp_offset_ghost; /* New face neighbor offset */
793+ face_neighbor_gnew = (t8_gloidx_t *) T8_GHOST_FACE (ghost_copy );
794+ ttf_ghost = T8_GHOST_TTF (ghost_copy );
794795 if (ghost_id >= cmesh_from->num_local_trees ) {
795796 /* The ghost that we send was a local ghost */
796797 ghost = t8_cmesh_trees_get_ghost_ext (cmesh_from->trees , ghost_id - cmesh_from->num_local_trees , &face_neighbor_g,
797798 &ttf);
798799 tree = NULL ;
799800 /* Set entries of the new ghost */
800- ghost_cpy ->eclass = ghost->eclass ;
801- ghost_cpy ->treeid = ghost->treeid ;
802- ghost_cpy ->num_attributes = ghost->num_attributes ;
803- num_attributes = ghost_cpy ->num_attributes ;
801+ ghost_copy ->eclass = ghost->eclass ;
802+ ghost_copy ->treeid = ghost->treeid ;
803+ ghost_copy ->num_attributes = ghost->num_attributes ;
804+ num_attributes = ghost_copy ->num_attributes ;
804805 if (num_attributes > 0 ) {
805806 /* get a pointer to the first att_info and the first attribute */
806807 attr_info = T8_GHOST_ATTR_INFO (ghost, 0 );
@@ -814,7 +815,7 @@ t8_cmesh_partition_copy_data (char *send_buffer, t8_cmesh_t cmesh, const t8_cmes
814815 }
815816 /* Copy face_neighbor entries and ttf entries */
816817 memcpy (face_neighbor_gnew, face_neighbor_g,
817- t8_eclass_num_faces[ghost_cpy ->eclass ] * (sizeof (t8_gloidx_t ) + sizeof (int8_t )));
818+ t8_eclass_num_faces[ghost_copy ->eclass ] * (sizeof (t8_gloidx_t ) + sizeof (int8_t )));
818819 }
819820 else {
820821 /* The ghost we send was a local tree */
@@ -823,10 +824,10 @@ t8_cmesh_partition_copy_data (char *send_buffer, t8_cmesh_t cmesh, const t8_cmes
823824 ghost = NULL ;
824825 T8_ASSERT (ghost_id == tree->treeid );
825826 /* Set entries of the new ghost */
826- ghost_cpy ->eclass = tree->eclass ;
827- ghost_cpy ->treeid = ghost_id + cmesh_from->first_tree ;
828- ghost_cpy ->num_attributes = tree->num_attributes ;
829- num_attributes = ghost_cpy ->num_attributes ;
827+ ghost_copy ->eclass = tree->eclass ;
828+ ghost_copy ->treeid = ghost_id + cmesh_from->first_tree ;
829+ ghost_copy ->num_attributes = tree->num_attributes ;
830+ num_attributes = ghost_copy ->num_attributes ;
830831 if (num_attributes > 0 ) {
831832 /* get a pointer to the first att_info and the first attribute */
832833 attr_info = T8_TREE_ATTR_INFO (tree, 0 );
@@ -840,7 +841,7 @@ t8_cmesh_partition_copy_data (char *send_buffer, t8_cmesh_t cmesh, const t8_cmes
840841 }
841842 /* copy face_neighbor entries, since the ones on the tree are local and
842843 * we need global, we have to compute each one */
843- for (iface = 0 ; iface < t8_eclass_num_faces[ghost_cpy ->eclass ]; iface++) {
844+ for (iface = 0 ; iface < t8_eclass_num_faces[ghost_copy ->eclass ]; iface++) {
844845 if (face_neighbor[iface] < 0 ) {
845846 /* TODO: think about this */
846847 new_neighbor = -1 ; /* boundary indicator */
@@ -852,28 +853,28 @@ t8_cmesh_partition_copy_data (char *send_buffer, t8_cmesh_t cmesh, const t8_cmes
852853 face_neighbor_gnew[iface] = new_neighbor;
853854 }
854855 /* Copy tree_to_face entries */
855- memcpy (ttf_ghost, ttf, t8_eclass_num_faces[ghost_cpy ->eclass ] * sizeof (int8_t ));
856+ memcpy (ttf_ghost, ttf, t8_eclass_num_faces[ghost_copy ->eclass ] * sizeof (int8_t ));
856857 } /* Done distinction between from tree and from ghost */
857858
858859 /* Compute and store new attribute offset of this ghost */
859- ghosts_left = send_as_ghost->elem_count - iz ;
860- ghost_cpy ->att_offset = ghosts_left * sizeof (t8_cghost_struct_t ) + ghost_neighbor_bytes + tree_neighbor_bytes
861- + attr_info_bytes + tree_attribute_bytes + temp_offset_ghost_att;
860+ ghosts_left = send_as_ghost->elem_count - isendghost ;
861+ ghost_copy ->att_offset = ghosts_left * sizeof (t8_cghost_struct_t ) + ghost_neighbor_bytes + tree_neighbor_bytes
862+ + attr_info_bytes + tree_attribute_bytes + temp_offset_ghost_att;
862863 if (num_attributes > 0 ) {
863864 size_t this_ghosts_att_info_size;
864865 t8_attribute_info_struct_t *first_attr_info;
865866
866867 /* The byte count of this ghosts attribute info structs */
867868 this_ghosts_att_info_size = num_attributes * sizeof (t8_attribute_info_struct_t );
868869 /* Copy all attribute info data of this ghost */
869- first_attr_info = (t8_attribute_info_struct_t *) T8_GHOST_FIRST_ATT_INFO (ghost_cpy );
870+ first_attr_info = (t8_attribute_info_struct_t *) T8_GHOST_FIRST_ATT_INFO (ghost_copy );
870871 memcpy (first_attr_info, attr_info, this_ghosts_att_info_size);
871872 temp_offset_ghost_att += this_ghosts_att_info_size;
872873
873874 /* Compute all new attribute data offsets */
874875 for (iatt = 0 ; iatt < num_attributes; iatt++) {
875876 /* Get the current attribute info */
876- attr_info = T8_GHOST_ATTR_INFO (ghost_cpy , iatt);
877+ attr_info = T8_GHOST_ATTR_INFO (ghost_copy , iatt);
877878 /* The new attribute offset is the offset from the first att_info to the data.
878879 * Thus, the count of the bytes occupied by the att_info (ghosts_attr_info_bytes)
879880 * plus the count of all attributes before this attribute (this_data_temp_offset).*/
@@ -883,11 +884,11 @@ t8_cmesh_partition_copy_data (char *send_buffer, t8_cmesh_t cmesh, const t8_cmes
883884 }
884885 ghost_attr_info_bytes_sofar += num_attributes * sizeof (t8_attribute_info_struct_t );
885886 /* Copy all attribute data of this ghost */
886- memcpy (T8_GHOST_ATTR (ghost_cpy , first_attr_info), first_attribute, ghost_att_size);
887+ memcpy (T8_GHOST_ATTR (ghost_copy , first_attr_info), first_attribute, ghost_att_size);
887888 } /* end num_attributes > 0 */
888889 /* compute new offsets */
889- temp_offset += t8_eclass_num_faces[ghost_cpy ->eclass ] * (sizeof (t8_gloidx_t ) + sizeof (int8_t )) /* offset */
890- + T8_ADD_PADDING (t8_eclass_num_faces[ghost_cpy ->eclass ]
890+ temp_offset += t8_eclass_num_faces[ghost_copy ->eclass ] * (sizeof (t8_gloidx_t ) + sizeof (int8_t )) /* offset */
891+ + T8_ADD_PADDING (t8_eclass_num_faces[ghost_copy ->eclass ]
891892 * (sizeof (t8_gloidx_t ) + sizeof (int8_t ))); /* padding */
892893 temp_offset_ghost += sizeof (t8_cghost_struct_t );
893894 }
0 commit comments