text:
if(window.location.pathname.match(/\/\/+/g)){
  console.log(window);
  var toReplace = "/"
  var toBeReplaced = window.location.pathname.match(/\/\/+/g)
  var correctPathname = window.location.pathname.replace(toBeReplaced, toReplace);
  console.log(window.href);
  window.location.href = window.location.origin + correctPathname;
}

$(document).ready(function() {
  autofillWorkaround();

  var lang = "en";

  // fill fields from URL and remember language
  (new URL(window.location.href)).searchParams.forEach((x, y) => {
    if (y == "lang") {
      lang = x;
    }
    var field = document.getElementById(y);
    if (field) {
      document.getElementById(y).value = x;
    }
  });

  // // set URL to reach UI
  // if ($('#uiUrl')) {
  // var url = window.location;
  // var paths = url.pathname.split('/');
  // var guiUrl = url .protocol + "//" + url.host + "/";
  // paths.slice(0,paths.length -1).forEach((x) => guiUrl += x + "/");
  // $('#uiUrl').val(guiUrl);
  // }

  var preisindikationInCent = 0;

  // $('#birthdate').on('change', function() {
  // console.log($('#birthdate').val());
  // });

  // Removed Auth
  // beforeSend = function(xhr) {
  // xhr.setRequestHeader('Authorization', 'Basic ' +
  // window.btoa(unescape(encodeURIComponent('${camunda.rest.username}' + ':'
  // + '${camunda.rest.password}'))))
  // };

  var pathArray = window.location.pathname.split('/');
  var baseUrl = window.location.protocol + "//" + window.location.host + "/" + pathArray[1] + "/API";

  $.i18n().load({
    'en': window.langEn['en'],
    'de': window.langDe['de']
  })

  $.i18n({
    locale: lang
  });

  $('body').i18n();

  $('#search').attr("placeholder", lang == 'de' ? 'Suchen...' : 'Search...');

  $('.langlink').each(function(i, obj) {
    $(this).click(function(event) {
      event.preventDefault();
      window.location.href = $(this).context.href + '?lang=' + lang;
    });
  });

  // Start single Process Instance
  $('#triggerStartApplication').click(function() {
    var neuantrag = {
      "applicant": {
        "name": $('#applicant').val(),
        "gender": $('#selectSex').val(),
        "birthday": $('#birthdate').val() + "T00:00:00",
        "email": $('#email').val(),
        "score": $('#scorehint').val()
      },
      "employment": $('#employment').val(),
      "category": $('#category').val(),
      "priceIndicationInCent": getPrice() * 100,
      "product": $("#category option:selected").text(),
      "corporation": "Camundanzia"
      // ,
      // "uiUrl": $('#uiUrl').val()
    };

    var data = JSON.stringify(neuantrag);

    console.log(data);

    $.ajax({
      type: 'POST',
      url: baseUrl + "/new-application/" + lang,
      data: data,
      contentType: 'application/json; charset=utf-8',
      success: function(result) {
        $('#applicationId').text(result);
        $('#applicationReceived').toggle();
        $('#fieldsetForm').toggle();
      },
      crossDomain: true,
    });

  });

  // correlate message for Antrag
  $('#triggerUploadDocuments').click(function() {
    debugger;
    var fileUpload = $('#documentToUpload').get(0);

    var fileVar = {};
    if (typeof FileReader === 'function' && fileUpload.files.length > 0) {
      var reader = new FileReader();
      reader.onloadend = (function(fileUpload) {
        return function(e) {
          var binary = '';
          var bytes = new Uint8Array(e.target.result);
          var len = bytes.byteLength;
          for (var j = 0; j < len; j++) {
            binary += String.fromCharCode(bytes[j]);
          }
          fileVar.value = btoa(binary);

          // set file metadata as value info
          fileVar.type = 'File';
          fileVar.valueInfo = {
            filename: fileUpload.files[0].name,
            mimeType: fileUpload.files[0].type
          };

          callCallback();
        };
      })(fileUpload);
      reader.readAsArrayBuffer(fileUpload.files[0]);
    };

    var callCallback = function() {
      var data = JSON.stringify(fileVar);
      var url = baseUrl + "/document/" + $('#referenceId').val();
      $.ajax({
        type: 'POST',
        url: url,
        data: data,
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function(result) {
          $('#documentsReceived').toggle();
          $('#fieldsetForm').toggle();
        },
        crossDomain: true,
      });
    };

  });

  $('#category').on('change, keyup, mouseup', function() {
    calculatePrice(preisindikationInCent);
  });

  $('#employment').on('change, keyup, mouseup', function() {
    calculatePrice(preisindikationInCent);
  });

  function isEqualToOneOf(objectToBeChecked) {
    for (var i = 1; i < arguments.length; i++) {
      if (arguments[i] == objectToBeChecked) {
        return true;
      }
    }
    return false;
  }

  function calculatePrice(preisindikationInCent) {

    var category = $('#category').val();
    var employment = $('#employment').val();

    if (isEqualToOneOf(category, 'Basispaket', 'Basic Package')) {
      preisindikationInCent = 120;
    } else if (isEqualToOneOf(category, 'Standard Paket', 'Standard Package')) {
      preisindikationInCent = 200;
    } else {
      preisindikationInCent = 340;
    }

    preisindikationInCent = Math.round(preisindikationInCent);
    $('#priceIndicationInCent').val(preisindikationInCent + ",00 EUR");
  }

  function getPrice() {
    var preisindikationInCent;

    var category = $('#category').val();
    var employment = $('#employment').val();

    if (isEqualToOneOf(category, 'Basispaket', 'Basic Package')) {
      preisindikationInCent = 120;
    } else if (isEqualToOneOf(category, 'Standard Paket', 'Standard Package')) {
      preisindikationInCent = 200;
    } else {
      preisindikationInCent = 340;
    }

    return preisindikationInCent;
  }
});

function autofillWorkaround() {
  /**
   * Autofill event polyfill ##version:1.0.0##
   * (c) 2014 Google, Inc.
   * License: MIT
   */
  (function(window) {
    var $ = window.jQuery || window.angular.element;
    var rootElement = window.document.documentElement,
      $rootElement = $(rootElement);

    addGlobalEventListener('change', markValue);
    addValueChangeByJsListener(markValue);

    $.prototype.checkAndTriggerAutoFillEvent = jqCheckAndTriggerAutoFillEvent;

    // Need to use blur and not change event
    // as Chrome does not fire change events in all cases an input is changed
    // (e.g. when starting to type and then finish the input by auto filling a username)
    addGlobalEventListener('blur', function(target) {
      // setTimeout needed for Chrome as it fills other
      // form fields a little later...
      window.setTimeout(function() {
        findParentForm(target).find('input').checkAndTriggerAutoFillEvent();
      }, 20);
    });

    window.document.addEventListener('DOMContentLoaded', function() {
      // The timeout is needed for Chrome as it auto fills
      // login forms some time after DOMContentLoaded!
      window.setTimeout(function() {
        $rootElement.find('input').checkAndTriggerAutoFillEvent();
      }, 200);
    }, false);

    return;

    // ----------

    function jqCheckAndTriggerAutoFillEvent() {
      var i, el;
      for (i = 0; i < this.length; i++) {
        el = this[i];
        if (!valueMarked(el)) {
          markValue(el);
          triggerChangeEvent(el);
        }
      }
    }

    function valueMarked(el) {
      var val = el.value,
        $$currentValue = el.$$currentValue;
      if (!val && !$$currentValue) {
        return true;
      }
      return val === $$currentValue;
    }

    function markValue(el) {
      el.$$currentValue = el.value;
    }

    function addValueChangeByJsListener(listener) {
      var jq = window.jQuery || window.angular.element,
        jqProto = jq.prototype;
      var _val = jqProto.val;
      jqProto.val = function(newValue) {
        var res = _val.apply(this, arguments);
        if (arguments.length > 0) {
          forEach(this, function(el) {
            listener(el, newValue);
          });
        }
        return res;
      }
    }

    function addGlobalEventListener(eventName, listener) {
      // Use a capturing event listener so that
      // we also get the event when it's stopped!
      // Also, the blur event does not bubble.
      rootElement.addEventListener(eventName, onEvent, true);

      function onEvent(event) {
        var target = event.target;
        listener(target);
      }
    }

    function findParentForm(el) {
      while (el) {
        if (el.nodeName === 'FORM') {
          return $(el);
        }
        el = el.parentNode;
      }
      return $();
    }

    function forEach(arr, listener) {
      if (arr.forEach) {
        return arr.forEach(listener);
      }
      var i;
      for (i = 0; i < arr.length; i++) {
        listener(arr[i]);
      }
    }

    function triggerChangeEvent(element) {
      var doc = window.document;
      var event = doc.createEvent("HTMLEvents");
      event.initEvent("change", true, true);
      element.dispatchEvent(event);
    }

  })(window);
}


text:
<?xml version="1.0" encoding="utf-8"?>
<com.hudson.donglingmusic.ui.view.SlideRelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/sll_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/default_bg">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:orientation="horizontal">
            <ImageView
                android:id="@+id/iv_play_page_back"
                android:layout_width="20dp"
                android:layout_height="36dp"
                android:layout_margin="10dp"
                android:layout_marginLeft="18dp"
                android:src="@drawable/selector_play_page_back"/>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/tv_music_title"
                    android:layout_width="140dp"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:textColor="#F5EFEF"
                    android:textSize="16sp"/>

                <TextView
                    android:id="@+id/tv_music_info"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="2dp"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:maxWidth="150dp"
                    android:textColor="#E1DEDE"
                    android:textSize="13sp"/>
            </LinearLayout>

            <ImageView
                android:id="@+id/playpage_download"
                android:layout_width="32dp"
                android:padding="4dp"
                android:layout_margin="4dp"
                android:background="@drawable/selector_btn_blue_bg"
                android:src="@drawable/play_page_download"
                android:layout_height="32dp"/>

            <ImageView
                android:id="@+id/playpage_favorite"
                android:background="@drawable/selector_btn_blue_bg"
                android:layout_width="32dp"
                android:layout_height="32dp"
                android:layout_margin="4dp"
                android:padding="4dp"
                android:src="@drawable/play_page_favorite_empty"/>

            <ImageView
                android:id="@+id/equalizer"
                android:layout_width="32dp"
                android:layout_margin="4dp"
                android:layout_height="32dp"
                android:layout_toRightOf="@id/playpage_favorite"
                android:background="@drawable/selector_btn_blue_bg"
                android:padding="4dp"
                android:src="@drawable/play_page_equalizer"/>

        </LinearLayout>

        <com.hudson.donglingmusic.ui.view.PlayPageViewPager
            android:id="@+id/vp_play"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"/>

        <RelativeLayout
            android:id="@+id/bottom"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|bottom"
            android:layout_marginBottom="3dp"
            android:gravity="center">

            <!--splitTrack属性是在android 5.0以上会显示父布局的问题而设置的-->
            <SeekBar
                android:id="@+id/seekbar"
                android:layout_width="220dp"
                android:layout_height="wrap_content"
                android:maxHeight="10.0dp"
                android:minHeight="10.0dp"
                android:progressDrawable="@drawable/po_seekbar"
                android:splitTrack="false"
                android:thumb="@drawable/seekbar_thumb"/>

            <TextView
                android:id="@+id/time_left"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@id/seekbar"
                android:layout_below="@id/seekbar"
                android:layout_marginLeft="10dp"
                android:text="00:00"
                android:textColor="#42aa0f"
                android:textSize="14sp"
                android:textStyle="bold"/>

            <TextView
                android:id="@+id/time_right"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignRight="@id/seekbar"
                android:layout_below="@id/seekbar"
                android:layout_marginRight="12dp"
                android:text="00:00"
                android:textColor="#42aa0f"
                android:textSize="14sp"
                android:textStyle="bold"/>

        </RelativeLayout>
    </LinearLayout>

    <include layout="@layout/arc_left_menu"/>

    <include layout="@layout/arc_right_menu"/>

