Coder Social home page Coder Social logo

Comments (3)

zaidedan avatar zaidedan commented on September 17, 2024

*proposed

On Thu, Aug 13, 2015 at 1:02 PM, Another Minion [email protected]
wrote:

I believe the apf::getElementNumbers should return the integer. Right now
this function is just a wrapper over numbering->getData()->getElementData
used as some template wizardry.

getElementData takes a NewArray and will dynamically resize it, then
returns the new size of the array. Now NewArray has no internal
representation of size, so this return is very necessary to keep track of
the size of the array. Right now the apf::getElementNumbers black boxes the
new size and there is no way to tell the new size if reallocation occurs.

This is the purposed change:

diff --git a/apf/apfNumbering.cc b/apf/apfNumbering.cc
index cd39870..538943c 100644
--- a/apf/apfNumbering.cc
+++ b/apf/apfNumbering.cc
@@ -180,9 +180,9 @@ int countComponents(Numbering* n)
return n->countComponents();
}

-void getElementNumbers(Numbering* n, MeshEntity* e, NewArray& numbers)
+int getElementNumbers(Numbering* n, MeshEntity* e, NewArray& numbers)
{

  • n->getData()->getElementData(e,numbers);
  • return n->getData()->getElementData(e,numbers);
    }

int countFixed(Numbering* n)
diff --git a/apf/apfNumbering.h b/apf/apfNumbering.h
index 9a9a016..909c417 100644
--- a/apf/apfNumbering.h
+++ b/apf/apfNumbering.h
@@ -81,7 +81,7 @@ int countComponents(Numbering* n);
/** \brief returns the node numbers of an element \details numbers are returned in the standard element node ordering for its shape functions /
-void getElementNumbers(Numbering
n, MeshEntity* e, NewArray& numbers);
+int getElementNumbers(Numbering* n, MeshEntity* e, NewArray& numbers);

/** \brief return the number of fixed degrees of freedom /
int countFixed(Numbering
n);


Reply to this email directly or view it on GitHub
#11.

Dr. Daniel W. Zaide (偉明),
Researcher, Rensselaer Polytechnic Institute
B.A.Sc. University of Toronto (2007)
M.S.E, M.S. Ph.D., University of Michigan (2009,2011,2012)
www.danielzaide.com http://www.danielzaide.com

from core.

zaidedan avatar zaidedan commented on September 17, 2024

Chances are, if you are asking for the numbers, you already know how many
you should get,
returning an int telling you that seems superfluous, IMO.
(Maybe an unsigned const would be preferred).

What is your use of it in this case?

On Thu, Aug 13, 2015 at 1:22 PM, Daniel Zaide [email protected] wrote:

*proposed

On Thu, Aug 13, 2015 at 1:02 PM, Another Minion [email protected]
wrote:

I believe the apf::getElementNumbers should return the integer. Right now
this function is just a wrapper over numbering->getData()->getElementData
used as some template wizardry.

getElementData takes a NewArray and will dynamically resize it, then
returns the new size of the array. Now NewArray has no internal
representation of size, so this return is very necessary to keep track of
the size of the array. Right now the apf::getElementNumbers black boxes the
new size and there is no way to tell the new size if reallocation occurs.

This is the purposed change:

diff --git a/apf/apfNumbering.cc b/apf/apfNumbering.cc
index cd39870..538943c 100644
--- a/apf/apfNumbering.cc
+++ b/apf/apfNumbering.cc
@@ -180,9 +180,9 @@ int countComponents(Numbering* n)
return n->countComponents();
}

-void getElementNumbers(Numbering* n, MeshEntity* e, NewArray& numbers)
+int getElementNumbers(Numbering* n, MeshEntity* e, NewArray& numbers)
{

  • n->getData()->getElementData(e,numbers);
  • return n->getData()->getElementData(e,numbers);
    }

int countFixed(Numbering* n)
diff --git a/apf/apfNumbering.h b/apf/apfNumbering.h
index 9a9a016..909c417 100644
--- a/apf/apfNumbering.h
+++ b/apf/apfNumbering.h
@@ -81,7 +81,7 @@ int countComponents(Numbering* n);
/** \brief returns the node numbers of an element \details numbers are returned in the standard element node ordering for its shape functions /
-void getElementNumbers(Numbering
n, MeshEntity* e, NewArray& numbers);
+int getElementNumbers(Numbering* n, MeshEntity* e, NewArray& numbers);

/** \brief return the number of fixed degrees of freedom /
int countFixed(Numbering
n);


Reply to this email directly or view it on GitHub
#11.

Dr. Daniel W. Zaide (偉明),
Researcher, Rensselaer Polytechnic Institute
B.A.Sc. University of Toronto (2007)
M.S.E, M.S. Ph.D., University of Michigan (2009,2011,2012)
www.danielzaide.com http://www.danielzaide.com

Dr. Daniel W. Zaide (偉明),
Researcher, Rensselaer Polytechnic Institute
B.A.Sc. University of Toronto (2007)
M.S.E, M.S. Ph.D., University of Michigan (2009,2011,2012)
www.danielzaide.com http://www.danielzaide.com

from core.

ibaned avatar ibaned commented on September 17, 2024

eh, this is actually consistent with the behavior of that function for global numberings.
I was just slow to respond due to commuting

c37b233

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.