<commit_before>// The libMesh Finite Element Library.
// Copyright (C) 2002-2012 <NAME>, <NAME>, <NAME>

// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.

// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



// Local includes
#include "libmesh/dof_map.h"
#include "libmesh/fe.h"
#include "libmesh/fe_interface.h"
#include "libmesh/elem.h"
#include "libmesh/threads.h"
#include "libmesh/tensor_value.h"

namespace libMesh
{

  // ------------------------------------------------------------
  // Nedelec first kind specific implementations


  // Anonymous namespace for local helper functions
  namespace {
    void nedelec_one_nodal_soln(const Elem* elem,
				const Order order,
				const std::vector<Number>& elem_soln,
				const int dim,
				std::vector<Number>&       nodal_soln)
    {
      const unsigned int n_nodes = elem->n_nodes();
      const ElemType elem_type   = elem->type();

      const Order totalorder = static_cast<Order>(order+elem->p_level());

      nodal_soln.resize(n_nodes*dim);

      FEType fe_type(totalorder, NEDELEC_ONE);

      switch (totalorder)
	{
	case FIRST:
	  {
	    switch (elem_type)
	      {
	      case TRI6:
		{
		  libmesh_assert_equal_to (elem_soln.size(), 3);
		  libmesh_assert_equal_to (nodal_soln.size(), 6*2);
		  break;
		}
	      case QUAD8:
	      case QUAD9:
		{
		  libmesh_assert_equal_to (elem_soln.size(), 4);

		  if (elem_type == QUAD8)
		    libmesh_assert_equal_to (nodal_soln.size(), 8*2);
		  else
		    libmesh_assert_equal_to (nodal_soln.size(), 9*2);
		  break;
		}
	      case TET10:
		{
		  libmesh_assert_equal_to (elem_soln.size(), 6);
		  libmesh_assert_equal_to (nodal_soln.size(), 10*3);

		  libmesh_not_implemented();

		  break;
		}


	      case HEX20:
	      case HEX27:
		{
		  libmesh_assert_equal_to (elem_soln.size(), 12);

		  if (elem_type == HEX20)
		    libmesh_assert_equal_to (nodal_soln.size(), 20*3);
		  else
		    libmesh_assert_equal_to (nodal_soln.size(), 27*3);

		  libmesh_not_implemented();

		  break;
		}

	      default:
		{
		  libmesh_error();

		  break;
		}

	      } // switch(elem_type)

	    const unsigned int n_sf =
	      FEInterface::n_shape_functions(dim, fe_type, elem_type);

	    std::vector<Point> refspace_nodes;
	    FEVectorBase::get_refspace_nodes(elem_type,refspace_nodes);
	    libmesh_assert_equal_to (refspace_nodes.size(), n_nodes);


	    // Need to create new fe object so the shape function as the FETransformation
	    // applied to it.
	    AutoPtr<FEVectorBase> vis_fe = FEVectorBase::build(dim,fe_type);

	    const std::vector<std::vector<RealGradient> >& vis_phi = vis_fe->get_phi();

	    vis_fe->reinit(elem,&refspace_nodes);

	    for( unsigned int n = 0; n < n_nodes; n++ )
	      {
		libmesh_assert_equal_to (elem_soln.size(), n_sf);

		// Zero before summation
		nodal_soln[2*n] = 0;
		nodal_soln[2*n+1] = 0;

		// u = Sum (u_i phi_i)
		for (unsigned int i=0; i<n_sf; i++)
		  {
		    nodal_soln[2*n]   += elem_soln[i]*(vis_phi[i][n](0));
		    nodal_soln[2*n+1] += elem_soln[i]*(vis_phi[i][n](1));
		  }
	      }

	    return;
	  } // case FIRST

	default:
	  {
	    libmesh_error();
	  }

	}//switch (totalorder)

      return;
    } // nedelec_one_nodal_soln