</com.hudson.donglingmusic.ui.view.SlideRelativeLayout>

redpajama_set_name: RedPajamaGithub


text:
I'm starting to wonder if I can use an `Arg<>` for span-types now...probably not, I think I just need to emit the open generics on the delegate and the `Arg` type.

* DONE - For the `ArgEvaluationFor...` generation, add open generics if needed.
* DONE - Any time the `ArgEvaluationFor...` FQN is needed, add open generics if needed.
* DONE - For the `ArgForReadOnlySpanOf...` generation, add open generics on the type if needed.


text:
package com.xthena.party.web;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.xthena.core.hibernate.PropertyFilter;
import com.xthena.core.mapper.BeanMapper;
import com.xthena.core.page.Page;
import com.xthena.core.spring.MessageHelper;

import com.xthena.party.domain.PartyEntity;
import com.xthena.party.domain.PartyStruct;
import com.xthena.party.domain.PartyStructType;
import com.xthena.party.manager.PartyEntityManager;
import com.xthena.party.manager.PartyStructManager;
import com.xthena.party.manager.PartyStructTypeManager;

import org.springframework.stereotype.Controller;

import org.springframework.ui.Model;

import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

@Controller
@RequestMapping("party")
public class PartyStructController {
    private PartyEntityManager partyEntityManager;
    private PartyStructManager partyStructManager;
    private PartyStructTypeManager partyStructTypeManager;
    private MessageHelper messageHelper;
    private BeanMapper beanMapper = new BeanMapper();

    @RequestMapping("party-struct-list")
    public String list(@ModelAttribute Page page,
            @RequestParam Map<String, Object> parameterMap, Model model) {
        List<PropertyFilter> propertyFilters = PropertyFilter
                .buildFromMap(parameterMap);
        page = partyStructManager.pagedQuery(page, propertyFilters);

        List<PartyStructType> partyStructTypes = partyStructTypeManager
                .getAll();
        model.addAttribute("page", page);
        model.addAttribute("partyStructTypes", partyStructTypes);

        return "party/party-struct-list";
    }

    @RequestMapping("party-struct-input")
    public String input(@RequestParam(value = "id", required = false) Long id,
            Model model) {
        List<PartyStructType> partyStructTypes = partyStructTypeManager
                .getAll();
        List<PartyEntity> partyEntities = partyEntityManager.getAll();
        model.addAttribute("partyStructTypes", partyStructTypes);
        model.addAttribute("partyEntities", partyEntities);

        if (id != null) {
            PartyStruct partyStruct = partyStructManager.get(id);
            model.addAttribute("model", partyStruct);
        }

        return "party/party-struct-input";
    }

    @RequestMapping("party-struct-save")
    public String save(@ModelAttribute PartyStruct partyStruct,
            @RequestParam("partyStructTypeId") Long partyStructTypeId,
            @RequestParam("parentEntityId") Long parentEntityId,
            @RequestParam("childEntityId") Long childEntityId,
            RedirectAttributes redirectAttributes) {
        PartyStruct dest = null;
        Long id = partyStruct.getId();

        if (id != null) {
            dest = partyStructManager.get(id);
            beanMapper.copy(partyStruct, dest);
        } else {
            dest = partyStruct;
        }

        dest.setPartyStructType(partyStructTypeManager.get(partyStructTypeId));
        dest.setParentEntity(partyEntityManager.get(parentEntityId));
        dest.setChildEntity(partyEntityManager.get(childEntityId));
        partyStructManager.save(dest);
        messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
                "保存成功");

        return "redirect:/party/party-struct-list.do";
    }

    @RequestMapping("party-struct-remove")
    public String remove(@RequestParam("selectedItem") List<Long> selectedItem,
            RedirectAttributes redirectAttributes) {
        partyStructManager
                .removeAll(partyStructManager.findByIds(selectedItem));
        messageHelper.addFlashMessage(redirectAttributes,
                "core.success.delete", "删除成功");

        return "redirect:/party/party-struct-list.do";
    }

    // ~ ======================================================================
    @Resource
    public void setPartyEntityManager(PartyEntityManager partyEntityManager) {
        this.partyEntityManager = partyEntityManager;
    }

    @Resource
    public void setPartyStructManager(PartyStructManager partyStructManager) {
        this.partyStructManager = partyStructManager;
    }

    @Resource
    public void setPartyStructTypeManager(
            PartyStructTypeManager partyStructTypeManager) {
        this.partyStructTypeManager = partyStructTypeManager;
    }

    @Resource
    public void setMessageHelper(MessageHelper messageHelper) {
        this.messageHelper = messageHelper;
    }
}


text:
module Fastlane
  module Actions
    module SharedValues
      CARTHAGE_FRAMEWORK = :CARTHAGE_FRAMEWORK
    end

    class BuildCarthageFrameworkAction < Action
      def self.run(params)
        Actions.sh("carthage build --no-skip-current")
        Actions.sh("carthage archive #{params[:framework_name]}")

        path = "#{params[:framework_name]}.framework.zip"

        Actions.lane_context[SharedValues::CARTHAGE_FRAMEWORK] = path

        Helper.log.info "Carthage generated #{params[:framework_name]}.framework"

        return path
      end

      #####################################################
      # @!group Documentation
      #####################################################

      def self.description
        "Build and archive a Framework project using Carthage"
      end

      def self.details
        # Optional:
        # this is your chance to provide a more detailed description of this action
        "You can use this action to do cool things..."
      end

      def self.available_options
          [
              FastlaneCore::ConfigItem.new(key: :framework_name,
                                           env_name: "CARTHAGE_FRAMEWORK_NAME", # The name of the environment variable
                                           description: "The name of the framework for Carthage to generate", # a short description of this parameter
                                           is_string:true)
          ]
      end

      def self.output
          [
              ['CARTHAGE_FRAMEWORK', 'The path to the generate Carthage framework']
          ]
      end

      def self.return_value
          "The path to the zipped framework"
      end

      def self.authors
        # So no one will ever forget your contribution to fastlane :) You are awesome btw!
        ["Your GitHub/Twitter Name"]
      end

      def self.is_supported?(platform)
          return true
      end
    end
  end
end


text:
// Copyright (c) 2002-2014, Boyce Griffith
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//    * Redistributions of source code must retain the above copyright notice,
//      this list of conditions and the following disclaimer.
//
//    * Redistributions in binary form must reproduce the above copyright
//      notice, this list of conditions and the following disclaimer in the
//      documentation and/or other materials provided with the distribution.
//
//    * Neither the name of The University of North Carolina nor the names of
//      its contributors may be used to endorse or promote products derived from
//      this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

// Config files
#include <IBAMR_config.h>
#include <IBTK_config.h>
#include <SAMRAI_config.h>

// Headers for basic PETSc functions
#include <petscsys.h>

// Headers for basic SAMRAI objects
#include <BergerRigoutsos.h>
#include <CartesianGridGeometry.h>
#include <LoadBalancer.h>
#include <StandardTagAndInitialize.h>

// Headers for basic libMesh objects
#include <libmesh/equation_systems.h>
#include <libmesh/exodusII_io.h>
#include <libmesh/mesh.h>
#include <libmesh/mesh_generation.h>
#include <libmesh/periodic_boundary.h>

// Headers for application-specific algorithm/data structure objects
#include <boost/multi_array.hpp>
#include <ibamr/IBExplicitHierarchyIntegrator.h>
#include <ibamr/IBFEMethod.h>
#include <ibamr/INSCollocatedHierarchyIntegrator.h>
#include <ibamr/INSStaggeredHierarchyIntegrator.h>
#include <ibamr/app_namespaces.h>
#include <ibtk/AppInitializer.h>
#include <ibtk/libmesh_utilities.h>
#include <ibtk/muParserCartGridFunction.h>
#include <ibtk/muParserRobinBcCoefs.h>

// Elasticity model data.
namespace ModelData
{
// Problem parameters.
static const double R = 0.25;
static const double w = 0.0625;
static const double gamma = 0.0;
static const double mu = 1.0;

// Coordinate mapping function.
void coordinate_mapping_function(libMesh::Point& X, const libMesh::Point& s, void* /*ctx*/)
{
    X(0) = (R + s(1)) * cos(s(0) / R) + 0.5;
    X(1) = (R + gamma + s(1)) * sin(s(0) / R) + 0.5;
    return;
} // coordinate_mapping_function

// Stress tensor function.
bool smooth_case = false;
void PK1_stress_function(TensorValue<double>& PP,
                         const TensorValue<double>& FF,
                         const libMesh::Point& /*X*/,
                         const libMesh::Point& /*s*/,
                         Elem* const /*elem*/,
                         const std::vector<NumericVector<double>*>& /*system_data*/,
                         double /*time*/,
                         void* /*ctx*/)
{
    PP = (mu / w) * FF;
    if (smooth_case)
    {
        PP(0, 1) = 0.0;
        PP(1, 1) = 0.0;
    }
    return;
} // PK1_stress_function
}
using namespace ModelData;

// Function prototypes
void output_data(Pointer<PatchHierarchy<NDIM> > patch_hierarchy,
                 Pointer<INSHierarchyIntegrator> navier_stokes_integrator,
                 Mesh& mesh,
                 EquationSystems* equation_systems,
                 const int iteration_num,
                 const double loop_time,
                 const string& data_dump_dirname);

/*******************************************************************************
 * For each run, the input filename and restart information (if needed) must   *
 * be given on the command line.  For non-restarted case, command line is:     *
 *                                                                             *
 *    executable <input file name>                                             *
 *                                                                             *
 * For restarted run, command line is:                                         *
 *                                                                             *
 *    executable <input file name> <restart directory> <restart number>        *
 *                                                                             *
 *******************************************************************************/
