I see. Many thanks, Roy!

On Mon, Dec 12, 2016 at 9:40 AM, Roy Stogner <[email protected]>
wrote:

>
> On Thu, 8 Dec 2016, Xinzeng Feng wrote:
>
> Thanks, Roy! I will avoid hanging nodes definitely. Just to make sure,
>> what you're suggesting is the following, right?
>> for it_node
>>      n = n_nodes-distance(it_node, it_node_end);
>>      displacement(0) = (*system.solution)(3n);
>>      displacement(1) = (*system.solution)(3n+1);
>>      displacement(2) = (*system.solution)(3n+2);
>>
>>      **it_node += displacement;
>> end
>>
>
> This should work iff your solution is numbered in exactly that
> dof_index==3*node_index+dim fashion.  Which is possible; that might even
> be the default behavior when you're running in serial *and* you've
> specified --node_major_dofs *and* you added your displacement_x/_y/_z
> variables in that order before adding any other variables.
>
> It's too fragile an assumption to make in general, though.  Instead of
> "3*n" I'd use (*it_node)->dof_index(sys_num, var_x, 0) (where var_x is
> the index returned by the system.add_variable("displacement_x") call
> or by a system.variable_number("displacement_x") call); then similar
> for your y and z displacement variables.
>
> If performance is a factor make sure you call variable_number()
> outside the loop; it's O(1) but with a nasty constant thanks to the
> string lookup involved.  On the other hand, your loop above has an
> even bigger problem: std::distance is O(N) on most iterators,
> including our mesh iterators.
> ---
> Roy




-- 
Xinzeng Feng, Ph.D.
Institute for Computational Engineering and Sciences, Postdoctoral Fellow
University of Texas, Austin
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to