<commit_before>// Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
// the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
// reserved. See file COPYRIGHT for details.
//
// This file is part of the MFEM library. For more information and source code
// availability see http://mfem.org.
//
// MFEM 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) version 2.1 dated February 1999.

#include "transfer.hpp"

namespace mfem
{

TransferOperator::TransferOperator(const FiniteElementSpace &lFESpace_,
                                   const FiniteElementSpace &hFESpace_)
    : Operator(hFESpace_.GetVSize(), lFESpace_.GetVSize())
{
   // If both spaces' FE collection pointers are pointing to the same collection
   // we assume that the grid was refined while keeping the order constant
   if (lFESpace_.FEColl() == hFESpace_.FEColl())
   {
      OperatorPtr P(Operator::ANY_TYPE);
      hFESpace_.GetTransferOperator(lFESpace_, P);
      P.SetOperatorOwner(false);
      opr = P.Ptr();
   }
   else
   {
      opr = new OrderTransferOperator(lFESpace_, hFESpace_);
   }
}

TransferOperator::~TransferOperator() { delete opr; }

void TransferOperator::Mult(const Vector &x, Vector &y) const
{
   opr->Mult(x, y);
}

void TransferOperator::MultTranspose(const Vector &x, Vector &y) const
{
   opr->MultTranspose(x, y);
}

OrderTransferOperator::OrderTransferOperator(
    const FiniteElementSpace &lFESpace_, const FiniteElementSpace &hFESpace_)
    : Operator(hFESpace_.GetVSize(), lFESpace_.GetVSize()), hFESpace(hFESpace_),
      lFESpace(lFESpace_)
{
}

OrderTransferOperator::~OrderTransferOperator() {}

void OrderTransferOperator::Mult(const Vector &x, Vector &y) const
{
   Mesh *mesh = hFESpace.GetMesh();
   Array<int> l_dofs, h_dofs;
   DenseMatrix loc_prol;
   Vector subY, subX;

   Geometry::Type cached_geom = Geometry::INVALID;
   const FiniteElement *h_fe = NULL;
   const FiniteElement *l_fe = NULL;
   IsoparametricTransformation T;

   for (int i = 0; i < mesh->GetNE(); i++)
   {
      hFESpace.GetElementDofs(i, h_dofs);
      lFESpace.GetElementDofs(i, l_dofs);

      const Geometry::Type geom = mesh->GetElementBaseGeometry(i);
      if (geom != cached_geom)
      {
         h_fe = hFESpace.GetFE(i);
         l_fe = lFESpace.GetFE(i);<commit_msg>Reordered initialization of member variables<commit_after>// Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
// the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
// reserved. See file COPYRIGHT for details.
//
// This file is part of the MFEM library. For more information and source code
// availability see http://mfem.org.
//
// MFEM 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) version 2.1 dated February 1999.

#include "transfer.hpp"

namespace mfem
{

TransferOperator::TransferOperator(const FiniteElementSpace &lFESpace_,
                                   const FiniteElementSpace &hFESpace_)
    : Operator(hFESpace_.GetVSize(), lFESpace_.GetVSize())
{
   // If both spaces' FE collection pointers are pointing to the same collection
   // we assume that the grid was refined while keeping the order constant
   if (lFESpace_.FEColl() == hFESpace_.FEColl())
   {
      OperatorPtr P(Operator::ANY_TYPE);
      hFESpace_.GetTransferOperator(lFESpace_, P);
      P.SetOperatorOwner(false);
      opr = P.Ptr();
   }
   else
   {
      opr = new OrderTransferOperator(lFESpace_, hFESpace_);
   }
}

TransferOperator::~TransferOperator() { delete opr; }

void TransferOperator::Mult(const Vector &x, Vector &y) const
{
   opr->Mult(x, y);
}

void TransferOperator::MultTranspose(const Vector &x, Vector &y) const
{
   opr->MultTranspose(x, y);
}

OrderTransferOperator::OrderTransferOperator(
    const FiniteElementSpace &lFESpace_, const FiniteElementSpace &hFESpace_)
    : Operator(hFESpace_.GetVSize(), lFESpace_.GetVSize()), lFESpace(lFESpace_),
      hFESpace(hFESpace_)
{
}

OrderTransferOperator::~OrderTransferOperator() {}

void OrderTransferOperator::Mult(const Vector &x, Vector &y) const
{
   Mesh *mesh = hFESpace.GetMesh();
   Array<int> l_dofs, h_dofs;
   DenseMatrix loc_prol;
   Vector subY, subX;

   Geometry::Type cached_geom = Geometry::INVALID;
   const FiniteElement *h_fe = NULL;
   const FiniteElement *l_fe = NULL;
   IsoparametricTransformation T;

   for (int i = 0; i < mesh->GetNE(); i++)
   {
      hFESpace.GetElementDofs(i, h_dofs);
      lFESpace.GetElementDofs(i, l_dofs);

      const Geometry::Type geom = mesh->GetElementBaseGeometry(i);
      if (geom != cached_geom)
      {
         h_fe = hFESpace.GetFE(i);
         l_fe = lFESpace.GetFE(i);
{'fraction_non_alphanumeric': 0.10728125637364878, 'fraction_numerical': 0.006934529879665511, 'mean_word_length': 3.7199230028873917, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1253607', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1557, 'n_words': 427}