int main(int argc, char* argv[])
{
    // Initialize libMesh, PETSc, MPI, and SAMRAI.
    LibMeshInit init(argc, argv);
    SAMRAI_MPI::setCommunicator(PETSC_COMM_WORLD);
    SAMRAI_MPI::setCallAbortInSerialInsteadOfExit();
    SAMRAIManager::startup();

    { // cleanup dynamically allocated objects prior to shutdown

        // Parse command line options, set some standard options from the input
        // file, initialize the restart database (if this is a restarted run),
        // and enable file logging.
        Pointer<AppInitializer> app_initializer = new AppInitializer(argc, argv, "IB.log");
        Pointer<Database> input_db = app_initializer->getInputDatabase();

        // Get various standard options set in the input file.
        const bool dump_viz_data = app_initializer->dumpVizData();
        const int viz_dump_interval = app_initializer->getVizDumpInterval();
        const bool uses_visit = dump_viz_data && app_initializer->getVisItDataWriter();
        const bool uses_exodus = dump_viz_data && !app_initializer->getExodusIIFilename().empty();
        const string exodus_filename = app_initializer->getExodusIIFilename();

        const bool dump_restart_data = app_initializer->dumpRestartData();
        const int restart_dump_interval = app_initializer->getRestartDumpInterval();
        const string restart_dump_dirname = app_initializer->getRestartDumpDirectory();

        const bool dump_postproc_data = app_initializer->dumpPostProcessingData();
        const int postproc_data_dump_interval = app_initializer->getPostProcessingDataDumpInterval();
        const string postproc_data_dump_dirname = app_initializer->getPostProcessingDataDumpDirectory();
        if (dump_postproc_data && (postproc_data_dump_interval > 0) && !postproc_data_dump_dirname.empty())
        {
            Utilities::recursiveMkdir(postproc_data_dump_dirname);
        }

        const bool dump_timer_data = app_initializer->dumpTimerData();
        const int timer_dump_interval = app_initializer->getTimerDumpInterval();

        // Create a simple FE mesh with periodic boundary conditions in the "x"
        // direction.
        //
        // Note that boundary condition data must be registered with each FE
        // system before calling IBFEMethod::initializeFEData().
        Mesh mesh(NDIM);
        const double R = 0.25;
        const double w = 0.0625;
        const double dx0 = 1.0 / 64.0;
        const double dx = input_db->getDouble("DX");
        const double MFAC = input_db->getDouble("MFAC");
        const double ds = MFAC * dx;
        string elem_type = input_db->getString("ELEM_TYPE");
        bool nested_meshes = input_db->getBoolWithDefault("CONVERGENCE_STUDY", false);
        const int n_x = nested_meshes ? round(16.0 * round(2.0 * M_PI * R / dx0 / 16.0) / MFAC) * round(dx0 / dx) :
                                        ceil(2.0 * M_PI * R / ds);
        const int n_y = nested_meshes ? round(4.0 * round(w / dx0 / 4.0) / MFAC) * round(dx0 / dx) : ceil(w / ds);
        MeshTools::Generation::build_square(mesh, n_x, n_y, 0.0, 2.0 * M_PI * R, 0.0, w,
                                            Utility::string_to_enum<ElemType>(elem_type));
        VectorValue<double> boundary_translation(2.0 * M_PI * R, 0.0, 0.0);
        PeriodicBoundary pbc(boundary_translation);
        pbc.myboundary = 3;
        pbc.pairedboundary = 1;

        // Configure stress tensor options.
        smooth_case = input_db->getBool("SMOOTH_CASE");

        // Create major algorithm and data objects that comprise the
        // application.  These objects are configured from the input database
        // and, if this is a restarted run, from the restart database.
        Pointer<INSHierarchyIntegrator> navier_stokes_integrator;
        const string solver_type = app_initializer->getComponentDatabase("Main")->getString("solver_type");
        if (solver_type == "STAGGERED")
        {
            navier_stokes_integrator = new INSStaggeredHierarchyIntegrator(
                "INSStaggeredHierarchyIntegrator",
                app_initializer->getComponentDatabase("INSStaggeredHierarchyIntegrator"));
        }
        else if (solver_type == "COLLOCATED")
        {
            navier_stokes_integrator = new INSCollocatedHierarchyIntegrator(
                "INSCollocatedHierarchyIntegrator",
                app_initializer->getComponentDatabase("INSCollocatedHierarchyIntegrator"));
        }
        else
        {
            TBOX_ERROR("Unsupported solver type: " << solver_type << "\n"
                                                   << "Valid options are: COLLOCATED, STAGGERED");
        }
        Pointer<IBFEMethod> ib_method_ops =
            new IBFEMethod("IBFEMethod", app_initializer->getComponentDatabase("IBFEMethod"), &mesh,
                           app_initializer->getComponentDatabase("GriddingAlgorithm")->getInteger("max_levels"));
        Pointer<IBHierarchyIntegrator> time_integrator = new IBExplicitHierarchyIntegrator(
            "IBHierarchyIntegrator", app_initializer->getComponentDatabase("IBHierarchyIntegrator"), ib_method_ops,
            navier_stokes_integrator);
        Pointer<CartesianGridGeometry<NDIM> > grid_geometry = new CartesianGridGeometry<NDIM>(
            "CartesianGeometry", app_initializer->getComponentDatabase("CartesianGeometry"));
        Pointer<PatchHierarchy<NDIM> > patch_hierarchy = new PatchHierarchy<NDIM>("PatchHierarchy", grid_geometry);
        Pointer<StandardTagAndInitialize<NDIM> > error_detector =
            new StandardTagAndInitialize<NDIM>("StandardTagAndInitialize", time_integrator,
                                               app_initializer->getComponentDatabase("StandardTagAndInitialize"));
        Pointer<BergerRigoutsos<NDIM> > box_generator = new BergerRigoutsos<NDIM>();
        Pointer<LoadBalancer<NDIM> > load_balancer =
            new LoadBalancer<NDIM>("LoadBalancer", app_initializer->getComponentDatabase("LoadBalancer"));
        Pointer<GriddingAlgorithm<NDIM> > gridding_algorithm =
            new GriddingAlgorithm<NDIM>("GriddingAlgorithm", app_initializer->getComponentDatabase("GriddingAlgorithm"),
                                        error_detector, box_generator, load_balancer);

        // Configure the IBFE solver.
        FEDataManager* fe_data_manager = ib_method_ops->getFEDataManager();
        ib_method_ops->registerInitialCoordinateMappingFunction(coordinate_mapping_function);
        ib_method_ops->registerPK1StressFunction(PK1_stress_function);

        // Create Eulerian initial condition specification objects.  These
        // objects also are used to specify exact solution values for error
        // analysis.
        Pointer<CartGridFunction> u_init = new muParserCartGridFunction(
            "u_init", app_initializer->getComponentDatabase("VelocityInitialConditions"), grid_geometry);
        navier_stokes_integrator->registerVelocityInitialConditions(u_init);

        Pointer<CartGridFunction> p_init = new muParserCartGridFunction(
            "p_init", app_initializer->getComponentDatabase("PressureInitialConditions"), grid_geometry);
        navier_stokes_integrator->registerPressureInitialConditions(p_init);

        // Create Eulerian boundary condition specification objects (when necessary).
        const IntVector<NDIM>& periodic_shift = grid_geometry->getPeriodicShift();
        vector<RobinBcCoefStrategy<NDIM>*> u_bc_coefs(NDIM);
        if (periodic_shift.min() > 0)
        {
            for (unsigned int d = 0; d < NDIM; ++d)
            {
                u_bc_coefs[d] = NULL;
            }
        }
        else
        {
            for (unsigned int d = 0; d < NDIM; ++d)
            {
                ostringstream bc_coefs_name_stream;
                bc_coefs_name_stream << "u_bc_coefs_" << d;
                const string bc_coefs_name = bc_coefs_name_stream.str();

                ostringstream bc_coefs_db_name_stream;
                bc_coefs_db_name_stream << "VelocityBcCoefs_" << d;
                const string bc_coefs_db_name = bc_coefs_db_name_stream.str();

                u_bc_coefs[d] = new muParserRobinBcCoefs(
                    bc_coefs_name, app_initializer->getComponentDatabase(bc_coefs_db_name), grid_geometry);
            }
            navier_stokes_integrator->registerPhysicalBoundaryConditions(u_bc_coefs);
        }

        // Create Eulerian body force function specification objects.
        if (input_db->keyExists("ForcingFunction"))
        {
            Pointer<CartGridFunction> f_fcn = new muParserCartGridFunction(
                "f_fcn", app_initializer->getComponentDatabase("ForcingFunction"), grid_geometry);
            time_integrator->registerBodyForceFunction(f_fcn);
        }

        // Set up visualization plot file writers.
        Pointer<VisItDataWriter<NDIM> > visit_data_writer = app_initializer->getVisItDataWriter();
        if (uses_visit)
        {
            time_integrator->registerVisItDataWriter(visit_data_writer);
        }
        AutoPtr<ExodusII_IO> exodus_io(uses_exodus ? new ExodusII_IO(mesh) : NULL);

        // Initialize hierarchy configuration and data on all patches.
        EquationSystems* equation_systems = fe_data_manager->getEquationSystems();
        for (unsigned int k = 0; k < equation_systems->n_systems(); ++k)
        {
            System& system = equation_systems->get_system(k);
            system.get_dof_map().add_periodic_boundary(pbc);
        }
        ib_method_ops->initializeFEData();
        time_integrator->initializePatchHierarchy(patch_hierarchy, gridding_algorithm);

        // Deallocate initialization objects.
        app_initializer.setNull();

        // Print the input database contents to the log file.
        plog << "Input database:\n";
        input_db->printClassData(plog);

        // Setup data used to determine the accuracy of the computed solution.
        VariableDatabase<NDIM>* var_db = VariableDatabase<NDIM>::getDatabase();

        const Pointer<hier::Variable<NDIM> > u_var = navier_stokes_integrator->getVelocityVariable();
        const Pointer<VariableContext> u_ctx = navier_stokes_integrator->getCurrentContext();

        const int u_idx = var_db->mapVariableAndContextToIndex(u_var, u_ctx);
        const int u_cloned_idx = var_db->registerClonedPatchDataIndex(u_var, u_idx);

        const Pointer<hier::Variable<NDIM> > p_var = navier_stokes_integrator->getPressureVariable();
        const Pointer<VariableContext> p_ctx = navier_stokes_integrator->getCurrentContext();

        const int p_idx = var_db->mapVariableAndContextToIndex(p_var, p_ctx);
        const int p_cloned_idx = var_db->registerClonedPatchDataIndex(p_var, p_idx);
        visit_data_writer->registerPlotQuantity("P error", "SCALAR", p_cloned_idx);

        const int coarsest_ln = 0;
        const int finest_ln = patch_hierarchy->getFinestLevelNumber();
        for (int ln = coarsest_ln; ln <= finest_ln; ++ln)
        {
            patch_hierarchy->getPatchLevel(ln)->allocatePatchData(u_cloned_idx);
            patch_hierarchy->getPatchLevel(ln)->allocatePatchData(p_cloned_idx);
        }

        // Write out initial visualization data.
        int iteration_num = time_integrator->getIntegratorStep();
        double loop_time = time_integrator->getIntegratorTime();
        if (dump_viz_data)
        {
            pout << "\n\nWriting visualization files...\n\n";
            if (uses_visit)
            {
                time_integrator->setupPlotData();
                visit_data_writer->writePlotData(patch_hierarchy, iteration_num, loop_time);
            }
            if (uses_exodus)
            {
                exodus_io->write_timestep(exodus_filename, *equation_systems, iteration_num / viz_dump_interval + 1,
                                          loop_time);
            }
        }

        // Open streams to save volume of structure.
        ofstream volume_stream;
        if (SAMRAI_MPI::getRank() == 0)
        {
            volume_stream.open("volume.curve", ios_base::out | ios_base::trunc);
        }

        // Main time step loop.
        double loop_time_end = time_integrator->getEndTime();
        double dt = 0.0;
        while (!MathUtilities<double>::equalEps(loop_time, loop_time_end) && time_integrator->stepsRemaining())
        {
            iteration_num = time_integrator->getIntegratorStep();
            loop_time = time_integrator->getIntegratorTime();

            pout << "\n";
            pout << "+++++++++++++++++++++++++++++++++++++++++++++++++++\n";
            pout << "At beginning of timestep # " << iteration_num << "\n";
            pout << "Simulation time is " << loop_time << "\n";

            dt = time_integrator->getMaximumTimeStepSize();
            time_integrator->advanceHierarchy(dt);
            loop_time += dt;

            pout << "\n";
            pout << "At end       of timestep # " << iteration_num << "\n";
            pout << "Simulation time is " << loop_time << "\n";
            pout << "+++++++++++++++++++++++++++++++++++++++++++++++++++\n";
            pout << "\n";

            // At specified intervals, write visualization and restart files,
            // print out timer data, and store hierarchy data for post
            // processing.
            iteration_num += 1;
            const bool last_step = !time_integrator->stepsRemaining();
            if (dump_viz_data && (iteration_num % viz_dump_interval == 0 || last_step))
            {
                pout << "\nWriting visualization files...\n\n";
                if (uses_visit)
                {
                    time_integrator->setupPlotData();
                    visit_data_writer->writePlotData(patch_hierarchy, iteration_num, loop_time);
                }
                if (uses_exodus)
                {
                    exodus_io->write_timestep(exodus_filename, *equation_systems, iteration_num / viz_dump_interval + 1,
                                              loop_time);
                }
            }
            if (dump_restart_data && (iteration_num % restart_dump_interval == 0 || last_step))
            {
                pout << "\nWriting restart files...\n\n";
                RestartManager::getManager()->writeRestartFile(restart_dump_dirname, iteration_num);
            }
            if (dump_timer_data && (iteration_num % timer_dump_interval == 0 || last_step))
            {
                pout << "\nWriting timer data...\n\n";
                TimerManager::getManager()->print(plog);
            }
            if (dump_postproc_data && (iteration_num % postproc_data_dump_interval == 0 || last_step))
            {
                pout << "\nWriting state data...\n\n";
                output_data(patch_hierarchy, navier_stokes_integrator, mesh, equation_systems, iteration_num, loop_time,
                            postproc_data_dump_dirname);
            }

            // Compute velocity and pressure error norms.
            const int coarsest_ln = 0;
            const int finest_ln = patch_hierarchy->getFinestLevelNumber();
            for (int ln = coarsest_ln; ln <= finest_ln; ++ln)
            {
                Pointer<PatchLevel<NDIM> > level = patch_hierarchy->getPatchLevel(ln);
                if (!level->checkAllocated(u_cloned_idx)) level->allocatePatchData(u_cloned_idx);
                if (!level->checkAllocated(p_cloned_idx)) level->allocatePatchData(p_cloned_idx);
            }

            pout << "\n"
                 << "+++++++++++++++++++++++++++++++++++++++++++++++++++\n"
                 << "Computing error norms.\n\n";

            u_init->setDataOnPatchHierarchy(u_cloned_idx, u_var, patch_hierarchy, loop_time);
            p_init->setDataOnPatchHierarchy(p_cloned_idx, p_var, patch_hierarchy, loop_time - 0.5 * dt);

            HierarchyMathOps hier_math_ops("HierarchyMathOps", patch_hierarchy);
            hier_math_ops.setPatchHierarchy(patch_hierarchy);
            hier_math_ops.resetLevels(coarsest_ln, finest_ln);
            const double volume = hier_math_ops.getVolumeOfPhysicalDomain();
            const int wgt_cc_idx = hier_math_ops.getCellWeightPatchDescriptorIndex();
            const int wgt_sc_idx = hier_math_ops.getSideWeightPatchDescriptorIndex();

            Pointer<CellVariable<NDIM, double> > u_cc_var = u_var;
            if (u_cc_var)
            {
                HierarchyCellDataOpsReal<NDIM, double> hier_cc_data_ops(patch_hierarchy, coarsest_ln, finest_ln);
                hier_cc_data_ops.subtract(u_cloned_idx, u_idx, u_cloned_idx);
                pout << "Error in u at time " << loop_time << ":\n"
                     << "  L1-norm:  " << hier_cc_data_ops.L1Norm(u_cloned_idx, wgt_cc_idx) << "\n"
                     << "  L2-norm:  " << hier_cc_data_ops.L2Norm(u_cloned_idx, wgt_cc_idx) << "\n"
                     << "  max-norm: " << hier_cc_data_ops.maxNorm(u_cloned_idx, wgt_cc_idx) << "\n";
            }

            Pointer<SideVariable<NDIM, double> > u_sc_var = u_var;
            if (u_sc_var)
            {
                HierarchySideDataOpsReal<NDIM, double> hier_sc_data_ops(patch_hierarchy, coarsest_ln, finest_ln);
                hier_sc_data_ops.subtract(u_cloned_idx, u_idx, u_cloned_idx);
                pout << "Error in u at time " << loop_time << ":\n"
                     << "  L1-norm:  " << hier_sc_data_ops.L1Norm(u_cloned_idx, wgt_sc_idx) << "\n"
                     << "  L2-norm:  " << hier_sc_data_ops.L2Norm(u_cloned_idx, wgt_sc_idx) << "\n"
                     << "  max-norm: " << hier_sc_data_ops.maxNorm(u_cloned_idx, wgt_sc_idx) << "\n";
            }

            HierarchyCellDataOpsReal<NDIM, double> hier_cc_data_ops(patch_hierarchy, coarsest_ln, finest_ln);
            const double p_mean = (1.0 / volume) * hier_cc_data_ops.integral(p_idx, wgt_cc_idx);
            hier_cc_data_ops.addScalar(p_idx, p_idx, -p_mean);
            const double p_cloned_mean = (1.0 / volume) * hier_cc_data_ops.integral(p_cloned_idx, wgt_cc_idx);
            hier_cc_data_ops.addScalar(p_cloned_idx, p_cloned_idx, -p_cloned_mean);
            hier_cc_data_ops.subtract(p_cloned_idx, p_idx, p_cloned_idx);
            pout << "Error in p at time " << loop_time - 0.5 * dt << ":\n"
                 << "  L1-norm:  " << hier_cc_data_ops.L1Norm(p_cloned_idx, wgt_cc_idx) << "\n"
                 << "  L2-norm:  " << hier_cc_data_ops.L2Norm(p_cloned_idx, wgt_cc_idx) << "\n"
                 << "  max-norm: " << hier_cc_data_ops.maxNorm(p_cloned_idx, wgt_cc_idx) << "\n"
                 << "+++++++++++++++++++++++++++++++++++++++++++++++++++\n";

            // Compute the volume of the structure.
            double J_integral = 0.0;
            System& X_system = equation_systems->get_system<System>(IBFEMethod::COORDS_SYSTEM_NAME);
            NumericVector<double>* X_vec = X_system.solution.get();
            NumericVector<double>* X_ghost_vec = X_system.current_local_solution.get();
            X_vec->localize(*X_ghost_vec);
            DofMap& X_dof_map = X_system.get_dof_map();
            std::vector<std::vector<unsigned int> > X_dof_indices(NDIM);
            AutoPtr<FEBase> fe(FEBase::build(NDIM, X_dof_map.variable_type(0)));
            AutoPtr<QBase> qrule = QBase::build(QGAUSS, NDIM, FIFTH);
            fe->attach_quadrature_rule(qrule.get());
            const std::vector<double>& JxW = fe->get_JxW();
            const std::vector<std::vector<VectorValue<double> > >& dphi = fe->get_dphi();
            TensorValue<double> FF;
            boost::multi_array<double, 2> X_node;
            const MeshBase::const_element_iterator el_begin = mesh.active_local_elements_begin();
            const MeshBase::const_element_iterator el_end = mesh.active_local_elements_end();
            for (MeshBase::const_element_iterator el_it = el_begin; el_it != el_end; ++el_it)
            {
                Elem* const elem = *el_it;
                fe->reinit(elem);
                for (unsigned int d = 0; d < NDIM; ++d)
                {
                    X_dof_map.dof_indices(elem, X_dof_indices[d], d);
                }
                const int n_qp = qrule->n_points();
                get_values_for_interpolation(X_node, *X_ghost_vec, X_dof_indices);
                for (int qp = 0; qp < n_qp; ++qp)
                {
                    jacobian(FF, qp, X_node, dphi);
                    J_integral += abs(FF.det()) * JxW[qp];
                }
            }
            J_integral = SAMRAI_MPI::sumReduction(J_integral);
            if (SAMRAI_MPI::getRank() == 0)
            {
                volume_stream.precision(12);
                volume_stream.setf(ios::fixed, ios::floatfield);
                volume_stream << loop_time << " " << J_integral << endl;
            }
        }

        // Close the logging streams.
        if (SAMRAI_MPI::getRank() == 0)
        {
            volume_stream.close();
        }

        // Cleanup Eulerian boundary condition specification objects (when
        // necessary).
        for (unsigned int d = 0; d < NDIM; ++d) delete u_bc_coefs[d];

    } // cleanup dynamically allocated objects prior to shutdown

    SAMRAIManager::shutdown();
    return 0;
} // main