    unsigned int nedelec_one_n_dofs(const ElemType t, const Order o)
    {
      switch (o)
	{
	case FIRST:
	  {
	    switch (t)
	      {
	      case TRI6:
		return 3;

	      case QUAD8:
	      case QUAD9:<commit_msg>Output now can do 2D and 3D, not just 2D.<commit_after>// The libMesh Finite Element Library.
// Copyright (C) 2002-2012 <NAME>, <NAME>, <NAME>

// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.

// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



// Local includes
#include "libmesh/dof_map.h"
#include "libmesh/fe.h"
#include "libmesh/fe_interface.h"
#include "libmesh/elem.h"
#include "libmesh/threads.h"
#include "libmesh/tensor_value.h"

namespace libMesh
{

  // ------------------------------------------------------------
  // Nedelec first kind specific implementations


  // Anonymous namespace for local helper functions
  namespace {
    void nedelec_one_nodal_soln(const Elem* elem,
				const Order order,
				const std::vector<Number>& elem_soln,
				const int dim,
				std::vector<Number>&       nodal_soln)
    {
      const unsigned int n_nodes = elem->n_nodes();
      const ElemType elem_type   = elem->type();

      const Order totalorder = static_cast<Order>(order+elem->p_level());

      nodal_soln.resize(n_nodes*dim);

      FEType fe_type(totalorder, NEDELEC_ONE);

      switch (totalorder)
	{
	case FIRST:
	  {
	    switch (elem_type)
	      {
	      case TRI6:
		{
		  libmesh_assert_equal_to (elem_soln.size(), 3);
		  libmesh_assert_equal_to (nodal_soln.size(), 6*2);
		  break;
		}
	      case QUAD8:
	      case QUAD9:
		{
		  libmesh_assert_equal_to (elem_soln.size(), 4);

		  if (elem_type == QUAD8)
		    libmesh_assert_equal_to (nodal_soln.size(), 8*2);
		  else
		    libmesh_assert_equal_to (nodal_soln.size(), 9*2);
		  break;
		}
	      case TET10:
		{
		  libmesh_assert_equal_to (elem_soln.size(), 6);
		  libmesh_assert_equal_to (nodal_soln.size(), 10*3);

		  libmesh_not_implemented();

		  break;
		}


	      case HEX20:
	      case HEX27:
		{
		  libmesh_assert_equal_to (elem_soln.size(), 12);

		  if (elem_type == HEX20)
		    libmesh_assert_equal_to (nodal_soln.size(), 20*3);
		  else
		    libmesh_assert_equal_to (nodal_soln.size(), 27*3);

		  break;
		}

	      default:
		{
		  libmesh_error();

		  break;
		}

	      } // switch(elem_type)

	    const unsigned int n_sf =
	      FEInterface::n_shape_functions(dim, fe_type, elem_type);

	    std::vector<Point> refspace_nodes;
	    FEVectorBase::get_refspace_nodes(elem_type,refspace_nodes);
	    libmesh_assert_equal_to (refspace_nodes.size(), n_nodes);


	    // Need to create new fe object so the shape function as the FETransformation
	    // applied to it.
	    AutoPtr<FEVectorBase> vis_fe = FEVectorBase::build(dim,fe_type);

	    const std::vector<std::vector<RealGradient> >& vis_phi = vis_fe->get_phi();

	    vis_fe->reinit(elem,&refspace_nodes);

	    for( unsigned int n = 0; n < n_nodes; n++ )
	      {
		libmesh_assert_equal_to (elem_soln.size(), n_sf);

		// Zero before summation
                for( int d = 0; d < dim; d++ )
                  {
                    nodal_soln[dim*n+d] = 0;
                  }

		// u = Sum (u_i phi_i)
		for (unsigned int i=0; i<n_sf; i++)
		  {
                    for( int d = 0; d < dim; d++ )
                      {
                        nodal_soln[dim*n+d]   += elem_soln[i]*(vis_phi[i][n](d));
                      }
		  }
	      }

	    return;
	  } // case FIRST

	default:
	  {
	    libmesh_error();
	  }

	}//switch (totalorder)

      return;
    } // nedelec_one_nodal_soln


    unsigned int nedelec_one_n_dofs(const ElemType t, const Order o)
    {
      switch (o)
	{
	case FIRST:
	  {
	    switch (t)
	      {
	      case TRI6:
		return 3;

	      case QUAD8:
	      case QUAD9:
{'fraction_non_alphanumeric': 0.12489400363416112, 'fraction_numerical': 0.016959418534221685, 'mean_word_length': 2.572479446127218, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 33, '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': '3675916', 'n_tokens_mistral': 3189, 'n_tokens_neox': 2769, 'n_words': 725}