<commit_before>/* $Id$ */
/* Copyright <NAME>, <NAME> University of Heidelberg, 1999 */


#include <fe/fe_system.h>





template <int dim>
FESystem<dim>::~FESystem ()
{
  for (unsigned i=0;i<base_elements.size();++i)
    {
      base_elements[i].first -> unsubscribe ();
      delete base_elements[i].first;
    }
};


template <int dim>
void
FESystem<dim>::build_cell_table()
{
  unsigned total_index = 0;
  for (unsigned base=0 ; base < n_base_elements() ; ++base)
    for (unsigned m = 0; m < element_multiplicity(base); ++m)
      component_to_base_table[total_index++] = base;

				   // Initialize index table
				   // Multi-component base elements have
				   // to be thought of.
  
				   // 1. Vertices
  total_index = 0;
  for (unsigned vertex_number= 0 ; vertex_number < GeometryInfo<dim>::vertices_per_cell ;
       ++vertex_number)
    {
      unsigned comp_start = 0;
      for(unsigned base = 0; base < n_base_elements() ;
	  ++base)
	{
	  for (unsigned m = 0; m < element_multiplicity(base); ++m)
	    {
	      for (unsigned local_index = 0 ;
		   local_index < base_element(base).dofs_per_vertex ;
		   ++local_index)
		{
		  system_to_component_table[total_index++]
		    = pair<unsigned,unsigned>
		    (comp_start+m,
		     vertex_number*base_element(base).dofs_per_vertex+local_index);
		}
	    }
	  comp_start += element_multiplicity(base);
	}
    }
  
				   // 2. Lines
  for (unsigned line_number= 0 ; ((line_number != GeometryInfo<dim>::lines_per_cell) &&
				  (GeometryInfo<dim>::lines_per_cell > 0));
       ++line_number)
    {
      unsigned comp_start = 0;
      for(unsigned base = 0; base < n_base_elements() ;
	  ++base)
	{
	  for (unsigned m = 0; m < element_multiplicity(base); ++m)
	    {
	      for (unsigned local_index = 0 ;
		   local_index < base_element(base).dofs_per_line ;
		   ++local_index)
		{
		  system_to_component_table[total_index++]
		    = pair<unsigned,unsigned>
		    (comp_start+m,
		     line_number*base_element(base).dofs_per_line
		     +local_index+base_element(base).first_line_index);
		}
	    }
	  comp_start += element_multiplicity(base);
	}
    }
  
				   // 3. Quads
  for (unsigned quad_number= 0 ; ((quad_number != GeometryInfo<dim>::quads_per_cell) &&
				  (GeometryInfo<dim>::quads_per_cell > 0));
       ++quad_number)
    {
      unsigned comp_start = 0;
      for(unsigned base = 0; base < n_base_elements() ;
	  ++base)
	{
	  for (unsigned m = 0; m < element_multiplicity(base); ++m)
	    {
	      for (unsigned local_index = 0 ;
		   local_index < base_element(base).dofs_per_quad ;
		   ++local_index)
		{
		  system_to_component_table[total_index++]
		    = pair<unsigned,unsigned>
		    (comp_start+m,
		     quad_number*base_element(base).dofs_per_quad
		     +local_index+base_element(base).first_quad_index);
		}
	    }
	  comp_start += element_multiplicity(base);
	}
    }
  
				   // 4. Hex
  for (unsigned hex_number= 0 ; ((hex_number != GeometryInfo<dim>::hexes_per_cell) &&
				 (GeometryInfo<dim>::hexes_per_cell > 0));
       ++hex_number)
    {
      unsigned comp_start = 0;
      for(unsigned base = 0; base < n_base_elements() ;
	  ++base)
	{
	  for (unsigned m = 0; m < element_multiplicity(base); ++m)
	    {
	      for (unsigned local_index = 0 ;
		   local_index < base_element(base).dofs_per_hex ;
		   ++local_index)
		{
		  system_to_component_table[total_index++]
		    = pair<unsigned,unsigned>
		    (comp_start+m,
		     hex_number*base_element(base).dofs_per_hex
		     +local_index+base_element(base).first_hex_index);
		}
	    }
	  comp_start += element_multiplicity(base);
	  
	}
    }
				   // Inintialize mapping from component
				   // to base element
				   // Initialize mapping from components to
				   // linear index. Fortunately, this is
				   // the inverse of what we just did.
  for (unsigned comp=0 ; comp<n_components ; ++comp)
    component_to_system_table[comp]
      .resize(base_element(component_to_base_table[comp]).total_dofs);

  for (unsigned sys=0 ; sys < total_dofs ; ++sys)
    component_to_system_table[system_to_component_table[sys].first]
      [system_to_component_table[sys].second] = sys;
}