void output_data(Pointer<PatchHierarchy<NDIM> > patch_hierarchy,
                 Pointer<INSHierarchyIntegrator> navier_stokes_integrator,
                 Mesh& mesh,
                 EquationSystems* equation_systems,
                 const int iteration_num,
                 const double loop_time,
                 const string& data_dump_dirname)
{
    plog << "writing hierarchy data at iteration " << iteration_num << " to disk" << endl;
    plog << "simulation time is " << loop_time << endl;

    // Write Cartesian data.
    string file_name = data_dump_dirname + "/" + "hier_data.";
    char temp_buf[128];
    sprintf(temp_buf, "%05d.samrai.%05d", iteration_num, SAMRAI_MPI::getRank());
    file_name += temp_buf;
    Pointer<HDFDatabase> hier_db = new HDFDatabase("hier_db");
    hier_db->create(file_name);
    VariableDatabase<NDIM>* var_db = VariableDatabase<NDIM>::getDatabase();
    ComponentSelector hier_data;
    hier_data.setFlag(var_db->mapVariableAndContextToIndex(navier_stokes_integrator->getVelocityVariable(),
                                                           navier_stokes_integrator->getCurrentContext()));
    hier_data.setFlag(var_db->mapVariableAndContextToIndex(navier_stokes_integrator->getPressureVariable(),
                                                           navier_stokes_integrator->getCurrentContext()));
    patch_hierarchy->putToDatabase(hier_db->putDatabase("PatchHierarchy"), hier_data);
    hier_db->putDouble("loop_time", loop_time);
    hier_db->putInteger("iteration_num", iteration_num);
    hier_db->close();

    // Write Lagrangian data.
    file_name = data_dump_dirname + "/" + "fe_mesh.";
    sprintf(temp_buf, "%05d", iteration_num);
    file_name += temp_buf;
    file_name += ".xda";
    mesh.write(file_name);
    file_name = data_dump_dirname + "/" + "fe_equation_systems.";
    sprintf(temp_buf, "%05d", iteration_num);
    file_name += temp_buf;
    equation_systems->write(file_name, (EquationSystems::WRITE_DATA | EquationSystems::WRITE_ADDITIONAL_DATA));
    return;
} // output_data


text:
Bytes from the small pool currently available.

```csharp
public long SmallPoolFreeBytes { get; }
```

## See Also

* class [UsageReportEventArgs](../RecyclableMemoryStreamManager.UsageReportEventArgs.md)
* namespace [Microsoft.IO](../../Microsoft.IO.RecyclableMemoryStream.md)

<!-- DO NOT EDIT: generated by xmldocmd for Microsoft.IO.RecyclableMemoryStream.dll -->


text:
from proteus.default_n import *
from proteus import (Context,
                     LinearAlgebraTools,
                     LinearSolvers,
                     NonlinearSolvers,
                     StepControl,
                     TimeIntegration
                     )