template <int dim>
void
FESystem<dim>::build_face_table()
{
  unsigned total_index = 0;
  for (unsigned base=0 ; base < n_base_elements() ; ++base)
    for (unsigned m = 0; m < element_multiplicity(base); ++m)
      component_to_base_table[total_index++] = base;

				   // Initialize index table
				   // Multi-component base elements have
				   // to be thought of.
  
				   // 1. Vertices
  total_index = 0;
  for (unsigned vertex_number= 0 ; vertex_number < GeometryInfo<dim>::vertices_per_face ;
       ++vertex_number)
    {
      unsigned comp_start = 0;
      for(unsigned base = 0; base < n_base_elements() ;
	  ++base)
	{
	  for (unsigned m = 0; m < element_multiplicity(base); ++m)
	    {
	      for (unsigned local_index = 0 ;
		   local_index < base_element(base).dofs_per_vertex ;<commit_msg>Distribute a handful of 'int's, but haven't sufficient of them to fix all places...<commit_after>/* $Id$ */
/* Copyright <NAME>, <NAME> University of Heidelberg, 1999 */


#include <fe/fe_system.h>





template <int dim>
FESystem<dim>::~FESystem ()
{
  for (unsigned i=0;i<base_elements.size();++i)
    {
      base_elements[i].first -> unsubscribe ();
      delete base_elements[i].first;
    }
};


template <int dim>
void
FESystem<dim>::build_cell_table()
{
  unsigned total_index = 0;
  for (unsigned int base=0 ; base < n_base_elements() ; ++base)
    for (unsigned int m = 0; m < element_multiplicity(base); ++m)
      component_to_base_table[total_index++] = base;

				   // Initialize index table
				   // Multi-component base elements have
				   // to be thought of.
  
				   // 1. Vertices
  total_index = 0;
  for (unsigned int vertex_number= 0 ;
       vertex_number < GeometryInfo<dim>::vertices_per_cell ;
       ++vertex_number)
    {
      unsigned comp_start = 0;
      for(unsigned int base = 0; base < n_base_elements() ;
	  ++base)
	{
	  for (unsigned int m = 0; m < element_multiplicity(base); ++m)
	    {
	      for (unsigned int local_index = 0 ;
		   local_index < base_element(base).dofs_per_vertex ;
		   ++local_index)
		{
		  system_to_component_table[total_index++]
		    = make_pair (comp_start+m,
				 vertex_number*base_element(base).dofs_per_vertex
				 +local_index);
		}
	    }
	  comp_start += element_multiplicity(base);
	}
    }
  
				   // 2. Lines
  for (unsigned int line_number= 0 ; ((line_number != GeometryInfo<dim>::lines_per_cell) &&
				  (GeometryInfo<dim>::lines_per_cell > 0));
       ++line_number)
    {
      unsigned comp_start = 0;
      for(unsigned int base = 0; base < n_base_elements() ;
	  ++base)
	{
	  for (unsigned int m = 0; m < element_multiplicity(base); ++m)
	    {
	      for (unsigned int local_index = 0 ;
		   local_index < base_element(base).dofs_per_line ;
		   ++local_index)
		{
		  system_to_component_table[total_index++]
		    = pair<unsigned,unsigned>
		    (comp_start+m,
		     line_number*base_element(base).dofs_per_line
		     +local_index+base_element(base).first_line_index);
		}
	    }
	  comp_start += element_multiplicity(base);
	}
    }
  
				   // 3. Quads
  for (unsigned int quad_number= 0 ;
       ((quad_number != GeometryInfo<dim>::quads_per_cell) &&
	(GeometryInfo<dim>::quads_per_cell > 0));
       ++quad_number)
    {
      unsigned int comp_start = 0;
      for(unsigned int base = 0; base < n_base_elements() ;
	  ++base)
	{
	  for (unsigned int m = 0; m < element_multiplicity(base); ++m)
	    {
	      for (unsigned int local_index = 0 ;
		   local_index < base_element(base).dofs_per_quad ;
		   ++local_index)
		{
		  system_to_component_table[total_index++]
		    = make_pair (comp_start+m,
				 quad_number*base_element(base).dofs_per_quad
				 +local_index+base_element(base).first_quad_index);
		}
	    }
	  comp_start += element_multiplicity(base);
	}
    }
  
				   // 4. Hex
  for (unsigned int hex_number= 0 ;
       ((hex_number != GeometryInfo<dim>::hexes_per_cell) &&
	(GeometryInfo<dim>::hexes_per_cell > 0));
       ++hex_number)
    {
      unsigned int comp_start = 0;
      for(unsigned int base = 0; base < n_base_elements() ;
	  ++base)
	{
	  for (unsigned int m = 0; m < element_multiplicity(base); ++m)
	    {
	      for (unsigned int local_index = 0 ;
		   local_index < base_element(base).dofs_per_hex ;
		   ++local_index)
		{
		  system_to_component_table[total_index++]
		    = make_pair (comp_start+m,
				 hex_number*base_element(base).dofs_per_hex
				 +local_index+base_element(base).first_hex_index);
		}
	    }
	  comp_start += element_multiplicity(base);
	  
	}
    }
				   // Inintialize mapping from component
				   // to base element
				   // Initialize mapping from components to
				   // linear index. Fortunately, this is
				   // the inverse of what we just did.
  for (unsigned int comp=0 ; comp<n_components ; ++comp)
    component_to_system_table[comp]
      .resize(base_element(component_to_base_table[comp]).total_dofs);

  for (unsigned int sys=0 ; sys < total_dofs ; ++sys)
    component_to_system_table[system_to_component_table[sys].first]
      [system_to_component_table[sys].second] = sys;
}


template <int dim>
void
FESystem<dim>::build_face_table()
{
  unsigned total_index = 0;
  for (unsigned int base=0 ; base < n_base_elements() ; ++base)
    for (unsigned int m = 0; m < element_multiplicity(base); ++m)
      component_to_base_table[total_index++] = base;

				   // Initialize index table
				   // Multi-component base elements have
				   // to be thought of.
  
				   // 1. Vertices
  total_index = 0;
  for (unsigned int vertex_number= 0 ; vertex_number < GeometryInfo<dim>::vertices_per_face ;
       ++vertex_number)
    {
      unsigned int comp_start = 0;
      for(unsigned int base = 0; base < n_base_elements() ;
	  ++base)
	{
	  for (unsigned int m = 0; m < element_multiplicity(base); ++m)
	    {
	      for (unsigned int local_index = 0 ;
		   local_index < base_element(base).dofs_per_vertex ;
{'fraction_non_alphanumeric': 0.12442763288871192, 'fraction_numerical': 0.009556042205853077, 'mean_word_length': 2.986904761904762, 'pattern_counts': {'":': 0, '<': 90, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4026494', 'n_tokens_mistral': 3801, 'n_tokens_neox': 3338, 'n_words': 695}