import ls_consrv_p as physics
ct = Context.get()
domain = ct.domain
nd = ct.domain.nd
mesh = domain.MeshOptions

#time stepping
runCFL = ct.runCFL
timeIntegrator  = TimeIntegration.ForwardIntegrator
timeIntegration = TimeIntegration.NoIntegration

#mesh options
nLevels = ct.nLevels
parallelPartitioningType = mesh.parallelPartitioningType
nLayersOfOverlapForParallel = mesh.nLayersOfOverlapForParallel
restrictFineSolutionToAllMeshes = mesh.restrictFineSolutionToAllMeshes
triangleOptions = mesh.triangleOptions

elementQuadrature = ct.elementQuadrature
elementBoundaryQuadrature = ct.elementBoundaryQuadrature
femSpaces = {0:ct.basis}

subgridError      = None
massLumping       = False
numericalFluxType = DoNothing
conservativeFlux  = None
shockCapturing    = None

fullNewtonFlag = True
multilevelNonlinearSolver = Newton
levelNonlinearSolver      = Newton

nonlinearSmoother = None
linearSmoother    = None

matrix = LinearAlgebraTools.SparseMatrix

if ct.useOldPETSc:
    multilevelLinearSolver = PETSc
    levelLinearSolver      = PETSc
else:
    multilevelLinearSolver = KSP_petsc4py
    levelLinearSolver      = KSP_petsc4py

if ct.useSuperlu:
    multilevelLinearSolver = LU
    levelLinearSolver      = LU

linear_solver_options_prefix = 'mcorr_'
nonlinearSolverConvergenceTest = 'r'
linearSolverConvergenceTest  = 'r-true'
levelNonlinearSolverConvergenceTest  = 'r'

tolFac = 0.0
nl_atol_res = ct.mcorr_nl_atol_res

linTolFac = 0.0
l_atol_res = 0.001*ct.mcorr_nl_atol_res
useEisenstatWalker = False

maxNonlinearIts = 50
maxLineSearches = 0

auxiliaryVariables = ct.domain.auxiliaryVariables['ls_consrv']


text:
module ::ArJdbc
  extension :Relativity do |name|
    if name =~ /relativity/i
      require 'arjdbc/relativity'
      true
    end
  end
end


text:
<!DOCTYPE html>

		<title>Projects | Timothy J. Aveni</title>
		<meta name="description" content="Projects | Timothy J. Aveni.">

			Timothy J. Aveni

						home

						projects

						research

						fluff

						words

						resume

Language Transfer app

A dedicated app built in React Native to serve Language Transfer courses, replacing less effective content sources like SoundCloud and YouTube. View on Google Play

Bolt

A grading assistant tool built to streamline and simplify homework grading for teaching assistants for Georgia Tech's data structures and algorithms class (CS 1332).

PluckLock (retired)

An Android app with 250+ installs across the Google Play Store and F-Droid. When your phone is plucked from your hands, the lock screen is activated so the thief can't see your messages.

Wavelyric

A web-based tool for quickly mapping song lyrics to a karaoke track. Developed for the open-source stenography community.

Cookie Externalities

A realtime web game and learning experience for microeconomics.

Quarantine Camel Up

An online 3D implementation of Camel Up (a board game) using CSS and JavaScript.

Skyward.link

A cloud tool for controlling Google Slides presentations with a cell phone without any prior setup on the phone or presentation computer.

Ploverboard

A keyboard built by hand for use with the open-source stenography project Plover.

Linerunner

A JavaScript application that uses your microphone and speakers to run lines with you for practice for theatrical performances.

Saviors of Gundthor

A networked Java game created in a group of four in a month for an AP Computer Science course.

OSCAR Menu

A Chrome extension for showing Georgia Tech classes in OSCAR from any website.

Watergrid

An interactive real-world game designed for a high school STEM club demonstration.

ynab-clipper

A script to sync Clipper card transactions into YNAB.

QuickCart

A hackathon project to track the content of customers' carts and their path through physical stores. Won Best Data Visualization and Best Improvement to the Shopping Experience at HackGT 2016.

OLL Trainer

A React application to help learn OLL algorithms for speedcubing. ~300 monthly users.

				SyntaxBlitz on GitHub


text:
Test =
Test9 = (function () {

    var release = 9;

    var NO = 0,
        YES = 1,
        OLD = 2,
        BUGGY = 4,
        PREFIX = 8,
        BLOCKED = 16,
        DISABLED = 32,
        UNCONFIRMED = 64,
        UNKNOWN = 128,
        EXPERIMENTAL = 256;

    var blacklists = [];

    var testsuite = [

        /* doctype */

        function (results) {
            results.addItem({
                key: 'parsing.doctype',
                passed: document.compatMode == 'CSS1Compat'
            });
        },

        /* tokenizer */

        function (results) {
            var result = true;
            var e = document.createElement('div');

            try {
                e.innerHTML = "<div
";
                result &= e.firstChild && e.firstChild.nodeName == "DIV<DIV";

                e.innerHTML = "<div foo<bar=''>";
                result &= e.firstChild.attributes[0].nodeName == "foo<bar" || e.firstChild.attributes[0].name == "foo<bar";

                e.innerHTML = "<div foo=`bar`>";
                result &= e.firstChild.getAttribute("foo") == "`bar`";

                e.innerHTML = "
";
                result &= e.firstChild && (e.firstChild.attributes[0].nodeName == "\"foo" || e.firstChild.attributes[0].name == "\"foo");

                e.innerHTML = "";
                result &= e.firstChild && e.firstChild.getAttribute("href") == "\nbar";

                e.innerHTML = "<!DOCTYPE html>";
                result &= e.firstChild == null;

                e.innerHTML = "\u000D";
                result &= e.firstChild && e.firstChild.nodeValue == "\u000A";

                e.innerHTML = "⟨⟩";
                result &= e.firstChild.nodeValue == "\u27E8\u27E9";

                e.innerHTML = "'";
                result &= e.firstChild.nodeValue == "'";

                e.innerHTML = "ⅈ";
                result &= e.firstChild.nodeValue == "\u2148";

                e.innerHTML = "𝕂";
                result &= e.firstChild.nodeValue == "\uD835\uDD42";

                e.innerHTML = "∉";
                result &= e.firstChild.nodeValue == "\u2209";

                e.innerHTML = '<?import namespace="foo" implementation="#bar">';
                result &= e.firstChild && e.firstChild.nodeType == 8 && e.firstChild.nodeValue == '?import namespace="foo" implementation="#bar"';

                e.innerHTML = '';
                result &= e.firstChild && e.firstChild.nodeType == 8 && e.firstChild.nodeValue == 'foo--bar';

                e.innerHTML = '<![CDATA[x]]>';
                result &= e.firstChild && e.firstChild.nodeType == 8 && e.firstChild.nodeValue == '[CDATA[x]]';

                e.innerHTML = "<textarea></textarea>";
                result &= e.firstChild && e.firstChild.firstChild && e.firstChild.firstChild.nodeValue == "";
                result &= e.firstChild && e.firstChild.firstChild && e.firstChild.firstChild.nodeValue == "</style>";
                result &= e.firstChild && e.firstChild.firstChild && e.firstChild.firstChild.nodeValue == "";
                result &= e.firstChild && e.firstChild.firstChild && e.firstChild.firstChild.nodeValue == "


text:
var WordPressUser = require('./user');

// get users
module.exports = function get_users() {
  console.log('get users!');
  return 'got users';
};

// FILTER
// The filter parameter controls the query parameters. It is essentially a subset of the parameters available to WP_User_Query.
// The parameter should be an array of the following key/value pairs:

// number - Number of users to retrieve, use -1 for all users. Default is set by the site. (integer)
// offset - Number of posts to skip. Default is 0. (integer)
// orderby - Parameter to search by, as per WP_User_Query. Default is "user_login". (string)
// order - Order to sort by. Default is "ASC". (string, "ASC" or "DESC")
// s - Keyword to search for. (string)


text:
title: Dart Client Library
headline: Documentation
bodyclass: docs
layout: docs
---
# Dart Client Library
 * [Reference documentation]({{site.dart_api_doc}}/client/index.html)
 * [Source code]({{site.dart_repo}}/tree/master/client)


text:
//=================================================================================================

//=================================================================================================

#ifndef _BLAZE_MATH_TRAITS_DECLHERMTRAIT_H_
#define _BLAZE_MATH_TRAITS_DECLHERMTRAIT_H_

//*************************************************************************************************
// Includes
//*************************************************************************************************

#include <utility>
#include <blaze/math/adaptors/hermitianmatrix/BaseTemplate.h>
#include <blaze/math/typetraits/IsMatrix.h>
#include <blaze/math/typetraits/Size.h>
#include <blaze/util/EnableIf.h>

namespace blaze {

//=================================================================================================
//
//  CLASS DEFINITION
//
//=================================================================================================

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename > struct DeclHermTrait;
template< typename, typename = void > struct DeclHermTraitEval;
/*! \endcond */
//*************************************************************************************************

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename T >
auto evalDeclHermTrait( const volatile T& ) -> DeclHermTraitEval<T>;
/*! \endcond */
//*************************************************************************************************

//*************************************************************************************************
/*!\brief Base template for the DeclHermTrait class.
// \ingroup math_traits
//
// \section declhermtrait_general General
//
// The DeclHermTrait class template offers the possibility to select the resulting data type
// of a generic declherm() operation on the given type \a MT. In case the given type \a MT is
// a dense or sparse matrix type, DeclHermTrait defines the nested type \a Type, which represents
// the resulting data type of the declherm() operation. Otherwise there is no nested type \a Type.
// Note that \a const and \a volatile qualifiers and reference modifiers are generally ignored.
//
//
// \section declhermtrait_specializations Creating custom specializations
//
// Per default, DeclHermTrait supports all matrix types of the Blaze library (including views and
// adaptors). For all other data types it is possible to specialize the DeclHermTrait template.
// The following example shows the according specialization for the LowerMatrix class template:

   \code
   template< typename MT, bool SO, bool DF >
   struct DeclHermTrait< LowerMatrix<MT,SO,DF> >
   {
      using Type = HermitianMatrix<MT>;
   };
   \endcode

// \n \section declhermtrait_examples Examples
//
// The following example demonstrates the use of the DeclHermTrait template, where depending on
// the given matrix type the resulting type is selected:

   \code
   using blaze::DynamicMatrix;
   using blaze::StaticMatrix;
   using blaze::LowerMatrix;
   using blaze::DeclHermTrait;
   using blaze::rowMajor;
   using blaze::columnMajor;

   // Definition of the resulting type of a row-major dynamic matrix
   using MatrixType1   = DynamicMatrix<int,rowMajor>;
   using DeclHermType1 = typename DeclHermTrait<MatrixType1>::Type;

   // Definition of the resulting type of a lower column-major static matrix
   using MatrixType2   = LowerMatrix< StaticMatrix<int,3UL,3UL,columnMajor> >;
   using DeclHermType2 = typename DeclHermTrait<MatrixType2>::Type;
   \endcode
*/
template< typename MT >  // Type of the matrix
struct DeclHermTrait
   : public decltype( evalDeclHermTrait( std::declval<MT&>() ) )
{};
//*************************************************************************************************

//*************************************************************************************************
/*!\brief Auxiliary alias declaration for the DeclHermTrait type trait.
// \ingroup math_traits
//
// The DeclHermTrait_t alias declaration provides a convenient shortcut to access the nested
// \a Type of the DeclHermTrait class template. For instance, given the matrix type \a MT the
// following two type definitions are identical:

   \code
   using Type1 = typename blaze::DeclHermTrait<MT>::Type;
   using Type2 = blaze::DeclHermTrait_t<MT>;
   \endcode
*/
template< typename MT >  // Type of the matrix
using DeclHermTrait_t = typename DeclHermTrait<MT>::Type;
//*************************************************************************************************

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Auxiliary helper struct for the DeclHermTrait type trait.
// \ingroup math_traits
*/
template< typename MT  // Type of the matrix
        , typename >   // Restricting condition
struct DeclHermTraitEval
{};
/*! \endcond */
//*************************************************************************************************

//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Specialization of the DeclHermTraitEval class template for square matrix types.
// \ingroup math_traits
*/
template< typename MT >  // Type of the matrix
struct DeclHermTraitEval< MT
                        , EnableIf_t< IsMatrix_v<MT> &&
                                      ( Size_v<MT,0UL> == DefaultSize_v ||
                                        Size_v<MT,1UL> == DefaultSize_v ||
                                        Size_v<MT,0UL> == Size_v<MT,1UL> ) > >
{
   using Type = HermitianMatrix<typename MT::ResultType>;
};
/*! \endcond */
//*************************************************************************************************

} // namespace blaze

#endif


text:
/**
 * @file
 */

#ifndef ORG_OPENSPLICE_CORE_POLICY_POLICY_DELEGATE_HPP_
#define ORG_OPENSPLICE_CORE_POLICY_POLICY_DELEGATE_HPP_

#include <dds/core/types.hpp>
#include <dds/core/LengthUnlimited.hpp>
#include <dds/core/Duration.hpp>
#include <dds/core/policy/PolicyKind.hpp>
#include <org/opensplice/core/policy/ProprietaryPolicyKind.hpp>

#include "u_types.h"
#include "os_thread.h"

//==============================================================================
/*
 * Unfortunately, there isn't an kernel or builtin SubscriptionKey policy that
 * is alligned the same as the idl representation. To be able to translate it
 * as well, we have to seperately mention it...
 */
struct _DDS_SubscriptionKeyQosPolicy;

//==============================================================================
// DDS Policy Classes
namespace org
{
namespace opensplice
{
namespace core
{
namespace policy
{

namespace helper
{
OMG_DDS_API void
convertByteSeq(
        const dds::core::ByteSeq &from,
        c_array &to,
        c_long  &size);

OMG_DDS_API void
convertByteSeq(
        const c_array from,
        const c_long  size,
        dds::core::ByteSeq  &to);

OMG_DDS_API void
convertStringSeq(
        const dds::core::StringSeq &from,
        char *&to,
        const char *delimiter);

OMG_DDS_API void
convertStringSeq(
        const char *from,
        dds::core::StringSeq &to,
        const char *delimiter);
}
//==============================================================================

class OMG_DDS_API TimeBasedFilterDelegate;

/**
 *  @internal This policy is useful for cases where a Topic is expected to have each
 * instance updated periodically. On the publishing side this setting
 * establishes a contract that the application must meet. On the subscribing
 * side the setting establishes a minimum requirement for the remote publishers
 * that are expected to supply the data values. When the Service <D4>matches<D5> a
 * DataWriter and a DataReader it checks whether the settings are compatible
 * (i.e., offered deadline period<= requested deadline period) if they are not,
 * the two entities are informed (via the listener or condition mechanism)
 * of the incompatibility of the QoS settings and communication will not occur.
 * Assuming that the reader and writer ends have compatible settings, the
 * fulfillment of this contract is monitored by the Service and the application
 * is informed of any violations by means of the proper listener or condition.
 * The value offered is considered compatible with the value requested if and
 * only if the inequality <D2>offered deadline period <= requested deadline period<D3>
 * evaluates to <D4>TRUE.<D5> The setting of the DEADLINE policy must be set
 * consistently with that of the TIME_BASED_FILTER.
 * For these two policies to be consistent the settings must be such that
 * <D2>deadline period>= minimum_separation.<D3>
 */
class OMG_DDS_API DeadlineDelegate
{
public:
    DeadlineDelegate(const DeadlineDelegate& other);
    explicit DeadlineDelegate(const dds::core::Duration& d);

    void period(const dds::core::Duration& d);
    dds::core::Duration period() const;

    bool operator ==(const DeadlineDelegate& other) const;

    void check() const;
    void check_against(const org::opensplice::core::policy::TimeBasedFilterDelegate& filter) const;

    void v_policy(const v_deadlinePolicy& policy);
    void v_policyI(const v_deadlinePolicyI& policy);
    v_deadlinePolicy v_policy() const;
    v_deadlinePolicyI v_policyI() const;

private:
    dds::core::Duration period_;
};

//==============================================================================

class OMG_DDS_API DestinationOrderDelegate
{

public:
    DestinationOrderDelegate(const DestinationOrderDelegate& other);
    explicit DestinationOrderDelegate(dds::core::policy::DestinationOrderKind::Type kind);

    void kind(dds::core::policy::DestinationOrderKind::Type kind);
    dds::core::policy::DestinationOrderKind::Type kind() const;

    bool operator ==(const DestinationOrderDelegate& other) const;

    void check() const;

    void v_policy(const v_orderbyPolicy& policy);
    void v_policyI(const v_orderbyPolicyI& policy);
    v_orderbyPolicy v_policy() const;
    v_orderbyPolicyI v_policyI() const;

private:
    dds::core::policy::DestinationOrderKind::Type kind_;
};

//==============================================================================

class OMG_DDS_API DurabilityDelegate
{
public:
    DurabilityDelegate(const DurabilityDelegate& other);
    explicit DurabilityDelegate(dds::core::policy::DurabilityKind::Type kind);

    void kind(dds::core::policy::DurabilityKind::Type kind);
    dds::core::policy::DurabilityKind::Type kind() const;

    bool operator ==(const DurabilityDelegate& other) const;

    void check() const;

    void v_policy(const v_durabilityPolicy& policy);
    void v_policyI(const v_durabilityPolicyI& policy);
    v_durabilityPolicy v_policy() const;
    v_durabilityPolicyI v_policyI() const;

public:
    dds::core::policy::DurabilityKind::Type kind_;
};

//==============================================================================

#ifdef  OMG_DDS_PERSISTENCE_SUPPORT

class OMG_DDS_API DurabilityServiceDelegate
{
public:
    DurabilityServiceDelegate(const DurabilityServiceDelegate& other);
    DurabilityServiceDelegate(const dds::core::Duration& service_cleanup_delay,
                              dds::core::policy::HistoryKind::Type history_kind,
                              int32_t history_depth,
                              int32_t max_samples,
                              int32_t max_instances,
                              int32_t max_samples_per_instance);

    void service_cleanup_delay(const dds::core::Duration& d);
    const dds::core::Duration service_cleanup_delay() const;

    void history_kind(dds::core::policy::HistoryKind::Type kind);
    dds::core::policy::HistoryKind::Type history_kind() const;

    void history_depth(int32_t depth);
    int32_t history_depth() const;

    void max_samples(int32_t max_samples);
    int32_t max_samples() const;

    void max_instances(int32_t max_instances);
    int32_t max_instances() const;

    void max_samples_per_instance(int32_t max_samples_per_instance);
    int32_t max_samples_per_instance() const;

    bool operator ==(const DurabilityServiceDelegate& other) const;

    void check() const;

    void v_policy(const v_durabilityServicePolicy& policy);
    void v_policyI(const v_durabilityServicePolicyI& policy);
    v_durabilityServicePolicy v_policy() const;
    v_durabilityServicePolicyI v_policyI() const;

private:
    dds::core::Duration cleanup_delay_;
    dds::core::policy::HistoryKind::Type history_kind_;
    int32_t history_depth_;
    int32_t max_samples_;
    int32_t max_instances_;
    int32_t max_samples_per_instance_;
};

#endif  // OMG_DDS_PERSISTENCE_SUPPORT

//==============================================================================

/**
 *  @internal This policy controls the behavior of the Entity as a factory for other
 * entities. This policy concerns only DomainParticipant (as factory for
 * Publisher, Subscriber, and Topic), Publisher (as factory for DataWriter),
 * and Subscriber (as factory for DataReader). This policy is mutable.
 * A change in the policy affects only the entities created after the change;
 * not the previously created entities.
 * The setting of autoenable_created_entities to TRUE indicates that the
 * newly created object will be enabled by default.
 * A setting of FALSE indicates that the Entity will not be automatically
 * enabled. The application will need to enable it explicitly by means of the
 * enable operation (see Section 7.1.2.1.1.7, <D2>enable<D3>). The default setting
 * of autoenable_created_entities = TRUE means that, by default, it is not
 * necessary to explicitly call enable on newly created entities.
 */
class OMG_DDS_API EntityFactoryDelegate
{
public:
    EntityFactoryDelegate(const EntityFactoryDelegate& other);
    explicit EntityFactoryDelegate(bool auto_enable);

    void auto_enable(bool on);
    bool auto_enable() const;

    bool operator ==(const EntityFactoryDelegate& other) const;

    void check() const;

    void v_policy(const v_entityFactoryPolicy& policy);
    void v_policyI(const v_entityFactoryPolicyI& policy);
    v_entityFactoryPolicy v_policy() const;
    v_entityFactoryPolicyI v_policyI() const;

private:
    bool auto_enable_;
};

//==============================================================================

/**
 *  @internal The purpose of this QoS is to allow the application to attach additional
 * information to the created Publisher or Subscriber.
 * The value of the GROUP_DATA is available to the application on the
 * DataReader and DataWriter entities and is propagated by means of the
 * built-in topics. This QoS can be used by an application combination with
 * the DataReaderListener and DataWriterListener to implement matching policies
 * similar to those of the PARTITION QoS except the decision can be made based
 * on an application-defined policy.
 */
class OMG_DDS_API GroupDataDelegate
{
public:
    /**
     *  @internal Create a GroupData instance.
     */
    GroupDataDelegate();

    /**
     *  @internal Create a GroupData instance.
     *
     * @param other the group data to copy
     */
    GroupDataDelegate(const GroupDataDelegate& other);

    /**
     *  @internal Create a GroupData instance.
     *
     * @param seq the group data value
     */
    explicit GroupDataDelegate(const dds::core::ByteSeq& seq);

    /**
     *  @internal Set the value for this GroupData
     *
     * @param seq the group data value
     */
    void value(const dds::core::ByteSeq& seq);

    /**
     *  @internal Get the value for this GroupData
     *
     * @return  the group data value
     */
    const dds::core::ByteSeq& value() const;

    bool operator ==(const GroupDataDelegate& other) const;

    /**
     *  @internal Check if policy is consistent.
     *
     * @return true if consistent
     */
    void check() const;

    /**
     *  @internal Set internals by the userlayer/kernel policy.
     *
     * @param the userlayer/kernel policy
     */
    void v_policyI(const v_groupDataPolicyI& policy);
    /**
      *  @internal Set internals by the userlayer/kernel policy.
      *
      * @param the userlayer/kernel policy
      */
    void v_policy(const v_builtinGroupDataPolicy& policy);
    /**
     *  @internal Get the userlayer/kernel policy representation.
     *
     * @return the userlayer/kernel policy
     */
    v_builtinGroupDataPolicy v_policy() const;
    v_groupDataPolicyI v_policyI() const;

private:
    dds::core::ByteSeq value_;
};

//==============================================================================

class OMG_DDS_API ResourceLimitsDelegate;

class OMG_DDS_API HistoryDelegate
{
public:
    HistoryDelegate(const HistoryDelegate& other);
    HistoryDelegate(dds::core::policy::HistoryKind::Type kind, int32_t depth);

    dds::core::policy::HistoryKind::Type kind() const;
    void kind(dds::core::policy::HistoryKind::Type kind);

    int32_t depth() const;
    void depth(int32_t depth);

    bool operator ==(const HistoryDelegate& other) const;

    void check() const;
    void check_against(const org::opensplice::core::policy::ResourceLimitsDelegate& limits) const;

    void v_policy(const v_historyPolicy& policy);
    void v_policyI(const v_historyPolicyI& policy);
    v_historyPolicy v_policy() const;
    v_historyPolicyI v_policyI() const;

private:
    dds::core::policy::HistoryKind::Type kind_;
    int32_t depth_;
};

//==============================================================================

class OMG_DDS_API LatencyBudgetDelegate
{
public:
    LatencyBudgetDelegate(const LatencyBudgetDelegate& other);
    explicit LatencyBudgetDelegate(const dds::core::Duration& d);

    void duration(const dds::core::Duration& d);
    const dds::core::Duration duration() const;

    bool operator ==(const LatencyBudgetDelegate& other) const;

    void check() const;

    void v_policy(const v_latencyPolicy& policy);
    void v_policyI(const v_latencyPolicyI& policy);
    v_latencyPolicy v_policy() const;
    v_latencyPolicyI v_policyI() const;

private:
    dds::core::Duration duration_;
};

//==============================================================================

/**
 *  @internal The purpose of this QoS is to avoid delivering <D2>stale<D3> data to the
 * application. Each data sample written by the DataWriter has an associated
 * expiration time beyond which the data should not be delivered to any
 * application. Once the sample expires, the data will be removed from the
 * DataReader caches as well as from the transient and persistent
 * information caches. The expiration time of each sample is computed by
 * adding the duration specified by the LIFESPAN QoS to the source timestamp.
 * As described in Section 7.1.2.4.2.11, <D2>write and Section 7.1.2.4.2.12,
 * write_w_timestamp the source timestamp is either automatically computed by
 * the Service each time the DataWriter write operation is called, or else
 * supplied by the application by means of the write_w_timestamp operation.
 *
 * This QoS relies on the sender and receiving applications having their clocks
 * sufficiently synchronized. If this is not the case and the Service can
 * detect it, the DataReader is allowed to use the reception timestamp instead
 * of the source timestamp in its computation of the expiration time.
 */
class OMG_DDS_API LifespanDelegate
{
public:
    LifespanDelegate(const LifespanDelegate& other);
    explicit LifespanDelegate(const dds::core::Duration& d);

    void duration(const dds::core::Duration& d);
    const dds::core::Duration duration() const;

    bool operator ==(const LifespanDelegate& other) const;

    void check() const;

    void v_policy(const v_lifespanPolicy& policy);
    void v_policyI(const v_lifespanPolicyI& policy);
    v_lifespanPolicy v_policy() const;
    v_lifespanPolicyI v_policyI() const;

private:
    dds::core::Duration duration_;
};

//==============================================================================

class OMG_DDS_API LivelinessDelegate
{
public:
public:
    LivelinessDelegate(const LivelinessDelegate& other);
    LivelinessDelegate(dds::core::policy::LivelinessKind::Type kind,
                       dds::core::Duration lease_duration);

    void kind(dds::core::policy::LivelinessKind::Type kind);
    dds::core::policy::LivelinessKind::Type kind() const;

    void lease_duration(const dds::core::Duration& lease_duration);
    const dds::core::Duration lease_duration() const;

    bool operator ==(const LivelinessDelegate& other) const;

    void check() const;

    void v_policy(const v_livelinessPolicy& policy);
    void v_policyI(const v_livelinessPolicyI& policy);
    v_livelinessPolicy v_policy() const;
    v_livelinessPolicyI v_policyI() const;

private:
    dds::core::policy::LivelinessKind::Type kind_;
    dds::core::Duration lease_duration_;
};

//==============================================================================

class OMG_DDS_API OwnershipDelegate
{
public:
    OwnershipDelegate(const OwnershipDelegate& other);
    explicit OwnershipDelegate(dds::core::policy::OwnershipKind::Type kind);

    void kind(dds::core::policy::OwnershipKind::Type kind);
    dds::core::policy::OwnershipKind::Type kind() const;

    bool operator ==(const OwnershipDelegate& other) const;

    void check() const;

    void v_policy(const v_ownershipPolicy& policy);
    void v_policyI(const v_ownershipPolicyI& policy);
    v_ownershipPolicy v_policy() const;
    v_ownershipPolicyI v_policyI() const;

private:
    dds::core::policy::OwnershipKind::Type kind_;
};

//==============================================================================

#ifdef  OMG_DDS_OWNERSHIP_SUPPORT

class OMG_DDS_API OwnershipStrengthDelegate
{
public:
    OwnershipStrengthDelegate(const OwnershipStrengthDelegate& other);
    explicit OwnershipStrengthDelegate(int32_t s);

    int32_t strength() const;
    void strength(int32_t s);

    bool operator ==(const OwnershipStrengthDelegate& other) const;

    void check() const;

    void v_policy(const v_strengthPolicy& policy);
    void v_policyI(const v_strengthPolicyI& policy);
    v_strengthPolicy v_policy() const;
    v_strengthPolicyI v_policyI() const;

private:
    int32_t strength_;
};

#endif  // OMG_DDS_OWNERSHIP_SUPPORT

//==============================================================================

class OMG_DDS_API PartitionDelegate
{
public:
    PartitionDelegate(const PartitionDelegate& other);
    explicit PartitionDelegate(const std::string& partition);
    explicit PartitionDelegate(const dds::core::StringSeq& partitions);

    void name(const std::string& partition);
    void name(const dds::core::StringSeq& partitions);
    const dds::core::StringSeq& name() const;

    bool operator ==(const PartitionDelegate& other) const;

    void check() const;

    void v_policyI(const v_partitionPolicyI& policy);
    void v_policy(const v_builtinPartitionPolicy& policy);

    v_builtinPartitionPolicy v_policy() const;
    v_partitionPolicyI v_policyI() const;

private:
    dds::core::StringSeq name_;
};

//==============================================================================

class OMG_DDS_API PresentationDelegate
{
public:
    PresentationDelegate(const PresentationDelegate& other);
    PresentationDelegate(dds::core::policy::PresentationAccessScopeKind::Type access_scope,
                         bool coherent_access,
                         bool ordered_access);

    void access_scope(dds::core::policy::PresentationAccessScopeKind::Type as);
    dds::core::policy::PresentationAccessScopeKind::Type access_scope() const;

    void coherent_access(bool on);
    bool coherent_access() const;

    void ordered_access(bool on);
    bool ordered_access() const;

    bool operator ==(const PresentationDelegate& other) const;

    void v_policy(const v_presentationPolicy& policy);
    void v_policyI(const v_presentationPolicyI& policy);
    v_presentationPolicy v_policy() const;
    v_presentationPolicyI v_policyI() const;

private:
    dds::core::policy::PresentationAccessScopeKind::Type access_scope_;
    bool coherent_access_;
    bool ordered_access_;
};

//==============================================================================

class OMG_DDS_API ProductDataDelegate
{
public:
public:
    ProductDataDelegate();
    ProductDataDelegate(const ProductDataDelegate& other);
    explicit ProductDataDelegate(const std::string& name);

    void name(const std::string& name);
    std::string name() const;

    bool operator ==(const ProductDataDelegate& other) const;

    void check() const;

    void v_policy(const v_productDataPolicy& policy);
    void v_policyI(const v_productDataPolicyI& policy);
    v_productDataPolicy v_policy() const;
    v_productDataPolicyI v_policyI() const;

private:
    std::string name_;
};

//==============================================================================

class OMG_DDS_API ReaderDataLifecycleDelegate
{
public:
    ReaderDataLifecycleDelegate(const ReaderDataLifecycleDelegate& other);
    ReaderDataLifecycleDelegate(const dds::core::Duration& nowriter_delay,
                                const dds::core::Duration& disposed_samples_delay);

    const dds::core::Duration autopurge_nowriter_samples_delay() const;
    void autopurge_nowriter_samples_delay(const dds::core::Duration& d);

    const dds::core::Duration autopurge_disposed_samples_delay() const;
    void autopurge_disposed_samples_delay(const dds::core::Duration& d);

    bool autopurge_dispose_all() const;
    void autopurge_dispose_all(bool b);

    bool enable_invalid_samples() const;
    void enable_invalid_samples(bool b);

    void invalid_sample_visibility(org::opensplice::core::policy::InvalidSampleVisibility::Type visibility);
    org::opensplice::core::policy::InvalidSampleVisibility::Type invalid_sample_visibility() const;

    bool operator ==(const ReaderDataLifecycleDelegate& other) const;

    void check() const;

    void v_policy(const v_readerLifecyclePolicy& policy);
    void v_policyI(const v_readerLifecyclePolicyI& policy);
    v_readerLifecyclePolicy v_policy() const;
    v_readerLifecyclePolicyI v_policyI() const;

private:
    dds::core::Duration autopurge_nowriter_samples_delay_;
    dds::core::Duration autopurge_disposed_samples_delay_;
    /* Proprietary extension, accessible by using operator-> on spec policy. */
    bool autopurge_dispose_all_;
    bool enable_invalid_samples_;
    org::opensplice::core::policy::InvalidSampleVisibility::Type invalid_sample_visibility_;
};

//==============================================================================

class OMG_DDS_API ReaderLifespanDelegate
{
public:
    ReaderLifespanDelegate();
    ReaderLifespanDelegate(const ReaderLifespanDelegate& other);
    explicit ReaderLifespanDelegate(bool used,
                              const dds::core::Duration& d);

    void duration(const dds::core::Duration& d);
    const dds::core::Duration duration() const;

    void used(bool v);
    bool used() const;

    bool operator ==(const ReaderLifespanDelegate& other) const;

    void check() const;

    void v_policy(const v_readerLifespanPolicy& policy);
    void v_policyI(const v_readerLifespanPolicyI& policy);
    v_readerLifespanPolicy v_policy() const;
    v_readerLifespanPolicyI v_policyI() const;

private:
    bool used_;
    dds::core::Duration duration_;
};

//==============================================================================

class OMG_DDS_API ReliabilityDelegate
{
public:
public:
    ReliabilityDelegate(const ReliabilityDelegate& other);
    ReliabilityDelegate(dds::core::policy::ReliabilityKind::Type kind,
                        const dds::core::Duration& max_blocking_time);

    void kind(dds::core::policy::ReliabilityKind::Type kind);
    dds::core::policy::ReliabilityKind::Type kind() const;

    void max_blocking_time(const dds::core::Duration& d);
    const dds::core::Duration max_blocking_time() const;

    bool synchronous() const;
    void synchronous(bool b);

    bool operator ==(const ReliabilityDelegate& other) const;

    void check() const;

    void v_policy(const v_reliabilityPolicy& policy);
    void v_policyI(const v_reliabilityPolicyI& policy);
    v_reliabilityPolicy v_policy() const;
    v_reliabilityPolicyI v_policyI() const;

private:
    dds::core::policy::ReliabilityKind::Type kind_;
    dds::core::Duration max_blocking_time_;
    /* Proprietary extension, accessible by using operator-> on spec policy. */
    bool synchronous_;
};

//==============================================================================

class OMG_DDS_API ResourceLimitsDelegate
{
public:
    ResourceLimitsDelegate(const ResourceLimitsDelegate& other);
    ResourceLimitsDelegate(int32_t max_samples,
                           int32_t max_instances,
                           int32_t max_samples_per_instance);

    void max_samples(int32_t samples);
    int32_t max_samples() const;

    void max_instances(int32_t max_instances);
    int32_t max_instances() const;

    void max_samples_per_instance(int32_t max_samples_per_instance);
    int32_t max_samples_per_instance() const;

    bool operator ==(const ResourceLimitsDelegate& other) const;

    void check() const;
    void check_against(const org::opensplice::core::policy::HistoryDelegate& history) const;

    void v_policy(const v_resourcePolicy& policy);
    void v_policyI(const v_resourcePolicyI& policy);
    v_resourcePolicy v_policy() const;
    v_resourcePolicyI v_policyI() const;

private:
    int32_t max_samples_;
    int32_t max_instances_;
    int32_t max_samples_per_instance_;
};

//==============================================================================

class OMG_DDS_API SchedulingDelegate
{
public:
    SchedulingDelegate();
    SchedulingDelegate(const SchedulingDelegate& other);
    SchedulingDelegate(const org::opensplice::core::policy::SchedulingKind::Type& scheduling_kind,
                       const org::opensplice::core::policy::SchedulingPriorityKind::Type& scheduling_priority_kind,
                       int32_t scheduling_priority);

    void scheduling_kind(const org::opensplice::core::policy::SchedulingKind::Type& scheduling_kind);
    org::opensplice::core::policy::SchedulingKind::Type scheduling_kind() const;

    void scheduling_priority_kind(const org::opensplice::core::policy::SchedulingPriorityKind::Type& scheduling_priority_kind);
    org::opensplice::core::policy::SchedulingPriorityKind::Type scheduling_priority_kind() const;

    void scheduling_priority(int32_t scheduling_priority);
    int32_t scheduling_priority() const;

    bool operator ==(const SchedulingDelegate& other) const;

    void check() const;

    void v_policyI(const v_schedulePolicyI& policy);
    v_schedulePolicyI v_policyI() const;

    void os_thread_attr(os_threadAttr *threadAttr) const;

private:
    org::opensplice::core::policy::SchedulingKind::Type scheduling_kind_;
    org::opensplice::core::policy::SchedulingPriorityKind::Type scheduling_priority_kind_;
    int32_t scheduling_priority_;
};

//==============================================================================

class OMG_DDS_API ShareDelegate
{
public:
public:
    ShareDelegate();
    ShareDelegate(const ShareDelegate& other);
    ShareDelegate(const std::string& name, bool enable);

    void name(const std::string& name);
    std::string name() const;

    void enable(bool enable);
    bool enable() const;

    bool operator ==(const ShareDelegate& other) const;

    void check() const;

    void v_policy(const v_sharePolicy& policy);
    void v_policyI(const v_sharePolicyI& policy);
    v_sharePolicy v_policy() const;
    v_sharePolicyI v_policyI() const;

private:
    std::string name_;
    bool        enable_;
};

//==============================================================================

class OMG_DDS_API SubscriptionKeyDelegate
{
public:
    SubscriptionKeyDelegate();
    SubscriptionKeyDelegate(const SubscriptionKeyDelegate& other);
    SubscriptionKeyDelegate(bool use_key_list, const std::string& key);
    SubscriptionKeyDelegate(bool use_key_list, const dds::core::StringSeq& keys);

public:
    void key(const std::string& key);
    void key(const dds::core::StringSeq& keys);
    const dds::core::StringSeq& key() const;

    void use_key_list(bool use_key_list);
    bool use_key_list() const;

    bool operator ==(const SubscriptionKeyDelegate& other) const;

    void check() const;

    void v_policy(const struct _DDS_SubscriptionKeyQosPolicy& policy);
    void v_policy(const v_userKeyPolicy& policy);
    void v_policyI(const v_userKeyPolicyI& policy);
    v_userKeyPolicy v_policy() const;
    v_userKeyPolicyI v_policyI() const;

private:
    bool use_key_list_;
    dds::core::StringSeq keys_;
};

//==============================================================================

class OMG_DDS_API TimeBasedFilterDelegate
{
public:
    TimeBasedFilterDelegate(const TimeBasedFilterDelegate& other);
    explicit TimeBasedFilterDelegate(const dds::core::Duration& min_separation);

    void min_separation(const dds::core::Duration& ms);
    const dds::core::Duration min_separation() const;

    bool operator ==(const TimeBasedFilterDelegate& other) const;

    void check() const;
    void check_against(const org::opensplice::core::policy::DeadlineDelegate& deadline) const;

    void v_policy(const v_pacingPolicy& policy);
    void v_policyI(const v_pacingPolicyI& policy);
    v_pacingPolicy v_policy() const;
    v_pacingPolicyI v_policyI() const;

private:
    dds::core::Duration min_sep_;
};

//==============================================================================

/**
 *  @internal The purpose of this QoS is to allow the application to attach additional
 * information to the created Topic such that when a remote application
 * discovers their existence it can examine the information and use it in
 * an application-defined way. In combination with the listeners on the
 * DataReader and DataWriter as well as by means of operations such as
 * ignore_topic, these QoS can assist an application to extend the provided QoS.
 */
class OMG_DDS_API TopicDataDelegate
{
public:
    TopicDataDelegate();
    TopicDataDelegate(const TopicDataDelegate& other);
    explicit TopicDataDelegate(const dds::core::ByteSeq& seq);

    void value(const dds::core::ByteSeq& seq);
    const dds::core::ByteSeq& value() const;

    bool operator ==(const TopicDataDelegate& other) const;

    void check() const;

    void v_policyI(const v_topicDataPolicyI& policy);
    void v_policy(const v_builtinTopicDataPolicy& policy);

    v_builtinTopicDataPolicy v_policy() const;
    v_topicDataPolicyI v_policyI() const;

private:
    dds::core::ByteSeq value_;

};

//==============================================================================

/**
 *  @internal The purpose of this QoS is to allow the application to take advantage of
 * transports capable of sending messages with different priorities.
 * This policy is considered a hint. The policy depends on the ability of the
 * underlying transports to set a priority on the messages they send.
 * Any value within the range of a 32-bit signed integer may be chosen;
 * higher values indicate higher priority. However, any further interpretation
 * of this policy is specific to a particular transport and a particular
 * implementation of the Service. For example, a particular transport is
 * permitted to treat a range of priority values as equivalent to one another.
 * It is expected that during transport configuration the application would
 * provide a mapping between the values of the TRANSPORT_PRIORITY set on
 * DataWriter and the values meaningful to each transport. This mapping would
 * then be used by the infrastructure when propagating the data written by
 * the DataWriter.
 */
class OMG_DDS_API TransportPriorityDelegate
{
public:
    TransportPriorityDelegate(const TransportPriorityDelegate& other);
    explicit TransportPriorityDelegate(uint32_t prio);

    void value(uint32_t prio);
    uint32_t value() const;

    bool operator ==(const TransportPriorityDelegate& other) const;

    void check() const;

    void v_policy(const v_transportPolicy& policy);
    void v_policyI(const v_transportPolicyI& policy);
    v_transportPolicy v_policy() const;
    v_transportPolicyI v_policyI() const;

private:
    uint32_t value_;
};

//==============================================================================

/**
 *  @internal The purpose of this QoS is to allow the application to attach additional
 * information to the created Entity objects such that when a remote application
 * discovers their existence it can access that information and use it for its
 * own purposes. One possible use of this QoS is to attach security credentials
 * or some other information that can be used by the remote application to
 * authenticate the source. In combination with operations such as
 * dds::domain::ignore, dds::pub::ignore, dds::sub::ignore,
 * and dds::topic::ignore these QoS can assist an application to define and enforce
 * its own security policies. The use of this QoS is not limited to security,
 * rather it offers a simple, yet flexible extensibility mechanism.
 */
class OMG_DDS_API UserDataDelegate
{
public:
    /**
     *  @internal Create a UserData instance with an empty user data.
     */
    UserDataDelegate();

    /**
     *  @internal Create a UserData instance.
     *
     * @param other the user data to copy
     */
    UserDataDelegate(const UserDataDelegate& other);

    /**
     *  @internal Create a UserData instance.
     *
     * @param seq the sequence of octet representing the user data
     */
    explicit UserDataDelegate(const dds::core::ByteSeq& seq);

    /**
     *  @internal Set the value for the user data.
     *
     * @param seq a sequence of octet representing the user data.
     */
    void value(const dds::core::ByteSeq& seq);

    /**
     *  @internal Get the user data.
     *
     * @return the sequence of octet representing the user data
     */
    const dds::core::ByteSeq value() const;

    bool operator ==(const UserDataDelegate& other) const;

    /**
     *  @internal Check if policy is consistent.
     *
     * @return true if consistent
     */
    void check() const;

    /**
     *  @internal Set internals by the userlayer/kernel policy.
     *
     * @param the userlayer/kernel policy
     */
    void v_policyI(const v_userDataPolicyI& policy);
    /**
     *  @internal Set internals by the userlayer/kernel policy.
     *
     * @param the userlayer/kernel policy
     */
    void v_policy(const v_userDataPolicy& policy);
    /**
     *  @internal Set internals by the userlayer/kernel policy.
     *
     * @param the userlayer/kernel policy
     */
    void v_policy(const v_builtinUserDataPolicy& policy);
    /**
     *  @internal Get the userlayer/kernel policy representation.
     *
     * @return the userlayer/kernel policy
     */
    v_userDataPolicyI v_policyI() const;
    v_builtinUserDataPolicy v_policy() const;

private:
    dds::core::ByteSeq value_;
};

//==============================================================================

class OMG_DDS_API WriterDataLifecycleDelegate
{
public:
    WriterDataLifecycleDelegate(const WriterDataLifecycleDelegate& other);
    explicit WriterDataLifecycleDelegate(bool autodispose);

    bool autodispose() const;
    void autodispose(bool b);

    void autopurge_suspended_samples_delay(const dds::core::Duration& d);
    const dds::core::Duration autopurge_suspended_samples_delay() const;

    void autounregister_instance_delay(const dds::core::Duration& d);
    const dds::core::Duration autounregister_instance_delay() const;

    bool operator ==(const WriterDataLifecycleDelegate& other) const;

    void check() const;

    void v_policy(const v_writerLifecyclePolicy& policy);
    void v_policyI(const v_writerLifecyclePolicyI& policy);
    v_writerLifecyclePolicy v_policy() const;
    v_writerLifecyclePolicyI v_policyI() const;

private:
    bool autodispose_;
    /* Proprietary extension, accessible by using operator-> on spec policy. */
    dds::core::Duration autopurge_suspended_samples_delay_;
    dds::core::Duration autounregister_instance_delay_;
};

#ifdef  OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT

class OMG_DDS_API DataRepresentationDelegate { };

#endif  // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT

#ifdef  OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT

class OMG_DDS_API TypeConsistencyEnforcementDelegate { };

#endif  // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT

}
}
}
}  // namespace org::opensplice::core::policy

#endif /* ORG_OPENSPLICE_CORE_POLICY_POLICY_DELEGATE_HPP_ */